Giter Site home page Giter Site logo

rust-apache-age's Introduction

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

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

rust-apache-age's People

Contributors

dzordzu avatar ivarflakstad avatar thedavemarshall avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.