Struct aragog::DatabaseConnectionPool [−][src]
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]
fn clone(&self) -> DatabaseConnectionPool
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl DatabaseAccess for DatabaseConnectionPool
[src]
fn get_collection(
&self,
collection: &str
) -> Result<&Collection<ReqwestClient>, ServiceError>
[src]
&self,
collection: &str
) -> Result<&Collection<ReqwestClient>, ServiceError>
fn database(&self) -> &Database<ReqwestClient>
[src]
#[must_use]fn aql_get<'life0, 'life1, 'async_trait>(
&'life0 self,
aql: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<JsonQueryResult, ServiceError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
aql: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<JsonQueryResult, ServiceError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl !RefUnwindSafe for DatabaseConnectionPool
impl Send for DatabaseConnectionPool
impl Sync for DatabaseConnectionPool
impl Unpin for DatabaseConnectionPool
impl !UnwindSafe for DatabaseConnectionPool
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,