-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create @call
operator
#881
feat: create @call
operator
#881
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #881 +/- ##
==========================================
- Coverage 88.39% 82.80% -5.60%
==========================================
Files 99 100 +1
Lines 10721 11000 +279
==========================================
- Hits 9477 9108 -369
- Misses 1244 1892 +648 ☔ View full report in Codecov by Sentry. |
0d5a205
to
b0d82b0
Compare
…allhq#846/create-call-operator
# Conflicts: # src/config/from_document.rs # tests/graphql/errors/test-multiple-resolvable-directives-on-field.graphql
The serialization counterpart of this is missing from |
…allhq#846/create-call-operator
…:ologbonowiwi/tailcall into feat/tailcallhq#846/create-call-operator
fixed, thank you @mogery |
struct Http { | ||
pub req_template: http::RequestTemplate, | ||
pub group_by: Option<GroupBy>, | ||
pub dl_id: Option<DataLoaderId>, | ||
} | ||
|
||
struct GraphQLEndpoint { | ||
pub req_template: graphql::RequestTemplate, | ||
pub field_name: String, | ||
pub batch: bool, | ||
pub dl_id: Option<DataLoaderId>, | ||
} | ||
|
||
struct Grpc { | ||
pub req_template: grpc::RequestTemplate, | ||
pub group_by: Option<GroupBy>, | ||
pub dl_id: Option<DataLoaderId>, | ||
} | ||
|
||
impl TryFrom<Expression> for Http { | ||
type Error = String; | ||
|
||
fn try_from(expr: Expression) -> Result<Self, Self::Error> { | ||
match expr { | ||
Expression::IO(IO::Http { req_template, group_by, dl_id }) => { | ||
Ok(Http { req_template, group_by, dl_id }) | ||
} | ||
_ => Err("not an http expression".to_string()), | ||
} | ||
} | ||
} | ||
|
||
impl TryFrom<Expression> for GraphQLEndpoint { | ||
type Error = String; | ||
|
||
fn try_from(expr: Expression) -> Result<Self, Self::Error> { | ||
match expr { | ||
Expression::IO(IO::GraphQLEndpoint { req_template, field_name, batch, dl_id }) => { | ||
Ok(GraphQLEndpoint { req_template, field_name, batch, dl_id }) | ||
} | ||
_ => Err("not a graphql expression".to_string()), | ||
} | ||
} | ||
} | ||
|
||
impl TryFrom<Expression> for Grpc { | ||
type Error = String; | ||
|
||
fn try_from(expr: Expression) -> Result<Self, Self::Error> { | ||
match expr { | ||
Expression::IO(IO::Grpc { req_template, group_by, dl_id }) => { | ||
Ok(Grpc { req_template, group_by, dl_id }) | ||
} | ||
_ => Err("not a grpc expression".to_string()), | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done to avoid unreachable code. I can delete it and use match
letting an unreachable _ => Valid::succeed
or _ => panic!
, let me know which is better, guys.
I'll open another one. This had many outdated discussions, which makes harder to follow and review |
Issue Reference(s):
Fixes #846
/claim #846
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>