-
Notifications
You must be signed in to change notification settings - Fork 65
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
Added hash_get macro to allow getting multiple hash fields at once #100
base: master
Are you sure you want to change the base?
Conversation
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.
First of all, very impressive macro-fu!
I think it's a bit too much, though. The API using a macro is not very idiomatic; providing a slice-based API would be more user friendly.
I propose a different way to implement this in #101. That's not a full solution though; you can use parts of the macro implementation here to fill out that one.
I agree that a slice-based API would be vastly better. The main reasons I chose not to go with that are:
We could theoretically solve both by using a function with macro expansion to utilize a single API call for up to a specified number of fields, and then batch the calls for slices longer than that. That means hiding multiple API calls within the function, though, which could result in performance characteristics that would be surprising to callers. |
That's a good point.
Indeed.
I agree, that's overdoing it. Bottom line is that we have two principles that seem to clash:
To resolve this, the best solution would probably be solving this in the Redis modules API. Since this module is intended for a future Redis Enterprise release, that should not be a problem at all. We can simply implement @oranagra's solution and be done with it. Another thing we can do, both with and without the modules API change, is use serde to deserialize directly into a struct instead of using a WDYT? |
No description provided.