-
Notifications
You must be signed in to change notification settings - Fork 59
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
How to cast the row.get()
method result to a custom Struct?
#113
Comments
I'm gonna refer to my comment from the other issue #108 (comment) This will be possible with the serde integration, here is a unit test that deserializes a row into custom structs: https://github.com/knutwalker/neo4rs/blob/9681029210e47f55e2114f1572bfc875749cdfd7/lib/src/row.rs#L299 |
@knutwalker Thanks for your response! It surely will solve my pain points. |
@tausifcreates we've just released #[derive(Debug, serde::Deserialize)]
struct Thing {
some_prop: String,
another_prop: u32,
}
// ...
let things = row.to::<Vec<Thing>>()?;
// or maybe
let things = row.get::<Vec<Things>>("column")?; It would be great if you could give it a try and see if that works for you. |
Hey thanks @knutwalker! Actually I shared the release announcement on reddit |
The docs only shows ways to cast to
Node
,String
etc. What if I return acollect
from the query which holds a list of, say a custom struct type. How do we do that?The text was updated successfully, but these errors were encountered: