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
//! Experimental Rust client for Apache Tinkerpop Gremlin Server. //! The driver supports the execution of raw Gremlin queries and GLV traversal //! //! //! You can use gremlin-client this lines in your `Cargo.toml` //! //! ```toml //! [dependencies] //! gremlin-client = "*" //! ``` //! //! For async support via [async-std](https://async.rs/) //! ```toml //! [dependencies] //! gremlin-client = { version = "*", features = ["async_std"] } //! ``` //! //! //! Here it is an usage example: //! //! **Synchronous** //! //! ```rust,no_run //! //! use gremlin_client::{GremlinClient, Vertex}; //! //! fn main() -> Result<(), Box<std::error::Error>> { //! let client = GremlinClient::connect("localhost")?; //! //! let results = client //! .execute("g.V(param)", &[("param", &1)])? //! .filter_map(Result::ok) //! .map(|f| f.take::<Vertex>()) //! .collect::<Result<Vec<Vertex>, _>>()?; //! //! println!("{:?}", results); //! //! Ok(()) //!} //! //! //! ``` //! //! **Asynchronous** //! //! ```rust,no_run,ignore //! //! use gremlin_client::{aio::GremlinClient, Vertex}; //! use async_std::task; //! use async_std::prelude::*; //! //! fn main() -> Result<(), Box<std::error::Error>> { //! //! task::block_on(async { //! let client = GremlinClient::connect("localhost").await?; //! let results = client //! .execute("g.V(param)", &[("param", &1)]).await? //! .filter_map(Result::ok) //! .map(|f| f.take::<Vertex>()) //! .collect::<Result<Vec<Vertex>, _>>().await?; //! println!("{:?}", results); //! Ok(()) //! }) //! //!} //! //! //! ``` //! //! Here it is an example with traversal: //! //! **Synchronous** //! //! ```rust,no_run //! //! use gremlin_client::{GremlinClient, Vertex, process::traversal::traversal}; //! //! fn main() -> Result<(), Box<std::error::Error>> { //! let client = GremlinClient::connect("localhost")?; //! //! let g = traversal().with_remote(client); //! //! let results = g.v(()).has_label("person").has(("name","Jon")).to_list()?; //! //! println!("{:?}", results); //! Ok(()) //!} //! //! ``` //! **Aynchronous** //! //! ```rust,no_run,ignore //! //! use gremlin_client::{aio::GremlinClient, Vertex, process::traversal::traversal}; //! use async_std::task; //! use async_std::prelude::*; //! //! fn main() -> Result<(), Box<std::error::Error>> { //! //! task::block_on(async { //! //! let client = GremlinClient::connect("localhost").await?; //! //! let g = traversal().with_remote_async(client); //! //! let results = g.v(()).has_label("person").has(("name","Jon")).to_list().await?; //! //! println!("{:?}", results); //! Ok(()) //! }) //!} //! mod client; mod connection; mod conversion; mod error; mod io; mod message; mod pool; pub use client::GremlinClient; pub use connection::{ConnectionOptions, TlsOptions}; pub use conversion::{BorrowFromGValue, FromGValue, ToGValue}; pub use error::GremlinError; pub use io::GraphSON; pub type GremlinResult<T> = Result<T, error::GremlinError>; pub use structure::{ Cardinality, Edge, GKey, GResultSet, GValue, IntermediateRepr, List, Map, Metric, Path, Property, Token, TraversalExplanation, TraversalMetrics, Vertex, VertexProperty, GID, }; #[cfg(feature = "async_gremlin")] pub mod aio; pub mod process; pub mod structure; pub mod utils;