Struct aragog::DatabaseConnectionPool[][src]

pub struct DatabaseConnectionPool {
    pub collections: HashMap<String, DatabaseCollection>,
    pub database: Database<ReqwestClient>,
}

Struct containing ArangoDB connections and information to access the database, collections and documents

Fields

collections: HashMap<String, DatabaseCollection>

Map between a collection name and a DatabaseCollection instance

database: Database<ReqwestClient>

The database accessor

Implementations

impl DatabaseConnectionPool[src]

pub fn builder() -> DatabaseConnectionPoolBuilder[src]

Starts the builder for the database connection pool instance.

For default use with env var

let db_pool = DatabaseConnectionPool::builder()
    // You can specify a host and credentials with this method.
    // Otherwise, the builder will look for the env vars: `DB_HOST`, `DB_NAME`, `DB_USER` and `DB_PASSWORD`.
    .with_credentials("http://localhost:8529", "db", "user", "password")
    // You can specify a authentication mode between `Basic` and `Jwt`
    // Otherwise the default value will be used (`Basic`).
    .with_auth_mode(AuthMode::Basic)
    // You can specify a schema path to initialize the database pool
    // Otherwise the env var `SCHEMA_PATH` or the default value `config/db/schema.yaml` will be used.
    .with_schema_path("config/db/schema.yaml")
    // If you prefer you can use your own custom schema
    .with_schema(DatabaseSchema::default())
    // The schema wil silently apply to the database, useful only if you don't use the CLI and migrations
    .apply_schema()
    // You then need to build the pool
    .build()
    .await
    .unwrap();

You can also specify a custom DatabaseSchema using with_schema.

pub fn collections_names(&self) -> Vec<String>[src]

retrieves a vector of all collection names from the pool

pub async fn truncate(&self)[src]

DESTRUCTIVE OPERATION

This will truncate all collections in the database pool, the collection will still exist but every document will be destryed.

Panics

If the truncate fails on some collection the method will panic, see the arangors documentation on collection truncate.

Trait Implementations

impl Clone for DatabaseConnectionPool[src]

impl DatabaseAccess for DatabaseConnectionPool[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.