#postgresql #age #graph #apache #driver #back-end #package

apache_age

Rust driver for the Apache AGE. Based on postgres package

16 releases (5 breaking)

0.6.0 Jan 19, 2023
0.5.4 Sep 24, 2022
0.4.2 Sep 17, 2022
0.3.4 Sep 17, 2022
0.1.0 Apr 23, 2022

#1841 in Database interfaces

Download history 18/week @ 2024-02-17 21/week @ 2024-02-24 2/week @ 2024-03-02 37/week @ 2024-03-09 5/week @ 2024-03-16

73 downloads per month

Apache-2.0

44KB
1K SLoC

Apache AGE (Rust Driver)

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

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");

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

Dependencies

~8–20MB
~334K SLoC