Closed
Description
Thanks for the great work on neo4rs! I’ve encountered an issue when executing a query with a std::time::Duration parameter. The result cannot be automatically deserialized into a BoltDuration as expected. Instead, it returns a BoltList. This causes an issue where the Duration cannot be properly deserialized into the desired type.
It would be helpful if the library could support automatic deserialization of std::time::Duration into BoltDuration, or if there’s an alternative approach to handle this correctly.
code:
use neo4rs::*;
#[tokio::main]
async fn main() {
let uri = "127.0.0.1:7687";
let user = "neo4j";
let pass = "neo";
let graph = Graph::new(uri, user, pass).await.unwrap();
let duration = std::time::Duration::new(5259600, 7);
let mut result = graph
.execute(query("RETURN $d as output").param("d", duration))
.await
.unwrap();
let row = result.next().await.unwrap().unwrap();
let d: std::time::Duration = row.get("output").unwrap();
println!("{:?}", d);
let mut result = graph
.execute(query("RETURN $d as output").param("d", duration))
.await
.unwrap();
let row = result.next().await.unwrap().unwrap();
let d= row.get::<BoltType>("output").unwrap();
println!("{:?}", d);
}
output:
5259600.000000007s
List(BoltList { value: [Integer(BoltInteger { value: 5259600 }), Integer(BoltInteger { value: 7 })] })
Metadata
Metadata
Assignees
Labels
No labels