Crate bb8_arangodb
source · [−]Expand description
ArangoDB support for bb8 based on the arangors crate.
The library supports all authentication methods supported by arangors
,
defined by AuthenticationMethod
.
Example
Get all accessible databases using JWT authentication:
use bb8::Pool;
use bb8_arangodb::{ArangoConnectionManager, AuthenticationMethod};
use arangors::uclient::reqwest::ReqwestClient;
tokio_test::block_on(async {
let manager = ArangoConnectionManager::<ReqwestClient>::new(
"http://localhost:8529".to_string(),
AuthenticationMethod::JWTAuth("root".to_string(), "openSesame".to_string())
);
let pool = Pool::builder().max_size(5).build(manager).await.unwrap();
let conn = pool.get().await.unwrap();
let dbs = conn.accessible_databases().await.unwrap();
assert!(!dbs.is_empty());
});
Use basic authentication method:
use bb8::Pool;
use bb8_arangodb::{ArangoConnectionManager, AuthenticationMethod};
use arangors::uclient::reqwest::ReqwestClient;
tokio_test::block_on(async {
let manager = ArangoConnectionManager::<ReqwestClient>::new(
"http://localhost:8529".to_string(),
AuthenticationMethod::BasicAuth("root".to_string(), "openSesame".to_string())
);
let pool = Pool::builder().max_size(5).build(manager).await.unwrap();
let conn = pool.get().await.unwrap();
let dbs = conn.accessible_databases().await.unwrap();
assert!(!dbs.is_empty());
});
Using no authentication method (not recommended):
use bb8::Pool;
use bb8_arangodb::{ArangoConnectionManager, AuthenticationMethod};
use arangors::uclient::reqwest::ReqwestClient;
tokio_test::block_on(async {
let manager = ArangoConnectionManager::<ReqwestClient>::new(
"http://localhost:8529".to_string(),
AuthenticationMethod::NoAuth
);
let pool = Pool::builder().max_size(5).build(manager).await.unwrap();
// ...
});
Re-exports
Structs
A connection manager for ArangoDB.
Enums
Kind of the authentication method to use when establishing a connection.