Skip to main content

AnyConnectionBackend

Trait AnyConnectionBackend 

Source
pub trait AnyConnectionBackend:
    Any
    + Debug
    + Send
    + 'static {
Show 15 methods // Required methods fn name(&self) -> &str; fn close( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>; fn ping( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn begin( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn commit( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn rollback( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>; fn start_rollback(&mut self); fn shrink_buffers(&mut self); fn fetch_many<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Stream<Item = Result<Either<AnyQueryResult, AnyRow>, Error>> + Send + 'q>>; fn fetch_optional<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>, Error>> + Send + 'q>>; fn prepare_with<'c, 'q>( &'c mut self, sql: &'q str, parameters: &[AnyTypeInfo], ) -> Pin<Box<dyn Future<Output = Result<AnyStatement<'q>, Error>> + Send + 'c>> where 'q: 'c; fn describe<'q>( &'q mut self, sql: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Describe<Any>, Error>> + Send + 'q>>; // Provided methods fn cached_statements_size(&self) -> usize { ... } fn clear_cached_statements( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>> { ... } fn as_migrate( &mut self, ) -> Result<&mut (dyn Migrate + Send + 'static), Error> { ... }
}
Available on crate features any and postgres only.

Required Methods§

Source

fn name(&self) -> &str

The backend name.

Source

fn close( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>

Explicitly close this database connection.

This method is not required for safe and consistent operation. However, it is recommended to call it instead of letting a connection drop as the database backend will be faster at cleaning up resources.

Source

fn ping( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Checks if a connection to the database is still valid.

Source

fn begin( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Begin a new transaction or establish a savepoint within the active transaction.

Returns a [Transaction] for controlling and tracking the new transaction.

Source

fn commit( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source

fn rollback( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source

fn start_rollback(&mut self)

Source

fn shrink_buffers(&mut self)

Source

fn fetch_many<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Stream<Item = Result<Either<AnyQueryResult, AnyRow>, Error>> + Send + 'q>>

Source

fn fetch_optional<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>, Error>> + Send + 'q>>

Source

fn prepare_with<'c, 'q>( &'c mut self, sql: &'q str, parameters: &[AnyTypeInfo], ) -> Pin<Box<dyn Future<Output = Result<AnyStatement<'q>, Error>> + Send + 'c>>
where 'q: 'c,

Source

fn describe<'q>( &'q mut self, sql: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Describe<Any>, Error>> + Send + 'q>>

Provided Methods§

Source

fn cached_statements_size(&self) -> usize

The number of statements currently cached in the connection.

Source

fn clear_cached_statements( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Removes all statements from the cache, closing them on the server if needed.

Source

fn as_migrate(&mut self) -> Result<&mut (dyn Migrate + Send + 'static), Error>

Available on crate feature migrate only.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AnyConnectionBackend for MySqlConnection

Source§

fn name(&self) -> &str

Source§

fn close( self: Box<MySqlConnection>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>

Source§

fn ping( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source§

fn begin( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source§

fn commit( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source§

fn rollback( &mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + '_>>

Source§

fn start_rollback(&mut self)

Source§

fn shrink_buffers(&mut self)

Source§

fn as_migrate(&mut self) -> Result<&mut (dyn Migrate + Send + 'static), Error>

Available on crate feature migrate only.
Source§

fn fetch_many<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Stream<Item = Result<Either<AnyQueryResult, AnyRow>, Error>> + Send + 'q>>

Source§

fn fetch_optional<'q>( &'q mut self, query: &'q str, arguments: Option<AnyArguments<'q>>, ) -> Pin<Box<dyn Future<Output = Result<Option<AnyRow>, Error>> + Send + 'q>>

Source§

fn prepare_with<'c, 'q>( &'c mut self, sql: &'q str, _parameters: &[AnyTypeInfo], ) -> Pin<Box<dyn Future<Output = Result<AnyStatement<'q>, Error>> + Send + 'c>>
where 'q: 'c,

Source§

fn describe<'q>( &'q mut self, sql: &'q str, ) -> Pin<Box<dyn Future<Output = Result<Describe<Any>, Error>> + Send + 'q>>

Implementors§