Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prisma/faunadb-rust
FaundaDB client for Rust
https://github.com/prisma/faunadb-rust
Last synced: about 1 month ago
JSON representation
FaundaDB client for Rust
- Host: GitHub
- URL: https://github.com/prisma/faunadb-rust
- Owner: prisma
- License: apache-2.0
- Archived: true
- Created: 2019-05-24T12:46:38.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-10-14T21:42:36.000Z (11 months ago)
- Last Synced: 2024-07-13T19:12:09.509Z (about 2 months ago)
- Language: Rust
- Size: 185 KB
- Stars: 62
- Watchers: 8
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-fauna - Rust
README
# FaunaDB Rust Client
FaunaDB offers an asynchronous (and synchronous) client for communicating with
the [Fauna](https://fauna.com) database.Goals:
- Typesafe
- Allocating only when really needed
- Asynchronous using futures (and [Tokio](https://tokio.rs))The crate is not yet tested on production so use at your own risk.
## Basic Usage
``` rust
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](https://github.com/fauna/faunadb-docker), using the default password
`secret`.Run the tests with:
``` bash
cargo test
```## License
The faunadb-rust crate is licensed under the [Apache 2.0](./LICENSE)