Skip to content

Commit

Permalink
run ./fix.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jifalops committed Feb 29, 2024
1 parent 7306862 commit 2b3f99b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT"
keywords = ["neo4j", "cypher", "dto", "query", "graph"]
categories = ["database"]
repository = "https://github.com/jifalops/cypher-dto"
metadata.msrv = "1.60"
metadata = { msrv = "1.60" }

[features]
default = ["macros"]
Expand Down
32 changes: 16 additions & 16 deletions lib/src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ pub(crate) mod tests {
Ok(Self {
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
age: u8::try_from(
value
.get::<i64>("age")
.map_err(|e| Error::MissingField("age".to_owned()))?,
.map_err(|_e| Error::MissingField("age".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("age".to_owned()))?,
})
Expand Down Expand Up @@ -535,79 +535,79 @@ pub(crate) mod tests {
usize_num: usize::try_from(
value
.get::<i64>("usize_num")
.map_err(|e| Error::MissingField("usize_num".to_owned()))?,
.map_err(|_e| Error::MissingField("usize_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("usize_num".to_owned()))?,
isize_num: isize::try_from(
value
.get::<i64>("isize_num")
.map_err(|e| Error::MissingField("isize_num".to_owned()))?,
.map_err(|_e| Error::MissingField("isize_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("isize_num".to_owned()))?,
u8_num: u8::try_from(
value
.get::<i64>("u8_num")
.map_err(|e| Error::MissingField("u8_num".to_owned()))?,
.map_err(|_e| Error::MissingField("u8_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("u8_num".to_owned()))?,
u16_num: u16::try_from(
value
.get::<i64>("u16_num")
.map_err(|e| Error::MissingField("u16_num".to_owned()))?,
.map_err(|_e| Error::MissingField("u16_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("u16_num".to_owned()))?,
u32_num: u32::try_from(
value
.get::<i64>("u32_num")
.map_err(|e| Error::MissingField("u32_num".to_owned()))?,
.map_err(|_e| Error::MissingField("u32_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("u32_num".to_owned()))?,
u64_num: u64::try_from(
value
.get::<i64>("u64_num")
.map_err(|e| Error::MissingField("u64_num".to_owned()))?,
.map_err(|_e| Error::MissingField("u64_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("u64_num".to_owned()))?,
u128_num: u128::try_from(
value
.get::<i64>("u128_num")
.map_err(|e| Error::MissingField("u128_num".to_owned()))?,
.map_err(|_e| Error::MissingField("u128_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("u128_num".to_owned()))?,
i8_num: i8::try_from(
value
.get::<i64>("i8_num")
.map_err(|e| Error::MissingField("i8_num".to_owned()))?,
.map_err(|_e| Error::MissingField("i8_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("i8_num".to_owned()))?,
i16_num: i16::try_from(
value
.get::<i64>("i16_num")
.map_err(|e| Error::MissingField("i16_num".to_owned()))?,
.map_err(|_e| Error::MissingField("i16_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("i16_num".to_owned()))?,
i32_num: i32::try_from(
value
.get::<i64>("i32_num")
.map_err(|e| Error::MissingField("i32_num".to_owned()))?,
.map_err(|_e| Error::MissingField("i32_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("i32_num".to_owned()))?,
i64_num: value
.get("i64_num")
.map_err(|e| Error::MissingField("i64_num".to_owned()))?,
.map_err(|_e| Error::MissingField("i64_num".to_owned()))?,
i128_num: i128::try_from(
value
.get::<i64>("i128_num")
.map_err(|e| Error::MissingField("i128_num".to_owned()))?,
.map_err(|_e| Error::MissingField("i128_num".to_owned()))?,
)
.map_err(|_| Error::TypeMismatch("i128_num".to_owned()))?,
f32_num: value
.get::<f64>("f32_num")
.map_err(|e| Error::MissingField("f32_num".to_owned()))?
.map_err(|_e| Error::MissingField("f32_num".to_owned()))?
as f32,
f64_num: value
.get("f64_num")
.map_err(|e| Error::MissingField("f64_num".to_owned()))?,
.map_err(|_e| Error::MissingField("f64_num".to_owned()))?,

usize_opt: match value.get::<i64>("usize_opt") {
Ok(v) => Some(
Expand Down
8 changes: 4 additions & 4 deletions lib/src/stamps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ impl<'a> Neo4jMap<'a> {
Neo4jMap::Row(value) => value
.get::<DateTime<FixedOffset>>(name)
.map(|dt| dt.into())
.map_err(|e| crate::Error::MissingField(name.to_owned())),
.map_err(|_e| crate::Error::MissingField(name.to_owned())),
Neo4jMap::Node(value) => value
.get::<DateTime<FixedOffset>>(name)
.map(|dt| dt.into())
.map_err(|e| crate::Error::MissingField(name.to_owned())),
.map_err(|_e| crate::Error::MissingField(name.to_owned())),
Neo4jMap::Relation(value) => value
.get::<DateTime<FixedOffset>>(name)
.map(|dt| dt.into())
.map_err(|e| crate::Error::MissingField(name.to_owned())),
.map_err(|_e| crate::Error::MissingField(name.to_owned())),
Neo4jMap::UnboundedRelation(value) => value
.get::<DateTime<FixedOffset>>(name)
.map(|dt| dt.into())
.map_err(|e| crate::Error::MissingField(name.to_owned())),
.map_err(|_e| crate::Error::MissingField(name.to_owned())),
}
}
}
16 changes: 8 additions & 8 deletions lib/tests/common/fixtures/company.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ impl TryFrom<Row> for Company {
Ok(Self {
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
state: value
.get("state")
.map_err(|e| Error::MissingField("state".to_owned()))?,
.map_err(|_e| Error::MissingField("state".to_owned()))?,
created: map.get_timestamp("created")?,
updated: map.get_timestamp("updated")?,
})
Expand All @@ -80,10 +80,10 @@ impl TryFrom<Node> for Company {
Ok(Self {
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
state: value
.get("state")
.map_err(|e| Error::MissingField("state".to_owned()))?,
.map_err(|_e| Error::MissingField("state".to_owned()))?,
created: map.get_timestamp("created")?,
updated: map.get_timestamp("updated")?,
})
Expand Down Expand Up @@ -115,10 +115,10 @@ impl TryFrom<Node> for CompanyId {
Ok(Self {
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
state: value
.get("state")
.map_err(|e| Error::MissingField("state".to_owned()))?,
.map_err(|_e| Error::MissingField("state".to_owned()))?,
})
}
}
Expand Down Expand Up @@ -148,10 +148,10 @@ impl TryFrom<Row> for CompanyId {
Ok(Self {
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
state: value
.get("state")
.map_err(|e| Error::MissingField("state".to_owned()))?,
.map_err(|_e| Error::MissingField("state".to_owned()))?,
})
}
}
12 changes: 6 additions & 6 deletions lib/tests/common/fixtures/person.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ impl TryFrom<Row> for Person {
Ok(Self {
id: value
.get("id")
.map_err(|e| Error::MissingField("id".to_owned()))?,
.map_err(|_e| Error::MissingField("id".to_owned()))?,
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
age: match value.get::<i64>("age") {
Ok(age) => Some(
age.try_into()
Expand Down Expand Up @@ -115,10 +115,10 @@ impl TryFrom<Node> for Person {
Ok(Self {
id: value
.get("id")
.map_err(|e| Error::MissingField("id".to_owned()))?,
.map_err(|_e| Error::MissingField("id".to_owned()))?,
name: value
.get("name")
.map_err(|e| Error::MissingField("name".to_owned()))?,
.map_err(|_e| Error::MissingField("name".to_owned()))?,
age: match value.get::<i64>("age") {
Ok(age) => Some(
age.try_into()
Expand Down Expand Up @@ -153,7 +153,7 @@ impl TryFrom<Node> for PersonId {
Ok(Self {
id: value
.get("id")
.map_err(|e| Error::MissingField("id".to_owned()))?,
.map_err(|_e| Error::MissingField("id".to_owned()))?,
})
}
}
Expand Down Expand Up @@ -181,7 +181,7 @@ impl TryFrom<Row> for PersonId {
Ok(Self {
id: value
.get("id")
.map_err(|e| Error::MissingField("id".to_owned()))?,
.map_err(|_e| Error::MissingField("id".to_owned()))?,
})
}
}
Expand Down

0 comments on commit 2b3f99b

Please sign in to comment.