jifalops / cypher-dto Goto Github PK
View Code? Open in Web Editor NEWA library and macros for working with data transfer objects in Rust and Neo4j.
License: MIT License
A library and macros for working with data transfer objects in Rust and Neo4j.
License: MIT License
timestamp tests require a git dependency
I believe the README in cypher-dto/lib
is slightly off. For add_values_to_params
it has only one argument specified, but it seems there should be three?
fn add_values_to_params(&self, query: Query, prefix: Option<&str>, mode: StampMode) -> Query;
Hi,
Is this crate still active?
I've tried it on a complex struct with multiple enums and nested structs and got 99 errors so I want to know if there is a chance of a fix when I post the bug?
Mentioned in #17. It's usually some combo of use cypher_dto::{Node, Relation, timestamps};
, but the intro docs shouldn't skip it.
Documentation needs updated. The shorthand, which is a little hacky, could be a feature.
Hello I do not know how to address the following issue since I am new to Rust and this crate;
graph.run(rel.create (RelationBound::Match(&alice),RelationBound::Match(&bob))).await.unwrap();
is complaining that theration bound type is not known at the time
Please note that thr code bellow works as expected
graph.run(rel.create (RelationBound::Create(&alice),RelationBound::Create(&bob))).await.unwrap();
what I am trying to do is create a relation to existing Nodes not create them again
Hey! Appreciate the package and think it's a cool idea. Running into a bug trying to use it thought. Apologies for the text blobs, but was hoping to get your thoughts.
...
neo4rs = "0.7"
...
[workspace.dependencies.cypher-dto]
git="https://github.com/jifalops/cypher-dto"
rev="363a6f5"
features = [
"serde",
]
serde.workspace = true
neo4rs.workspace = true
use clap::Parser;
use serde::{Deserialize, Serialize};
use cypher_dto::Node;
#[derive(Serialize, Deserialize, Parser, Node)]
pub struct UserNode {
id: String,
email: String,
password_hash: String,
}
error[E0277]: the trait bound `UserNode: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNode`
|
= help: the trait `From<UserNodeBuilder>` is implemented for `UserNode`
= help: for that trait implementation, expected `UserNodeBuilder`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNode>`
= note: required for `UserNode` to implement `TryFrom<neo4rs::row::Row>`
note: required by a bound in `FieldSet`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/entity.rs:7:21
|
7 | pub trait FieldSet: TryFrom<Row> {
| ^^^^^^^^^^^^ required by this bound in `FieldSet`
error[E0277]: the trait bound `UserNode: From<neo4rs::row::Node>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Node>` is not implemented for `UserNode`
|
= help: the trait `From<UserNodeBuilder>` is implemented for `UserNode`
= help: for that trait implementation, expected `UserNodeBuilder`, found `neo4rs::row::Node`
= note: required for `neo4rs::row::Node` to implement `Into<UserNode>`
= note: required for `UserNode` to implement `TryFrom<neo4rs::row::Node>`
note: required by a bound in `NodeEntity`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:5:34
|
5 | pub trait NodeEntity: FieldSet + TryFrom<Node> {
| ^^^^^^^^^^^^^ required by this bound in `NodeEntity`
error[E0277]: the trait bound `UserNode: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNode`
|
= help: the trait `From<UserNodeBuilder>` is implemented for `UserNode`
= help: for that trait implementation, expected `UserNodeBuilder`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNode>`
= note: required for `UserNode` to implement `TryFrom<neo4rs::row::Row>`
= note: required for `UserNode` to implement `FieldSet`
note: required by a bound in `NodeEntity`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:5:23
|
5 | pub trait NodeEntity: FieldSet + TryFrom<Node> {
| ^^^^^^^^ required by this bound in `NodeEntity`
error[E0277]: the trait bound `UserNodeId: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNodeId`
|
= help: the trait `From<UserNode>` is implemented for `UserNodeId`
= help: for that trait implementation, expected `UserNode`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNodeId>`
= note: required for `UserNodeId` to implement `TryFrom<neo4rs::row::Row>`
note: required by a bound in `FieldSet`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/entity.rs:7:21
|
7 | pub trait FieldSet: TryFrom<Row> {
| ^^^^^^^^^^^^ required by this bound in `FieldSet`
error[E0277]: the trait bound `UserNodeId: From<neo4rs::row::Node>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Node>` is not implemented for `UserNodeId`
|
= help: the trait `From<UserNode>` is implemented for `UserNodeId`
= help: for that trait implementation, expected `UserNode`, found `neo4rs::row::Node`
= note: required for `neo4rs::row::Node` to implement `Into<UserNodeId>`
= note: required for `UserNodeId` to implement `TryFrom<neo4rs::row::Node>`
note: required by a bound in `NodeId`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:44:46
|
44 | pub trait NodeId: FieldSet + From<Self::T> + TryFrom<Node> {
| ^^^^^^^^^^^^^ required by this bound in `NodeId`
error[E0277]: the trait bound `UserNodeId: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNodeId`
|
= help: the trait `From<UserNode>` is implemented for `UserNodeId`
= help: for that trait implementation, expected `UserNode`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNodeId>`
= note: required for `UserNodeId` to implement `TryFrom<neo4rs::row::Row>`
= note: required for `UserNodeId` to implement `FieldSet`
note: required by a bound in `NodeId`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:44:19
|
44 | pub trait NodeId: FieldSet + From<Self::T> + TryFrom<Node> {
| ^^^^^^^^ required by this bound in `NodeId`
error[E0277]: the trait bound `BoltType: From<UserNode>` is not satisfied
--> db/src/fns/general.rs:9:66
|
9 | .run(query("CREATE (n:User {props})").param("props", node))
| ----- ^^^^ the trait `From<UserNode>` is not implemented for `BoltType`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<BoltType as From<bool>>
<BoltType as From<i8>>
<BoltType as From<i16>>
<BoltType as From<i32>>
<BoltType as From<i64>>
<BoltType as From<u16>>
<BoltType as From<u32>>
<BoltType as From<f32>>
and 19 others
= note: required for `UserNode` to implement `Into<BoltType>`
note: required by a bound in `Query::param`
--> /home/dev/.cargo/registry/src/index.crates.io-6f17d22bba15001f/neo4rs-0.7.1/src/query.rs:24:21
|
24 | pub fn param<T: Into<BoltType>>(mut self, key: &str, value: T) -> Self {
| ^^^^^^^^^^^^^^ required by this bound in `Query::param`
warning: unreachable expression
--> db/src/fns/general.rs:12:9
|
11 | todo!();
| ------- any code following this expression is unreachable
12 | Ok(())
| ^^^^^^ unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default
error[E0053]: method `add_values_to_params` has an incompatible type for trait
--> db/src/node/user.rs:5:42
|
5 | #[derive(Serialize, Deserialize, Parser, Node)]
| ^^^^
| |
| expected `neo4rs::query::Query`, found `Query`
| help: change the parameter type to match the trait: `neo4rs::query::Query`
|
= note: expected signature `fn(&UserNode, neo4rs::query::Query, std::option::Option<&str>, StampMode) -> neo4rs::query::Query`
found signature `fn(&UserNode, Query, std::option::Option<&str>, StampMode) -> Query`
= note: this error originates in the derive macro `Node` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `UserNodeId: From<neo4rs::row::Node>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Node>` is not implemented for `UserNodeId`
|
= help: the trait `From<UserNode>` is implemented for `UserNodeId`
= help: for that trait implementation, expected `UserNode`, found `neo4rs::row::Node`
= note: required for `neo4rs::row::Node` to implement `Into<UserNodeId>`
= note: required for `UserNodeId` to implement `TryFrom<neo4rs::row::Node>`
= note: required for `<UserNode as NodeEntity>::Id` to implement `NodeId`
note: required by a bound in `cypher_dto::NodeEntity::Id`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:6:14
|
6 | type Id: NodeId<T = Self>;
| ^^^^^^^^^^^^^^^^ required by this bound in `NodeEntity::Id`
error[E0277]: the trait bound `UserNodeId: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNodeId`
|
= help: the trait `From<UserNode>` is implemented for `UserNodeId`
= help: for that trait implementation, expected `UserNode`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNodeId>`
= note: required for `UserNodeId` to implement `TryFrom<neo4rs::row::Row>`
= note: required for `<UserNode as NodeEntity>::Id` to implement `FieldSet`
= note: required for `<UserNode as NodeEntity>::Id` to implement `NodeId`
note: required by a bound in `cypher_dto::NodeEntity::Id`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:6:14
|
6 | type Id: NodeId<T = Self>;
| ^^^^^^^^^^^^^^^^ required by this bound in `NodeEntity::Id`
error[E0053]: method `add_values_to_params` has an incompatible type for trait
--> db/src/node/user.rs:5:42
|
5 | #[derive(Serialize, Deserialize, Parser, Node)]
| ^^^^
| |
| expected `neo4rs::query::Query`, found `Query`
| help: change the parameter type to match the trait: `neo4rs::query::Query`
|
= note: expected signature `fn(&UserNodeId, neo4rs::query::Query, std::option::Option<&str>, StampMode) -> neo4rs::query::Query`
found signature `fn(&UserNodeId, Query, std::option::Option<&str>, StampMode) -> Query`
= note: this error originates in the derive macro `Node` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `UserNode: From<neo4rs::row::Node>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Node>` is not implemented for `UserNode`
|
= help: the trait `From<UserNodeBuilder>` is implemented for `UserNode`
= help: for that trait implementation, expected `UserNodeBuilder`, found `neo4rs::row::Node`
= note: required for `neo4rs::row::Node` to implement `Into<UserNode>`
= note: required for `UserNode` to implement `TryFrom<neo4rs::row::Node>`
= note: required for `<UserNodeId as NodeId>::T` to implement `NodeEntity`
note: required by a bound in `cypher_dto::NodeId::T`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:45:13
|
45 | type T: NodeEntity<Id = Self>;
| ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `NodeId::T`
error[E0277]: the trait bound `UserNode: From<neo4rs::row::Row>` is not satisfied
--> db/src/node/user.rs:6:12
|
6 | pub struct UserNode {
| ^^^^^^^^ the trait `From<neo4rs::row::Row>` is not implemented for `UserNode`
|
= help: the trait `From<UserNodeBuilder>` is implemented for `UserNode`
= help: for that trait implementation, expected `UserNodeBuilder`, found `neo4rs::row::Row`
= note: required for `neo4rs::row::Row` to implement `Into<UserNode>`
= note: required for `UserNode` to implement `TryFrom<neo4rs::row::Row>`
= note: required for `<UserNodeId as NodeId>::T` to implement `FieldSet`
= note: required for `<UserNodeId as NodeId>::T` to implement `NodeEntity`
note: required by a bound in `cypher_dto::NodeId::T`
--> /home/dev/.cargo/git/checkouts/cypher-dto-af39dccb3f80121a/363a6f5/lib/src/node.rs:45:13
|
45 | type T: NodeEntity<Id = Self>;
| ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `NodeId::T`
Some errors have detailed explanations: E0053, E0277.
For more information about an error, try `rustc --explain E0053`.
warning: `db` (lib) generated 6 warnings
error: could not compile `db` (lib) due to 13 previous errors; 6 warnings emitted
dev@dingus:~/src/prospero/rust/db$ cargo clean
some tests require a git dependency. May want to split build and test for now, even though it has to build to publish on crates.io
numbers are handled, but bool and char are not. Likely others.
Is it currently possible to have multiple labels in a derived struct? Something like
#[derive(Debug, Clone, Deserialize, Serialize, Node, ToSchema)]
#[names("Person", "Investor")]
pub struct Person {
#[id]
pub name: String,
pub description: String,
}
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.