pub trait StorageConnection: Send + Sync {
    type Database: Connection;
Show 13 methods fn database<'life0, 'life1, 'async_trait, DB: Schema>(
        &'life0 self,
        name: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<Self::Database, Error>> + Send + 'async_trait>>
    where
        DB: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn create_database_with_schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        schema: SchemaName,
        only_if_needed: bool
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn delete_database<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn list_databases<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Database>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn list_available_schemas<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SchemaName>, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn create_user<'life0, 'life1, 'async_trait>(
        &'life0 self,
        username: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn set_user_password<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
        &'life0 self,
        user: U,
        password: SensitiveString
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        U: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn authenticate<'user, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync>(
        &'life0 self,
        user: U,
        authentication: Authentication
    ) -> Pin<Box<dyn Future<Output = Result<Authenticated, Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        U: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn add_permission_group_to_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
        &'life0 self,
        user: U,
        permission_group: G
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        'group: 'async_trait,
        U: 'async_trait,
        G: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn remove_permission_group_from_user<'user, 'group, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, G: Into<NamedReference<'group>> + Send + Sync>(
        &'life0 self,
        user: U,
        permission_group: G
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        'group: 'async_trait,
        U: 'async_trait,
        G: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn add_role_to_user<'user, 'role, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, R: Into<NamedReference<'role>> + Send + Sync>(
        &'life0 self,
        user: U,
        role: R
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        'role: 'async_trait,
        U: 'async_trait,
        R: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn remove_role_from_user<'user, 'role, 'life0, 'async_trait, U: Into<NamedReference<'user>> + Send + Sync, R: Into<NamedReference<'role>> + Send + Sync>(
        &'life0 self,
        user: U,
        role: R
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'user: 'async_trait,
        'role: 'async_trait,
        U: 'async_trait,
        R: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait
; fn create_database<'life0, 'life1, 'async_trait, DB: Schema>(
        &'life0 self,
        name: &'life1 str,
        only_if_needed: bool
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        DB: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
}
Expand description

Functions for interacting with a multi-database BonsaiDb instance.

Associated Types

The type that represents a database for this implementation.

Required methods

Returns a reference to database name with schema DB.

Creates a database named name using the SchemaName schema.

Errors
  • Error::InvalidDatabaseName: name must begin with an alphanumeric character ([a-zA-Z0-9]), and all remaining characters must be alphanumeric, a period (.), or a hyphen (-).
  • Error::DatabaseNameAlreadyTaken: name was already used for a previous database name. Database names are case insensitive. Returned if only_if_needed is false.

Deletes a database named name.

Errors

Lists the databases in this storage.

Lists the SchemaNames registered with this storage.

Creates a user.

Sets a user’s password.

Authenticates as a user with a authentication method.

Adds a user to a permission group.

Removes a user from a permission group.

Adds a user to a permission group.

Removes a user from a permission group.

Provided methods

Creates a database named name with the Schema provided.

Errors
  • Error::InvalidDatabaseName: name must begin with an alphanumeric character ([a-zA-Z0-9]), and all remaining characters must be alphanumeric, a period (.), or a hyphen (-).
  • Error::DatabaseNameAlreadyTaken: name was already used for a previous database name. Database names are case insensitive. Returned if only_if_needed is false.

Implementors