Open tausifcreates opened 1 year ago
I'm gonna refer to my comment from the other issue https://github.com/neo4j-labs/neo4rs/issues/108#issuecomment-1741012358
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 I would also like to add something like your example on the other issue as an example/integration test.
@knutwalker Thanks for your response! It surely will solve my pain points.
@tausifcreates we've just released 0.7.0-rc.1
with serde support. It's missing proper documentation, but I can see that maybe something like this works for you
#[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?