Skip to content

Latest commit

 

History

History
84 lines (59 loc) · 3.02 KB

File metadata and controls

84 lines (59 loc) · 3.02 KB

license Release GitHub Issues or Pull Requests
Pipeline Codecov Docs
Forum Discord

falkordb-rs

Try Free

FalkorDB Rust client

Usage

Installation

Just add it to your Cargo.toml, like so:

falkordb = { version = "*" }

Run FalkorDB instance

Docker:

docker run --rm -p 6379:6379 falkordb/falkordb

Code Example

use falkordb::{FalkorClientBuilder, FalkorConnectionInfo};

// Connect to FalkorDB
let connection_info: FalkorConnectionInfo = "falkor://127.0.0.1:6379".try_into()
    .expect("Invalid connection info");

let client = FalkorClientBuilder::new()
    .with_connection_info(connection_info)
    .build().expect("Failed to build client");

// Select the social graph
let mut graph = client.select_graph("social");

// Create 100 nodes and return a handful
let nodes = graph.query("UNWIND range(0, 100) AS i CREATE (n { v:1 }) RETURN n LIMIT 10")
    .with_timeout(5000).execute().expect("Failed executing query");

for n in nodes.data {
    println!("{:?}", n[0]);
}

Features

SSL/TLS Support

This client is currently built upon the redis crate, and therefor supports TLS using its implementation, which uses either rustls or native_tls. This is not enabled by default, and the user ust opt-in by enabling the respective features: "rustls"/"native-tls".\

For Rustls:

falkordb = { version = "*", features = ["rustls"] }

For NativeTLS:

falkordb = { version = "*", features = ["native-tls"] }

Tracing

This crate fully supports instrumentation using the tracing crate, to use it, simply, enable the tracing feature:

falkordb = { version = "*", features = ["tracing"] }

Note that different functions use different filtration levels, to avoid spamming your tests, be sure to enable the correct level as you desire it.