10 releases

✓ Uses Rust 2018 edition

0.0.11 Jul 3, 2019
0.0.9 Jun 21, 2019

#117 in Database interfaces

Download history 32/week @ 2019-06-05 59/week @ 2019-06-12 77/week @ 2019-06-19 39/week @ 2019-06-26 66/week @ 2019-07-03 31/week @ 2019-07-10 11/week @ 2019-07-17 4/week @ 2019-07-24

69 downloads per month

Apache-2.0

228KB
6K SLoC

FaunaDB Rust Client

FaunaDB offers an asynchronous (and synchronous) client for communicating with the Fauna database.

Goals:

  • Typesafe
  • Allocating only when really needed
  • Asynchronous using futures (and Tokio)

The crate is not yet tested on production so use at your own risk.

Basic Usage

use faunadb::prelude::*;
use tokio;
use futures::{future::lazy, Future};

fn main() {
    let client = Client::builder("put-your-secret-here").build().unwrap();
    let params = DatabaseParams::new("my-first-database");

    tokio::run(lazy(move || {
        client
            .query(CreateDatabase::new(params))
            .map(|response| {
                let res = response.resource;
                assert_eq!(Some("my-first-database"), res["name"].as_str())
            })
            .map_err(|error: faunadb::error::Error| {
                println!("Error: {:?}", error);
            })
    }));
}

Testing

For tests to be successful, one must have the default Fauna Docker image, using the default password secret.

Run the tests with:

cargo test

License

The faunadb-rust crate is licensed under the Apache 2.0

Dependencies

~7MB
~135K SLoC