Deadpool is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool
manager for ArangoDB
using arangors
.
Feature | Description | Extra dependencies | Default |
---|---|---|---|
rt_tokio_1 |
Enable support for tokio crate, through the usage of reqwest as http client |
deadpool/rt_tokio_1 , arangors/reqwest_async |
yes |
rt_async-std_1 |
Enable support for async-std crate, through the usage of surf as http client |
deadpool/rt_async-std_1 , arangors/surf_async |
no |
serde |
Enable support for serde crate | deadpool/serde , serde/derive |
no |
use deadpool_arangodb::{Config, Runtime};
#[tokio::main]
async fn main() {
let mut cfg = Config {
url: Some("http://localhost:8529".to_string()),
username: Some("root".to_string()),
password: Some("deadpool".to_string()),
use_jwt: true,
pool: None,
};
let pool = cfg.create_pool(Runtime::Tokio1).unwrap();
let mut conn = pool.get().await.unwrap();
let db = conn.create_database("deadpool_favorite_foods")
.await.expect("Failed to create database: {:?}");
// Do stuff with db...
}
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.