1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
//! Neo4j driver compatible with neo4j 4.x versions
//!
//! * An implementation of the [bolt protocol][bolt] to interact with Neo4j server
//! * async/await apis using [tokio][tokio]
//! * Supports bolt 4.2 specification
//! * tested with Neo4j versions: 4.0, 4.1, 4.2
//!
//!
//! [bolt]: https://7687.org/
//! [tokio]: https://github.com/tokio-rs/tokio
//!
//!
//! # Examples
//!
//! ```no_run
//! use neo4rs::*;
//! use std::sync::Arc;
//! use std::sync::atomic::{AtomicU32, Ordering};
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let id = Uuid::new_v4().to_string();
//!
//!    let graph = Arc::new(Graph::new(uri, user, pass).await.unwrap());
//!    let mut result = graph.run(
//!      query("CREATE (p:Person {id: $id})").param("id", id.clone())
//!    ).await.unwrap();
//!
//!    let mut handles = Vec::new();
//!    let mut count = Arc::new(AtomicU32::new(0));
//!    for _ in 1..=42 {
//!        let graph = graph.clone();
//!        let id = id.clone();
//!        let count = count.clone();
//!        let handle = tokio::spawn(async move {
//!            let mut result = graph.execute(
//!              query("MATCH (p:Person {id: $id}) RETURN p").param("id", id)
//!            ).await.unwrap();
//!            while let Ok(Some(row)) = result.next().await {
//!                count.fetch_add(1, Ordering::Relaxed);
//!            }
//!        });
//!        handles.push(handle);
//!    }
//!
//!    futures::future::join_all(handles).await;
//!    assert_eq!(count.load(Ordering::Relaxed), 42);
//! }
//! ```
//!
//! ## Configurations
//!
//! Use the config builder to override the default configurations like
//! * `fetch_size` - number of rows to fetch in batches (default is 200)
//! * `max_connections` - maximum size of the connection pool (default is 16)
//! * `db` - the database to connect to (default is `neo4j`)
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//!
//! #[tokio::main]
//! async fn main() {
//!    let config = ConfigBuilder::default()
//!        .uri("127.0.0.1:7687")
//!        .user("neo4j")
//!        .password("neo")
//!        .db("neo4j")
//!        .fetch_size(500)
//!        .max_connections(10)
//!        .build()
//!        .unwrap();
//!    let graph = Graph::connect(config).await.unwrap();
//!    let mut result = graph.execute(query("RETURN 1")).await.unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let value: i64 = row.get("1").unwrap();
//!    assert_eq!(1, value);
//!    assert!(result.next().await.unwrap().is_none());
//! }
//! ```
//!
//! ## Nodes
//! A simple example to create a node and consume the created node from the row stream.
//!
//! * [`Graph::run`] just returns [`errors::Result`]`<()>`, usually used for write only queries.
//! * [`Graph::execute`] returns [`errors::Result`]`<`[`RowStream`]`>`
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    assert!(graph.run(query("RETURN 1")).await.is_ok());
//!
//!    let mut result = graph.execute(
//!      query( "CREATE (friend:Person {name: $name}) RETURN friend")
//!     .param("name", "Mr Mark")
//!    ).await.unwrap();
//!
//!    while let Ok(Some(row)) = result.next().await {
//!         let node: Node = row.get("friend").unwrap();
//!         let id = node.id();
//!         let labels = node.labels();
//!         let name: String = node.get("name").unwrap();
//!         assert_eq!(name, "Mr Mark");
//!         assert_eq!(labels, vec!["Person"]);
//!         assert!(id > 0);
//!     }
//! }
//! ```
//!
//! ## Transactions
//!
//! Start a new transaction using [`Graph::start_txn`], which will return a handle [`Txn`] that can
//! be used to [`Txn::commit`] or [`Txn::rollback`] the transaction.
//!
//! Note that the handle takes a connection from the connection pool, which will be released once
//! the Txn is dropped
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let txn = graph.start_txn().await.unwrap();
//!    let id = Uuid::new_v4().to_string();
//!    let result = txn.run_queries(vec![
//!            query("CREATE (p:Person {id: $id})").param("id", id.clone()),
//!            query("CREATE (p:Person {id: $id})").param("id", id.clone())
//!     ]).await;
//!
//!    assert!(result.is_ok());
//!    txn.commit().await.unwrap();
//!    let mut result = graph
//!        .execute(query("MATCH (p:Person) WHERE p.id = $id RETURN p.id").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    # assert!(result.next().await.unwrap().is_some());
//!    # assert!(result.next().await.unwrap().is_some());
//!    # assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//!
//! ### Streams within a transaction
//!
//! Each [`RowStream`] returned by various execute within the same transaction are well isolated,
//! so you can consume the stream anytime within the transaction using [`RowStream::next`]
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let config = ConfigBuilder::default()
//!        .uri("127.0.0.1:7687")
//!        .user("neo4j")
//!        .password("neo")
//!        .fetch_size(1)
//!        .build()
//!        .unwrap();
//!    let graph = Graph::connect(config).await.unwrap();
//!    let name = Uuid::new_v4().to_string();
//!    let txn = graph.start_txn().await.unwrap();
//!
//!    txn.run_queries(vec![
//!        query("CREATE (p { name: $name })").param("name", name.clone()),
//!        query("CREATE (p { name: $name })").param("name", name.clone()),
//!    ])
//!    .await
//!    .unwrap();
//!
//!
//!    //start stream_one
//!    let mut stream_one = txn
//!        .execute(query("MATCH (p {name: $name}) RETURN p").param("name", name.clone()))
//!        .await
//!        .unwrap();
//!    let row = stream_one.next().await.unwrap().unwrap();
//!    assert_eq!(row.get::<Node>("p").unwrap().get::<String>("name").unwrap(), name.clone());
//!
//!    //start stream_two
//!    let mut stream_two = txn.execute(query("RETURN 1")).await.unwrap();
//!    let row = stream_two.next().await.unwrap().unwrap();
//!    assert_eq!(row.get::<i64>("1").unwrap(), 1);
//!
//!    //stream_one is still active here
//!    let row = stream_one.next().await.unwrap().unwrap();
//!    assert_eq!(row.get::<Node>("p").unwrap().get::<String>("name").unwrap(), name.clone());
//!
//!    //stream_one completes
//!    assert!(stream_one.next().await.unwrap().is_none());
//!    //stream_two completes
//!    assert!(stream_two.next().await.unwrap().is_none());
//!    txn.commit().await.unwrap();
//! }
//!
//! ```
//!
//!
//! ### Rollback a transaction
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    let txn = graph.start_txn().await.unwrap();
//!    let id = Uuid::new_v4().to_string();
//!    // create a node
//!    txn.run(query("CREATE (p:Person {id: $id})").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    // rollback the changes
//!    txn.rollback().await.unwrap();
//!
//!    // changes not updated in the database
//!    let mut result = graph
//!        .execute(query("MATCH (p:Person) WHERE p.id = $id RETURN p.id").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//!
//! ### Txn vs Graph
//!
//! Everytime you execute a query using [`Graph::run`] or [`Graph::execute`], a new connection is
//! taken from the pool and released immediately.
//!
//! However, when you execute a query on a transaction using [`Txn::run`] or [`Txn::execute`] the
//! same connection will be reused, the underlying connection will be released to the pool in a
//! clean state only after you commit/rollback the transaction and the [`Txn`] handle is dropped.
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let txn = graph.start_txn().await.unwrap();
//!    let id = Uuid::new_v4().to_string();
//!    txn.run(query("CREATE (p:Person {id: $id})").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    txn.run(query("CREATE (p:Person {id: $id})").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    // graph.execute(..) will not see the changes done above as the txn is not committed yet
//!    let mut result = graph
//!        .execute(query("MATCH (p:Person) WHERE p.id = $id RETURN p.id").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    assert!(result.next().await.unwrap().is_none());
//!    txn.commit().await.unwrap();
//!
//!    //changes are now seen as the transaction is committed.
//!    let mut result = graph
//!        .execute(query("MATCH (p:Person) WHERE p.id = $id RETURN p.id").param("id", id.clone()))
//!        .await
//!        .unwrap();
//!    assert!(result.next().await.unwrap().is_some());
//!    assert!(result.next().await.unwrap().is_some());
//!    assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//!
//! ## Relationships
//!
//! Bounded Relationship between nodes are created using cypher queries and the same can be parsed
//! from the [`RowStream`]
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let mut result = graph.execute(
//!        query("CREATE (p:Person { name: 'Oliver Stone' })-[r:WORKS_AT {as: 'Engineer'}]->(neo) RETURN r")
//!    ).await.unwrap();
//!
//!    let row = result.next().await.unwrap().unwrap();
//!    let relation: Relation = row.get("r").unwrap();
//!    assert!(relation.id() > -1);
//!    assert!(relation.start_node_id() > -1);
//!    assert!(relation.end_node_id() > -1);
//!    assert_eq!(relation.typ(), "WORKS_AT");
//!    assert_eq!(relation.get::<String>("as").unwrap(), "Engineer");
//! }
//! ```
//!
//!
//! Similar to bounded relation, an unbounded relation can also be created/parsed.
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let mut result = graph.execute(
//!        query("MERGE (p1:Person { name: 'Oliver Stone' })-[r:RELATED {as: 'friend'}]-(p2: Person {name: 'Mark'}) RETURN r")
//!    ).await.unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let relation: Relation = row.get("r").unwrap();
//!    assert!(relation.id() > -1);
//!    assert!(relation.start_node_id() > -1);
//!    assert!(relation.end_node_id() > -1);
//!    assert_eq!(relation.typ(), "RELATED");
//!    assert_eq!(relation.get::<String>("as").unwrap(), "friend");
//! }
//!
//! ```
//!
//!
//!
//! ## Points
//!
//! A 2d or 3d point can be represented with the types  [`Point2D`] and [`Point3D`]
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    let mut result = graph
//!        .execute(query(
//!            "WITH point({ x: 2.3, y: 4.5, crs: 'cartesian' }) AS p1,
//!             point({ x: 1.1, y: 5.4, crs: 'cartesian' }) AS p2 RETURN point.distance(p1,p2) AS dist, p1, p2",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let dist: f64 = row.get("dist").unwrap();
//!    let p1: Point2D = row.get("p1").unwrap();
//!    let p2: Point2D = row.get("p2").unwrap();
//!    assert_eq!(1.5, dist);
//!    assert_eq!(p1.sr_id(), 7203);
//!    assert_eq!(p1.x(), 2.3);
//!    assert_eq!(p1.y(), 4.5);
//!    assert_eq!(p2.sr_id(), 7203);
//!    assert_eq!(p2.x(), 1.1);
//!    assert_eq!(p2.y(), 5.4);
//!    assert!(result.next().await.unwrap().is_none());
//!
//!    let mut result = graph
//!        .execute(query(
//!            "RETURN point({ longitude: 56.7, latitude: 12.78, height: 8 }) AS point",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let point: Point3D = row.get("point").unwrap();
//!    assert_eq!(point.sr_id(), 4979);
//!    assert_eq!(point.x(), 56.7);
//!    assert_eq!(point.y(), 12.78);
//!    assert_eq!(point.z(), 8.0);
//!    assert!(result.next().await.unwrap().is_none());
//!
//! }
//!
//! ```
//!
//! ## Raw bytes
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let bytes = b"Hello, Neo4j!";
//!    let mut result = graph
//!        .execute(query("RETURN $b as output").param("b", bytes.as_ref()))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let b: Vec<u8> = row.get("output").unwrap();
//!    assert_eq!(b, bytes);
//!    assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//!
//! ## Durations
//!
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let duration = std::time::Duration::new(5259600, 7);
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", duration))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let d: std::time::Duration = row.get("output").unwrap();
//!    assert_eq!(d.as_secs(), 5259600);
//!    assert_eq!(d.subsec_nanos(), 7);
//!    assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//! ## Date
//!
//! See [NaiveDate][naive_date] for date abstraction, it captures the date without time component.
//!
//! [naive_date]: https://docs.rs/chrono/0.4.19/chrono/naive/struct.NaiveDate.html
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let date = chrono::NaiveDate::from_ymd_opt(1985, 2, 5).unwrap();
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", date))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let d: chrono::NaiveDate = row.get("output").unwrap();
//!    assert_eq!(d.to_string(), "1985-02-05");
//!    assert!(result.next().await.unwrap().is_none());
//! }
//! ```
//!
//!
//! ## Time
//!
//! * [NaiveTime][naive_time] captures only the time of the day
//! * `tuple`([NaiveTime][naive_time], `Option`<[FixedOffset][fixed_offset]>) captures the time of the day along with the
//! offset
//!
//! [naive_time]: https://docs.rs/chrono/0.4.19/chrono/naive/struct.NaiveTime.html
//! [fixed_offset]: https://docs.rs/chrono/0.4.19/chrono/offset/struct.FixedOffset.html
//!
//!
//! ### Time as param
//!
//! Pass a time as a parameter to the query:
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    //send time without offset as param
//!    let time = chrono::NaiveTime::from_hms_nano_opt(11, 15, 30, 200).unwrap();
//!    let mut result = graph.execute(query("RETURN $d as output").param("d", time)).await.unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: (chrono::NaiveTime, Option<chrono::FixedOffset>) = row.get("output").unwrap();
//!    assert_eq!(t.0.to_string(), "11:15:30.000000200");
//!    assert_eq!(t.1, None);
//!    assert!(result.next().await.unwrap().is_none());
//!
//!
//!    //send time with offset as param
//!    let time = chrono::NaiveTime::from_hms_nano_opt(11, 15, 30, 200).unwrap();
//!    let offset = chrono::FixedOffset::east_opt(3 * 3600).unwrap();
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", (time, offset)))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: (chrono::NaiveTime, Option<chrono::FixedOffset>) = row.get("output").unwrap();
//!    assert_eq!(t.0.to_string(), "11:15:30.000000200");
//!    assert_eq!(t.1, Some(offset));
//!    assert!(result.next().await.unwrap().is_none());
//! }
//! ```
//!
//!
//! ### Parsing time from result
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    //Parse time without offset
//!    let mut result = graph
//!        .execute(query(
//!            " WITH time({hour:10, minute:15, second:30, nanosecond: 200}) AS t RETURN t",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: (chrono::NaiveTime, Option<chrono::FixedOffset>) = row.get("t").unwrap();
//!    assert_eq!(t.0.to_string(), "10:15:30.000000200");
//!    assert_eq!(t.1, None);
//!    assert!(result.next().await.unwrap().is_none());
//!
//!    //Parse time with timezone information
//!    let mut result = graph
//!        .execute(query(
//!            " WITH time({hour:10, minute:15, second:33, nanosecond: 200, timezone: '+01:00'}) AS t RETURN t",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: (chrono::NaiveTime, Option<chrono::FixedOffset>) = row.get("t").unwrap();
//!    assert_eq!(t.0.to_string(), "10:15:33.000000200");
//!    assert_eq!(t.1, Some(chrono::FixedOffset::east_opt(1 * 3600).unwrap()));
//!    assert!(result.next().await.unwrap().is_none());
//! }
//!
//! ```
//!
//!
//! ## DateTime
//!
//!
//! * [DateTime][date_time] captures the date and time with offset
//! * [NaiveDateTime][naive_date_time] captures the date time without offset
//! * `tuple`([NaiveDateTime][naive_date_time], String)  captures the date/time and the time zone id
//!
//! [date_time]: https://docs.rs/chrono/0.4.19/chrono/struct.DateTime.html
//! [naive_date_time]: https://docs.rs/chrono/0.4.19/chrono/struct.NaiveDateTime.html
//!
//!
//! ### DateTime as param
//!
//! Pass a DateTime as parameter to the query:
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    //send datetime as parameter in the query
//!    let datetime = chrono::DateTime::parse_from_rfc2822("Tue, 01 Jul 2003 10:52:37 +0200").unwrap();
//!
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", datetime))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: chrono::DateTime<chrono::FixedOffset> = row.get("output").unwrap();
//!    assert_eq!(t.to_string(), "2003-07-01 10:52:37 +02:00");
//!    assert!(result.next().await.unwrap().is_none());
//!
//!    //send NaiveDateTime as parameter in the query
//!    let localdatetime = chrono::NaiveDateTime::parse_from_str("2015-07-01 08:55:59.123", "%Y-%m-%d %H:%M:%S%.f").unwrap();
//!
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", localdatetime))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: chrono::NaiveDateTime = row.get("output").unwrap();
//!    assert_eq!(t.to_string(), "2015-07-01 08:55:59.123");
//!    assert!(result.next().await.unwrap().is_none());
//!
//!    //send NaiveDateTime with timezone id as parameter in the query
//!    let datetime = chrono::NaiveDateTime::parse_from_str("2015-07-03 08:55:59.555", "%Y-%m-%d %H:%M:%S%.f").unwrap();
//!    let timezone =  "Europe/Paris";
//!
//!    let mut result = graph
//!        .execute(query("RETURN $d as output").param("d", (datetime, timezone)))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let (time, zone): (chrono::NaiveDateTime, String) = row.get("output").unwrap();
//!    assert_eq!(time.to_string(), "2015-07-03 08:55:59.555");
//!    assert_eq!(zone, "Europe/Paris");
//!    assert!(result.next().await.unwrap().is_none());
//!
//! }
//! ```
//!
//! ### Parsing DateTime from result
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!
//!    //Parse NaiveDateTime from result
//!    let mut result = graph
//!        .execute(query(
//!            "WITH localdatetime('2015-06-24T12:50:35.556') AS t RETURN t",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: chrono::NaiveDateTime = row.get("t").unwrap();
//!    assert_eq!(t.to_string(), "2015-06-24 12:50:35.556");
//!    assert!(result.next().await.unwrap().is_none());
//!
//!    //Parse DateTime from result
//!    let mut result = graph
//!        .execute(query(
//!            "WITH datetime('2015-06-24T12:50:35.777+0100') AS t RETURN t",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let t: chrono::DateTime<chrono::FixedOffset> = row.get("t").unwrap();
//!    assert_eq!(t.to_string(), "2015-06-24 12:50:35.777 +01:00");
//!    assert!(result.next().await.unwrap().is_none());
//!
//!
//!    //Parse NaiveDateTime with zone id from result
//!    let mut result = graph
//!        .execute(query(
//!            "WITH datetime({ year:1984, month:11, day:11, hour:12, minute:31, second:14, nanosecond: 645876123, timezone:'Europe/Stockholm' }) AS d return d",
//!        ))
//!        .await
//!        .unwrap();
//!    let row = result.next().await.unwrap().unwrap();
//!    let (datetime, zone_id): (chrono::NaiveDateTime, String) = row.get("d").unwrap();
//!    assert_eq!(datetime.to_string(), "1984-11-11 12:31:14.645876123");
//!    assert_eq!(zone_id, "Europe/Stockholm");
//!    assert!(result.next().await.unwrap().is_none());
//!
//! }
//!
//! ```
//!
//!
//!
//! ## Path
//!
//! ```no_run
//! use neo4rs::*;
//! use futures::stream::*;
//! use uuid::Uuid;
//!
//! #[tokio::main]
//! async fn main() {
//!    let uri = "127.0.0.1:7687";
//!    let user = "neo4j";
//!    let pass = "neo";
//!    let graph = Graph::new(uri, user, pass).await.unwrap();
//!    let name = Uuid::new_v4().to_string();
//!    graph.run(
//!      query("CREATE (p:Person { name: $name })-[r:WORKS_AT]->(n:Company { name: 'Neo'})").param("name", name.clone()),
//!    ).await.unwrap();
//!
//!    let mut result = graph.execute(
//!       query("MATCH p = (person:Person { name: $name })-[r:WORKS_AT]->(c:Company) RETURN p").param("name", name),
//!    ).await.unwrap();
//!
//!    let row = result.next().await.unwrap().unwrap();
//!    let path: Path = row.get("p").unwrap();
//!    assert_eq!(path.ids().len(), 2);
//!    assert_eq!(path.nodes().len(), 2);
//!    assert_eq!(path.rels().len(), 1);
//!    assert!(result.next().await.unwrap().is_none());
//! }
//! ```
//!
//!
mod config;
mod connection;
mod convert;
mod errors;
mod graph;
mod messages;
mod pool;
mod query;
mod row;
mod stream;
mod txn;
mod types;
mod version;

pub use crate::config::{Config, ConfigBuilder};
pub use crate::errors::*;
pub use crate::graph::{query, Graph};
pub use crate::query::Query;
pub use crate::row::{Node, Path, Point2D, Point3D, Relation, Row, UnboundedRelation};
pub use crate::stream::RowStream;
pub use crate::txn::Txn;
pub use crate::version::Version;