-
Notifications
You must be signed in to change notification settings - Fork 160
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
Query support #5
Comments
Yes, querying seems to be the missing piece for my use cases as well. Thanks for a promising project! |
So I've been playing around with nosql-workbench from aws and they have a concept of a "facet". Which is the "The access patterns of the application that will interact with the table." So perhaps in your domain object you can define a "facet" with its own primary and secondary key compositions as well as aliases. That way you're encouraging the end user to think about their access patterns before hand. const item = {
globalSortKeyAlias,
primaryKeyAlias
}
User.query("facetName", item) Perhaps other attribute projection is not part of the MVP What do you think? I really like what you've done and I appreciate the care you've put in to encourage best practices and single table design with dynamo db. Thank you! |
Thanks for the feedback and kind words @sreimer15! The access pattern/facet thing was something I was thinking about in issue #8, but that's an interesting thought to tie the two together. I think there still needs to be a low-level querying capability, but definitely something to think of. |
@jeremydaly what do you think about this syntax for building the query params:
It seems like we could build all the syntax needed with that and it would similar syntax/methods as the get/put functionality in the library already. So a minimal example would look like:
And a more complete example:
|
Added in the v0.2 branch. |
Someone mentioned this to me, but I’m not sure of the correct abstraction level. If the models and types can aid in building queries, then I think this would be useful, but I don’t want to cross into ORM territory.
There are a limited set of
sortKey
operations, so some simple abstraction could work, but the library probably shouldn’t be parsing queries. There would likely need to be a different way to input it, and I don’t think chaining makes sense in this case (e.g..field(‘somevalue‘).gt().value(someValue)
).This needs more feedback.
The text was updated successfully, but these errors were encountered: