Skip to content

Commit

Permalink
update examples, test, clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jifalops committed Aug 20, 2023
1 parent 271378d commit 23ae6dc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
14 changes: 8 additions & 6 deletions example/src/person.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use cypher_dto::{node, relation, stamps};
use cypher_dto::{timestamps, Node, Relation};

/// Single ID field and optional timestamps. Has example of `new()` and `into_builder()` methods.
#[node(stamps, name = "Person2")]
#[timestamps]
#[derive(Node, Clone)]
#[name = "Person2"]
pub struct Person {
id: String,
#[name = "name2"]
Expand All @@ -11,12 +13,12 @@ pub struct Person {
colors: Vec<String>,
}

#[relation]
#[derive(Relation)]
struct Knows;

#[cfg(test)]
mod tests {
use cypher_dto::{NodeEntity, RelationBound};
use cypher_dto::{Entity, NodeEntity, RelationBound, RelationEntity};

use super::*;

Expand All @@ -34,17 +36,17 @@ mod tests {
&["red".to_owned(), "blue".to_owned()],
);
assert_eq!(p.id(), "id");
let p = p.into_builder().name("name2").build().unwrap();
let p = p.into_builder().name("name2").build();
assert_eq!(p.name(), "name2");
assert_eq!(p.colors(), &["red", "blue"]);
assert_eq!(p.age(), Some(42));
let now = chrono::Utc::now();

assert_eq!(
p.clone()
.into_builder()
.created_at(Some(now))
.build()
.unwrap()
.created_at(),
Some(&now),
);
Expand Down
2 changes: 1 addition & 1 deletion example/src/worked_at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct WorkedAt {
#[cfg(test)]
mod tests {
use super::*;
use cypher_dto::{QueryFields, StampMode};
use cypher_dto::{Entity, StampMode};

#[test]
fn rename() {
Expand Down
2 changes: 1 addition & 1 deletion example/tests/basic_crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn basic_crud() {
assert_eq!(alice.identifier(), alice_id);

// Update Alice's name
let alice = alice.into_builder().name("Allison").build().unwrap();
let alice = alice.into_builder().name("Allison").build();
graph.run(alice.update()).await.unwrap();

let mut stream = graph.execute(alice_id.read()).await.unwrap();
Expand Down
3 changes: 0 additions & 3 deletions macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,5 @@ mod tests {
assert_eq!(parse_name_meta(&attr.meta), Some("Foo".to_owned()));
let attr: Attribute = parse_quote!(#[name = "Foo"]);
assert_eq!(parse_name_meta(&attr.meta), Some("Foo".to_owned()));
let args = quote!(#[foo(name = "Foo", stamps = "full")]);
let meta: Meta = syn::parse2(args).unwrap();
assert_eq!(parse_name_meta(&meta), Some("Foo".to_owned()));
}
}
2 changes: 1 addition & 1 deletion macros/src/derive/entity/field/field_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl ArgHelper {
field_into_getter_suffix,
}
} else {
let is_copy = is_copy_type(&ty);
let is_copy = is_copy_type(ty);
Self {
arg_type: ty.clone(),
arg_into_field_suffix: quote!(),
Expand Down

0 comments on commit 23ae6dc

Please sign in to comment.