-
Notifications
You must be signed in to change notification settings - Fork 3
arguments for read-write native queries #16
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
1ef17e1
add configuration for native queries; report queries in schema response
hallettj 029ff0f
read schema and native queries from separate files
hallettj 9ebfc75
rename metadata to schema
hallettj b6f6258
update fixture configuration
hallettj 039c840
succeed parsing configuration if no native_queries are present
hallettj 12e7b33
add mode property to NativeQuery
hallettj 5962ae5
represent native queries as functions and procedures in schema
hallettj b995bee
Merge branch 'main' into jesse/native-queries
hallettj 178695a
execute native query
hallettj c608d17
updated fixtures with a very basic native query
hallettj e9f042f
add more context to configuration read errors
hallettj f5d4f62
add objectTypes field to native queries
hallettj 5385363
update fixtures with object types
hallettj 1238cc6
Merge branch 'main' into jesse/native-queries-in-query-handler
hallettj e6b32b1
fix a typo
hallettj 0d098d3
check for duplicate names when parsing configuration
hallettj 4100fd7
implementation for read-write native queries
hallettj 6af42b6
remove fields from Job if we're not going to use it
hallettj a092d72
add example mutation, insertArtist, in fixtures
hallettj 9189bdf
Merge branch 'main' into jesse/mutations-via-native-queries
hallettj 3c7e9df
fixture was inserting two documents
hallettj fae1840
wip:
hallettj 795c59d
add json_to_bson with implementations for scalar and object types
hallettj 2c556af
implement array conversion in json_to_bson
hallettj e3fcc1b
convert nullable types
hallettj a452ca4
cleanup
hallettj 251ea63
Merge branch 'main' into arguments-for-native-queries
hallettj 6c75265
wip
hallettj 3dbb723
updates for switch to map types
hallettj f21e75d
rename
hallettj 4b78a1a
Merged origin/main into arguments-for-native-queries
hallettj 5a382bd
add Procedure type that resolves arguments, and executes command
hallettj d6bf2dd
connect arguments to procedure in mutation handler
hallettj 104fbeb
update native query fixture to use arguments
hallettj fa6bedd
convert native query fixtures to json
hallettj e6d12b0
remove error variants that I didn't end up using
hallettj 01fcded
Merge branch 'main' into arguments-for-native-queries
hallettj 33fa050
finish the incomplete tests
hallettj 01b5cee
lint fixes for test code
hallettj 078baf2
Merge branch 'main' into arguments-for-native-queries
hallettj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use mongodb::bson::Bson; | ||
use thiserror::Error; | ||
|
||
use crate::query::arguments::ArgumentError; | ||
|
||
#[derive(Debug, Error)] | ||
pub enum ProcedureError { | ||
#[error("error executing mongodb command: {0}")] | ||
ExecutionError(#[from] mongodb::error::Error), | ||
|
||
#[error("a required argument was not provided, \"{0}\"")] | ||
MissingArgument(String), | ||
|
||
#[error("found a non-string argument, {0}, in a string context - if you want to use a non-string argument it must be the only thing in the string with no white space around the curly braces")] | ||
NonStringInStringContext(String), | ||
|
||
#[error("object keys must be strings, but got: \"{0}\"")] | ||
NonStringKey(Bson), | ||
|
||
#[error("could not resolve arguments: {0}")] | ||
UnresolvableArguments(#[from] ArgumentError), | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Technically this field should be called
parameters
. Is it worth changing?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.
If
parameters
is what we use elsewhere for native queries then it's probably worth changing, given that users will need to write these.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.
ndc-postgres uses the name
arguments
which is what I copied here. It's just that technically they're wrong: parameters are input variables, arguments are the values that bind to parameters. But I can see the argument that consistency is more important than technical correctness.