mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
Run cargo fmt
in CI (#431)
<!-- Thank you for submitting this PR! :) --> ## Description When I run `cargo fmt` on my branches, it makes more diff than I want. This PR fixes that by adding `just format` / `just fmt`, and adding it to a CI job. <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [ ] community-edition - [ ] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [ ] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> _Replace with changelog entry_ <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: e31e352f27b9ad0129c3759fead051b1a8d86758
This commit is contained in:
parent
cc9cedc268
commit
ec62ea463c
@ -433,13 +433,15 @@ fn eval_order_by_element(
|
||||
column,
|
||||
function,
|
||||
),
|
||||
ndc_models::OrderByTarget::StarCountAggregate { path } => eval_order_by_star_count_aggregate(
|
||||
collection_relationships,
|
||||
variables,
|
||||
state,
|
||||
item,
|
||||
path,
|
||||
),
|
||||
ndc_models::OrderByTarget::StarCountAggregate { path } => {
|
||||
eval_order_by_star_count_aggregate(
|
||||
collection_relationships,
|
||||
variables,
|
||||
state,
|
||||
item,
|
||||
path,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -999,8 +1001,8 @@ pub(crate) fn eval_nested_field(
|
||||
state,
|
||||
&full_row,
|
||||
)?;
|
||||
Ok(ndc_models::RowFieldValue(serde_json::to_value(row).map_err(
|
||||
|_| {
|
||||
Ok(ndc_models::RowFieldValue(
|
||||
serde_json::to_value(row).map_err(|_| {
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Json(ndc_models::ErrorResponse {
|
||||
@ -1008,8 +1010,8 @@ pub(crate) fn eval_nested_field(
|
||||
details: serde_json::Value::Null,
|
||||
}),
|
||||
)
|
||||
},
|
||||
)?))
|
||||
})?,
|
||||
))
|
||||
}
|
||||
ndc_models::NestedField::Array(ndc_models::NestedArray { fields }) => {
|
||||
let array: Vec<serde_json::Value> = serde_json::from_value(value).map_err(|_| {
|
||||
|
@ -223,7 +223,7 @@ async fn get_execution_steps<'s>(
|
||||
|
||||
/// Get the join steps for a given join location. This should be used to get the join steps for a remote relationship.
|
||||
/// It also supports nested remote relationships.
|
||||
///
|
||||
///
|
||||
/// TODO: Currently the steps are sequential, we should make them parallel once the executor supports it.
|
||||
#[async_recursion]
|
||||
async fn get_join_steps(
|
||||
|
@ -26,24 +26,28 @@ pub async fn execute_ndc_query<'n, 's>(
|
||||
) -> Result<Vec<ndc_models::RowSet>, error::Error> {
|
||||
let tracer = tracing_util::global_tracer();
|
||||
tracer
|
||||
.in_span_async("Execute query using data connector", SpanVisibility::User, || {
|
||||
Box::pin(async {
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"operation",
|
||||
execution_span_attribute,
|
||||
);
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"field",
|
||||
field_span_attribute,
|
||||
);
|
||||
let connector_response =
|
||||
fetch_from_data_connector(http_client, query, data_connector, project_id)
|
||||
.await?;
|
||||
Ok(connector_response.0)
|
||||
})
|
||||
})
|
||||
.in_span_async(
|
||||
"Execute query using data connector",
|
||||
SpanVisibility::User,
|
||||
|| {
|
||||
Box::pin(async {
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"operation",
|
||||
execution_span_attribute,
|
||||
);
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"field",
|
||||
field_span_attribute,
|
||||
);
|
||||
let connector_response =
|
||||
fetch_from_data_connector(http_client, query, data_connector, project_id)
|
||||
.await?;
|
||||
Ok(connector_response.0)
|
||||
})
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
@ -109,56 +113,60 @@ pub(crate) async fn execute_ndc_mutation<'n, 's, 'ir>(
|
||||
) -> Result<json::Value, error::Error> {
|
||||
let tracer = tracing_util::global_tracer();
|
||||
tracer
|
||||
.in_span_async("Execute mutation using data connector", SpanVisibility::User, || {
|
||||
Box::pin(async {
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"operation",
|
||||
execution_span_attribute,
|
||||
);
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"field",
|
||||
field_span_attribute,
|
||||
);
|
||||
let connector_response = fetch_from_data_connector_mutation(
|
||||
http_client,
|
||||
query,
|
||||
data_connector,
|
||||
project_id,
|
||||
)
|
||||
.await?;
|
||||
// Post process the response to add the `__typename` fields
|
||||
tracer.in_span("process_response", SpanVisibility::Internal, || {
|
||||
// NOTE: NDC returns a `Vec<RowSet>` (to account for
|
||||
// variables). We don't use variables in NDC queries yet,
|
||||
// hence we always pick the first `RowSet`.
|
||||
let mutation_results = connector_response
|
||||
.operation_results
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or(error::InternalDeveloperError::BadGDCResponse {
|
||||
summary: "missing rowset".into(),
|
||||
})?;
|
||||
match process_response_as {
|
||||
ProcessResponseAs::CommandResponse {
|
||||
command_name: _,
|
||||
type_container,
|
||||
} => process_command_mutation_response(
|
||||
mutation_results,
|
||||
selection_set,
|
||||
type_container,
|
||||
),
|
||||
_ => Err(error::Error::from(
|
||||
error::InternalEngineError::InternalGeneric {
|
||||
description: "mutations without commands are not supported yet"
|
||||
.into(),
|
||||
},
|
||||
)),
|
||||
}
|
||||
.in_span_async(
|
||||
"Execute mutation using data connector",
|
||||
SpanVisibility::User,
|
||||
|| {
|
||||
Box::pin(async {
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"operation",
|
||||
execution_span_attribute,
|
||||
);
|
||||
set_attribute_on_active_span(
|
||||
AttributeVisibility::Default,
|
||||
"field",
|
||||
field_span_attribute,
|
||||
);
|
||||
let connector_response = fetch_from_data_connector_mutation(
|
||||
http_client,
|
||||
query,
|
||||
data_connector,
|
||||
project_id,
|
||||
)
|
||||
.await?;
|
||||
// Post process the response to add the `__typename` fields
|
||||
tracer.in_span("process_response", SpanVisibility::Internal, || {
|
||||
// NOTE: NDC returns a `Vec<RowSet>` (to account for
|
||||
// variables). We don't use variables in NDC queries yet,
|
||||
// hence we always pick the first `RowSet`.
|
||||
let mutation_results = connector_response
|
||||
.operation_results
|
||||
.into_iter()
|
||||
.next()
|
||||
.ok_or(error::InternalDeveloperError::BadGDCResponse {
|
||||
summary: "missing rowset".into(),
|
||||
})?;
|
||||
match process_response_as {
|
||||
ProcessResponseAs::CommandResponse {
|
||||
command_name: _,
|
||||
type_container,
|
||||
} => process_command_mutation_response(
|
||||
mutation_results,
|
||||
selection_set,
|
||||
type_container,
|
||||
),
|
||||
_ => Err(error::Error::from(
|
||||
error::InternalEngineError::InternalGeneric {
|
||||
description: "mutations without commands are not supported yet"
|
||||
.into(),
|
||||
},
|
||||
)),
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,10 @@ pub struct DataConnectorLink {
|
||||
}
|
||||
|
||||
impl std::hash::Hash for DataConnectorLink {
|
||||
fn hash<H>(&self, h: &mut H) where H: std::hash::Hasher {
|
||||
fn hash<H>(&self, h: &mut H)
|
||||
where
|
||||
H: std::hash::Hasher,
|
||||
{
|
||||
self.name.hash(h)
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,10 @@ ci-lint:
|
||||
fix:
|
||||
just docker_with_source_only sh -c "cargo clippy --no-deps --fix --allow-no-vcs -- {{ CLIPPY_FIX_ARGS }}; cargo fmt"
|
||||
|
||||
format:
|
||||
cargo fmt --check
|
||||
alias fmt := format
|
||||
|
||||
fix-local:
|
||||
cargo clippy --no-deps --fix --allow-no-vcs -- {{ CLIPPY_FIX_ARGS }}; cargo fmt
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user