apache_age

Crates.ioapache_age
lib.rsapache_age
version
sourcesrc
created_at2022-04-23 14:22:03.974557
updated_at2024-12-01 19:52:28.414681
descriptionRust driver for the Apache AGE. Based on postgres package
homepage
repositoryhttps://github.com/dzordzu/rust-apache-age.git
max_upload_size
id572672
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Tomasz Durda (Dzordzu)

documentation

README

Apache AGE (Rust Driver)

Crates.io Version GitHub Tag

What is Apache AGE

AGE is opensource backend for postgres, that allows user to perform graph related operations on postgres. You can read about it on the official website

This repository will be eventually merged into the age repository. The status of the work needed for PR can be found in the special issue within AGE issue tracker

Important note

This library is just a wrapper around existing postgres libraries. Connection parameters, methods etc. are indentical (unless noted) as in the postgres and tokio-postgres crates.

Driver usage

More examples can be find in documentation (link below)

use apache_age::{NoTls, AgType};
use apache_age::sync::{AgeClient, Client}; 
use serde::{Deserialize, Serialize};

let mut client = Client::connect_age(
  "host=localhost user=postgres password=passwd port=8081",
  NoTls
).unwrap();

client.create_graph("my_apache_graph");

#[derive(Debug, Serialize, Deserialize, Clone)]
struct Person {
    pub name: String,
    pub surname: String,
}

match client.query_cypher::<()>(
    "my_apache_graph",
    "MATCH (n: Person) WHERE n.name = 'Alfred' RETURN {name: n.name, surname: n.surname}",
    None,
) {
    Ok(rows) => {
        let x: AgType<Person> = rows[0].get(0);
        // do whatever you need
    }
    Err(e) => {
        // handle error
    }
}

client.drop_graph("my_apache_graph");

Links

Testing

There is a simple docker-compose file within tests directory. Run it to set up an AGE db.

pushd tests
docker-compose up -d
popd
cargo t
Commit count: 67

cargo fmt