File tree Expand file tree Collapse file tree 3 files changed +25
-20
lines changed Expand file tree Collapse file tree 3 files changed +25
-20
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ async fn missing_properties() {
10
10
11
11
let a_val = None :: < String > ;
12
12
let mut result = graph
13
- . execute ( query ( "CREATE (ts:TestStruct {a: $a}) RETURN ts" ) . param ( "a" , a_val) )
13
+ . execute ( query ! (
14
+ "CREATE (ts:TestStruct {{a: {a}}}) RETURN ts" ,
15
+ a = a_val
16
+ ) )
14
17
. await
15
18
. unwrap ( ) ;
16
19
let row = result. next ( ) . await . unwrap ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change 1
1
use futures:: TryStreamExt ;
2
- use neo4rs:: * ;
2
+ use neo4rs:: query ;
3
3
use serde:: Deserialize ;
4
4
5
5
mod container;
@@ -19,7 +19,7 @@ async fn txn_changes_db() {
19
19
return ;
20
20
}
21
21
22
- std:: panic:: panic_any ( e) ;
22
+ std:: panic:: panic_any ( e. to_string ( ) ) ;
23
23
}
24
24
} ;
25
25
let graph = neo4j. graph ( ) ;
@@ -46,18 +46,13 @@ async fn txn_changes_db() {
46
46
47
47
let mut txn = graph. start_txn ( ) . await . unwrap ( ) ;
48
48
let mut databases = txn
49
- . execute (
50
- query ( & format ! (
51
- concat!(
52
- "SHOW TRANSACTIONS YIELD * WHERE username = $username AND currentQuery " ,
53
- "STARTS WITH $query AND toLower({status_field}) = $status RETURN database"
54
- ) ,
55
- status_field = status_field
56
- ) )
57
- . param ( "username" , "neo4j" )
58
- . param ( "query" , "SHOW TRANSACTIONS YIELD " )
59
- . param ( "status" , "running" ) ,
60
- )
49
+ . execute ( dbg ! ( query!(
50
+ "SHOW TRANSACTIONS YIELD * WHERE username = {username} AND currentQuery
51
+ STARTS WITH {query} AND toLower({status_field}) = {status} RETURN database" ,
52
+ username = "neo4j" ,
53
+ query = "SHOW TRANSACTIONS YIELD " ,
54
+ status = "running" ,
55
+ ) ) )
61
56
. await
62
57
. unwrap ( ) ;
63
58
Original file line number Diff line number Diff line change @@ -54,16 +54,21 @@ async fn use_default_db() {
54
54
55
55
let id = uuid:: Uuid :: new_v4 ( ) ;
56
56
graph
57
- . run ( query ( "CREATE (:Node { uuid: $uuid })" ) . param ( "uuid" , id. to_string ( ) ) )
57
+ . run ( query ! (
58
+ "CREATE (:Node {{ uuid: {uuid} }})" ,
59
+ uuid = id. to_string( )
60
+ ) )
58
61
. await
59
62
. unwrap ( ) ;
60
63
61
64
#[ cfg( feature = "unstable-bolt-protocol-impl-v2" ) ]
62
65
let query_stream = graph
63
66
. execute_on (
64
67
dbname. as_str ( ) ,
65
- query ( "MATCH (n:Node {uuid: $uuid}) RETURN count(n) AS result" )
66
- . param ( "uuid" , id. to_string ( ) ) ,
68
+ query ! (
69
+ "MATCH (n:Node {{uuid: {uuid}}}) RETURN count(n) AS result" ,
70
+ uuid = id. to_string( )
71
+ ) ,
67
72
Operation :: Read ,
68
73
)
69
74
. await ;
@@ -72,8 +77,10 @@ async fn use_default_db() {
72
77
let query_stream = graph
73
78
. execute_on (
74
79
dbname. as_str ( ) ,
75
- query ( "MATCH (n:Node {uuid: $uuid}) RETURN count(n) AS result" )
76
- . param ( "uuid" , id. to_string ( ) ) ,
80
+ query ! (
81
+ "MATCH (n:Node {{uuid: {uuid}}}) RETURN count(n) AS result" ,
82
+ uuid = id. to_string( )
83
+ ) ,
77
84
)
78
85
. await ;
79
86
You can’t perform that action at this time.
0 commit comments