Skip to content
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

Associated const attribute names #106

Open
softprops opened this issue Jun 23, 2020 · 6 comments
Open

Associated const attribute names #106

softprops opened this issue Jun 23, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@softprops
Copy link
Owner

💡 Feature description

When composing queries you refer to items attribute names. A derived item has access to these names. To make queries less error prone, let's define associated constants for each attribute name

💻 Basic example

@softprops softprops added the enhancement New feature or request label Jun 28, 2020
@softprops
Copy link
Owner Author

Tbs assuming these would be associated consts what would the name casing be. The same as struct fields or transformed LikeThis. Also is it too naive to leave these as static strs. Should these have a type which expose other data? What would that data be?

@rimutaka
Copy link

Name casing - not that critical, as long as there are no warnings. Can you give an example of what that query code may look like?

@softprops
Copy link
Owner Author

Basically anywhere you'd type out the name of a field already declared in Item type struct as a str I'd like to remove human error and give ide's the declared name instead. It fields weird to type these out as strings knowing the values are known.

It seems conventional to follow these guidelines https://rust-lang.github.io/api-guidelines/naming.html of these are associated consts so that may be best.

What's also potentially useful is when the value does not align with the actual field. Let say you have an item field customer_id in rust but renamed to CustomerID in ddb. You have a 50 50 chance you'll get it right even if you type correctly.

Naming aside, I'm wondering this should be a type va str value. The concern which I don't want to weigh too heavily is at some future date I have an aha moment and want to store more information than the field name in these values.

I'm happy to iterate but the primary goal is remove human err and make ide auto complete dx nice. Everything else at this point is not well defined so it's secondary

@softprops
Copy link
Owner Author

Also don't want this to feel to heavy. I don't want this to feel like an orm but more of a static type mapping over existing interfaces

@rimutaka
Copy link

I'm happy to give this a try some time next week, if you are not in a hurry with this feature. That will be me learning how to make / fix proc macros. :)

Is there anything else non-macro-related that needs fixing in dynomite or lambda-runtime? I looked through the issues, but nothing seems important enough, other than making more examples and maybe improving the docs.

@softprops
Copy link
Owner Author

I'm happy to give this a try some time next week, if you are not in a hurry with this feature.

Go for it. Mentioned about were the handful of factors to consider

Is there anything else non-macro-related that needs fixing in dynomite or lambda-runtime?

I'll see if I can put together more getting started issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants