-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
In a table which has both partition key and sort key, rustc doesn't raise errors if I forget to call sort_key(...)
method to pass sort key.
Describe the solution you'd like
raiden-derive
could generate more precise signatures like fn get(&mut self, key: (K, K)) where K: IntoAttribute + Send
instead of fn get(&mut self, key: impl IntoAttribute + Send)
base on given definition of the struct.
Want to discuss
- Strict type check of key
- e.g.
client.get(2020)
yields compile errors => Strict type checking of keys #47
- e.g.
Abstract Key
In batch_get
op, there are lots of conditional code generations like below.
I want to reduce repeat by defining an abstract type for keys. This means that the type consists of impl IntoAttribute
and (impl IntoAttribute, impl IntoAttribute)
. If I define the abstract type using enum, it looks like below.
enum Key {
Pk(impl IntoAttribute),
PkSk((impl IntoAttribute, impl IntoAttribute)),
}
However, this is annoying in its representation.
let keys = vec![("aaa", 2019), ("bbb", 2020), ("ccc", 2021)]; // looks naturally
let keys = vec![PkSk("aaa", 2019), PkSk("bbb", 2020), PkSk("ccc", 2021)]; // umm....
So finally, I stopped this approach.
bokuweb
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request