Skip to content

Commit 2d1b10a

Browse files
committed
Change examples/tests to remove explicit calls to query
1 parent 07d2302 commit 2d1b10a

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

lib/examples/concurrent_writes.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async fn main() {
3535

3636
async fn work(i: u64, graph: Graph) -> (u64, u64, u64) {
3737
graph
38-
.run(query(
38+
.run(
3939
"
4040
CREATE
4141
(dan:Person {name: 'Dan'}),
@@ -77,12 +77,12 @@ CREATE
7777
(elsa)-[:BUYS {amount: 3}]->(chocolate),
7878
(elsa)-[:BUYS {amount: 3}]->(milk)
7979
",
80-
))
80+
)
8181
.await
8282
.unwrap();
8383

8484
let node_count = graph
85-
.execute(query("MATCH (n) RETURN count(n) AS count"))
85+
.execute("MATCH (n) RETURN count(n) AS count")
8686
.await
8787
.unwrap()
8888
.column_into_stream::<u64>("count")
@@ -91,7 +91,7 @@ CREATE
9191
.unwrap();
9292

9393
let rel_count = graph
94-
.execute(query("MATCH ()-[r]->() RETURN count(r) AS count"))
94+
.execute("MATCH ()-[r]->() RETURN count(r) AS count")
9595
.await
9696
.unwrap()
9797
.column_into_stream::<u64>("count")

lib/tests/node_property_parsing.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,25 @@ async fn node_property_parsing() {
99
let graph = neo4j.graph();
1010

1111
graph
12-
.run(query(
12+
.run(
1313
"CREATE
1414
(:Datetime {p1:DATETIME('2024-12-31T08:10:35')}),
1515
(:Point2D {a:Point ({x:2,y:3})}),
1616
(:Point3D {a:Point ({x:3,y:4,z:5})})
1717
",
18-
))
18+
)
1919
.await
2020
.unwrap();
2121

22-
let mut result = graph
23-
.execute(query("MATCH (p:DateTime) RETURN p"))
24-
.await
25-
.unwrap();
22+
let mut result = graph.execute("MATCH (p:DateTime) RETURN p").await.unwrap();
2623

2724
while let Ok(Some(row)) = result.next().await {
2825
let node: Node = row.get("p").unwrap();
2926
let p1 = node.get::<DateTime<FixedOffset>>("p1").unwrap();
3027
assert_eq!(p1.timestamp(), 1735632635);
3128
}
3229

33-
let mut result = graph
34-
.execute(query("MATCH (p:Point2D) RETURN p"))
35-
.await
36-
.unwrap();
30+
let mut result = graph.execute("MATCH (p:Point2D) RETURN p").await.unwrap();
3731

3832
while let Ok(Some(row)) = result.next().await {
3933
let node: Node = row.get("p").unwrap();
@@ -42,10 +36,7 @@ async fn node_property_parsing() {
4236
assert_eq!(p1.y(), 3.0);
4337
}
4438

45-
let mut result = graph
46-
.execute(query("MATCH (p:Point3D) RETURN p"))
47-
.await
48-
.unwrap();
39+
let mut result = graph.execute("MATCH (p:Point3D) RETURN p").await.unwrap();
4940

5041
while let Ok(Some(row)) = result.next().await {
5142
let node: Node = row.get("p").unwrap();

lib/tests/use_default_db.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,11 @@ async fn use_default_db() {
2727

2828
#[cfg(feature = "unstable-bolt-protocol-impl-v2")]
2929
let query_stream = graph
30-
.execute_on("system", query("SHOW DEFAULT DATABASE"), Operation::Read)
30+
.execute_on("system", "SHOW DEFAULT DATABASE", Operation::Read)
3131
.await;
3232

3333
#[cfg(not(feature = "unstable-bolt-protocol-impl-v2"))]
34-
let query_stream = graph
35-
.execute_on("system", query("SHOW DEFAULT DATABASE"))
36-
.await;
34+
let query_stream = graph.execute_on("system", "SHOW DEFAULT DATABASE").await;
3735

3836
let default_db = query_stream
3937
.unwrap()

0 commit comments

Comments
 (0)