redis_graph

crates.io Continuous integration

redis_graph proivdes a small trait with an extension function for the redis crate to allow working with redis graph data types that can be installed as a redis module. Redis graph operation are only using a single top level Redis command, so this crate only adds a single function to the redis commands. The Graph command is available in a synchronous and asynchronous version.

The crate is called redis_graph and you can depend on it via cargo. You will also need redis in your dependencies.

ini [dependencies] redis = "0.17.0" redis_graph = "*"

Or via git:

ini [dependencies.redis_graph] git = "https://github.com/tompro/redis_graph.git"

Synchronous usage

To enable the redis graph command you simply load the trait redisgraph::GraphCommands into scope. The redis graph command will then be available on your redis connection. To also have access to the value extractor traits simply import the whole crate redisgraph::*.

```rust use redis::Commands; use redis_graph::*;

let client = redis::Client::open("redis://127.0.0.1/")?; let mut con = client.get_connection()?;

let :GraphResultSet = con.graphquery( "my_graph", "CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'})" )?; ```

Asynchronous usage

To enable the redis graph async command you simply load the redisgraph::AsyncGraphCommands into the scope. To also have access to the value extractor traits simply import the whole crate redisgraph::*.

```rust use redis::AsyncCommands; use redis_graph::*;

let client = redis::Client::open("redis://127.0.0.1/")?; let mut con = client.getasyncconnection().await?;

let :GraphResultSet = con.graphquery( "my_graph", "CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'})" ).await?; ```