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

Macros for entity/object conversion #986

Open
1 of 2 tasks
shaobo-he-aws opened this issue Jun 14, 2024 · 0 comments
Open
1 of 2 tasks

Macros for entity/object conversion #986

shaobo-he-aws opened this issue Jun 14, 2024 · 0 comments
Labels
feature-request This issue requets a substantial new feature requires-RFC This issue requests a substanial change to the Cedar langauge which needs to follow the RFC process

Comments

@shaobo-he-aws
Copy link
Contributor

Category

User level API features/changes

Describe the feature you'd like to request

Derive macros on Rust structs that generate methods to convert them to/from entities. This is akin to ORM. For instance,

#[derive(Cedar)]
struct Team {
  #[eid]
  id: String,
  members: HashSet<Member>
}
#[derive(Cedar)]
struct Member {
  #[eid]
  id: String,
  location: String,
}

Team { id: "t0", member: [Member {id: "m0", location: "USA"}, Member {id: "m1", location: "CAN"}]} gets converted to entities {Team::"t0": { "member": [Member::"m0", Member::"m1"]}, Member::"m0": {...}, Member::"m1": {...}.

Describe alternatives you've considered

N/A

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@shaobo-he-aws shaobo-he-aws added pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. feature-request This issue requets a substantial new feature requires-RFC This issue requests a substanial change to the Cedar langauge which needs to follow the RFC process and removed pending-triage The cedar maintainers haven't looked at this yet. Automicaly added to all new issues. labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request This issue requets a substantial new feature requires-RFC This issue requests a substanial change to the Cedar langauge which needs to follow the RFC process
Projects
None yet
Development

No branches or pull requests

1 participant