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

[authz-macros] accept an optional input_key argument #4707

Conversation

sunshowers
Copy link
Contributor

In some cases including composite keys, it can be better to make the outside
representation of the primary key some kind of struct, rather than passing
around tuples of various types.

Enable that in the authz_resource macro by allowing users to specify an
optional input_key argument, which represents a better view into the primary
key.

I'm not entirely sure that the From trait is the right thing to use here, but
it seems like a pretty low-cost decision to change in the future.

As part of this PR I also switched to the prettyplease crate, which as the
README explains is more suitable for generated code than rustfmt:
https://crates.io/crates/prettyplease

@sunshowers sunshowers changed the base branch from sunshowers/spr/main.authz-macros-accept-an-optional-input_key-argument to main December 15, 2023 22:13
Created using spr 1.3.5
Created using spr 1.3.5
@sunshowers sunshowers requested a review from smklein December 15, 2023 22:16
Copy link
Collaborator

@smklein smklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thanks for the additional doc comment!

Created using spr 1.3.5
@sunshowers sunshowers merged commit b19c61a into main Dec 21, 2023
22 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/authz-macros-accept-an-optional-input_key-argument branch December 21, 2023 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants