-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add support for link properties in derive macro #201
Comments
If you mean "decoding of link properties", they are the same as normal properties, except for a flag. We probably have to make a Rust attribute, that basically asserts on that: #[derive(Queryable)]
struct UserLink {
// asserts link flag on the `relationship` property descriptor is set
#[edgedb(link_property)]
relationship: Relationship,
// asserts link flag is not set (i.e. a normal property by default)
username: String,
} |
That is what I meant, what you proposed is what I was thinking (though I think I would have it as |
Some of the fields in the structure are an actual links. We don't mark those and I think it's fine. Link properties are somewhat special as they appear on objects where they are not defined in the schema (i.e. User object can get
I'm not sure I understand the question. But flag is here: Although, as I'm looking on the code, we don't check the flag anywhere. So you should be able to read link property as a normal property right now without any annotation. Which I consider a bug, but you can abuse it for now. |
As far I can tell there's no way to use link properties in the derive macro currently, instead you need to map from
edged_protocol::Value
into the type you want in order to be able to use a type that contains a link. This is very unergonomic as most if not all the types we've been using thus far have some sort of link property that we want to access in Rust.It would be nice if links were properly supported. I'd be happy to lend some time to help implementing this, but I would need guidance on how the decoding of links should work so I can generate the code in the
decode
implementation.The text was updated successfully, but these errors were encountered: