Crate ryugraph

Crate ryugraph 

Source
Expand description

Bindings to Ryu: an in-process property graph database management system built for query speed and scalability.

§Example Usage

use ryugraph::{Database, SystemConfig, Connection};

let db = Database::new(path, SystemConfig::default())?;
let conn = Connection::new(&db)?;
conn.query("CREATE NODE TABLE Person(name STRING, age INT64, PRIMARY KEY(name));")?;
conn.query("CREATE (:Person {name: 'Alice', age: 25});")?;
conn.query("CREATE (:Person {name: 'Bob', age: 30});")?;

let mut result = conn.query("MATCH (a:Person) RETURN a.name AS NAME, a.age AS AGE;")?;
println!("{}", result);

§Building

By default, the Ryu C++ library will be compiled from source and statically linked.

If you want to instead link against a pre-built version of the library, the following environment variables can be used to configure the build process:

  • RYU_SHARED: If set, link dynamically instead of statically
  • RYU_INCLUDE_DIR: Directory of Ryu’s headers
  • RYU_LIBRARY_DIR: Directory containing Ryu’s pre-built libraries.

Example:

ryu_prebuilt_dir=/tmp/ryu # pre-built Ryu from https://docs.ryugraph.io/installation/#cc
ryu_prebuilt_dir=/path_to_ryu_source/build/release/src # Ryu built from source
export RYU_LIBRARY_DIR="ryu_prebuilt_dir"
export RYU_INCLUDE_DIR="ryu_prebuilt_dir"
export RYU_SHARED=1

On macOS:

brew install ryu
export RYU_LIBRARY_DIR=/opt/homebrew/lib
export RYU_INCLUDE_DIR=/opt/homebrew/include
export RYU_SHARED=1

§Using Extensions

By default, binaries created using this library will not work with Ryu’s extensions (except on Windows/MSVC, where the linker works differently).

If you want to use extensions in binaries (binary crates or tests) using this library, you will need to add the following (or a similar command; see build-scripts) to your build.rs (or create one) so that the binary produced acts like a library that the extension can link with. Not doing this will produce undefined symbol errors when the extension is loaded:

println!("cargo:rustc-link-arg=-rdynamic");

Structs§

ArrowIterator
Produces an iterator over a QueryResult as RecordBatches
CSVOptions
Options for writing CSV files
Connection
Connections are used to interact with a Database instance.
Database
The Database class is the main class of RyuGraph. It manages all database components.
InternalID
Stores the table_id and offset of a node/rel.
NodeVal
NodeVal represents a node in the graph and stores the nodeID, label and properties of that node.
PreparedStatement
A prepared stattement is a parameterized query which can avoid planning the same query for repeated execution
QueryResult
Stores the result of a query execution
RelVal
RelVal represents a relationship in the graph and stores the relID, src/dst nodes and properties of that rel
SystemConfig
Configuration options for the database.

Enums§

Error
LogicalType
Type of Values produced and consumed by queries.
Value
Data types supported by Ryu

Constants§

VERSION
The version of the Ryu crate as reported by Cargo’s CARGO_PKG_VERSION environment variable

Functions§

get_storage_version
Returns the storage version of the Ryu library