Trait AsyncMysqlShim

Source
pub trait AsyncMysqlShim<W: Send> {
    type Error: From<Error>;

    // Required methods
    fn on_prepare<'a, 'async_trait>(
        &'a mut self,
        query: &'a str,
        info: StatementMetaWriter<'a, W>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn on_execute<'a, 'async_trait>(
        &'a mut self,
        id: u32,
        params: ParamParser<'a>,
        results: QueryResultWriter<'a, W>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn on_close<'a, 'async_trait>(
        &'a mut self,
        stmt: u32,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where W: 'async_trait,
             Self: 'async_trait,
             'a: 'async_trait;
    fn on_query<'a, 'async_trait>(
        &'a mut self,
        query: &'a str,
        results: QueryResultWriter<'a, W>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;

    // Provided methods
    fn version(&self) -> String { ... }
    fn connect_id(&self) -> u32 { ... }
    fn default_auth_plugin(&self) -> &str { ... }
    fn auth_plugin_for_username<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _user: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = &str> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn salt(&self) -> [u8; 20] { ... }
    fn authenticate<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        _auth_plugin: &'life1 str,
        _username: &'life2 [u8],
        _salt: &'life3 [u8],
        _auth_data: &'life4 [u8],
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait { ... }
    fn on_init<'a, 'async_trait>(
        &'a mut self,
        _: &'a str,
        __arg2: InitWriter<'a, W>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: Send + 'async_trait,
             'a: 'async_trait { ... }
}
Expand description

Implementors of this async-trait can be used to drive a MySQL-compatible database backend.

Required Associated Types§

Source

type Error: From<Error>

The error type produced by operations on this shim.

Must implement From<io::Error> so that transport-level errors can be lifted.

Required Methods§

Source

fn on_prepare<'a, 'async_trait>( &'a mut self, query: &'a str, info: StatementMetaWriter<'a, W>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Called when the client issues a request to prepare query for later execution.

The provided StatementMetaWriter should be used to notify the client of the statement id assigned to the prepared statement, as well as to give metadata about the types of parameters and returned columns.

Source

fn on_execute<'a, 'async_trait>( &'a mut self, id: u32, params: ParamParser<'a>, results: QueryResultWriter<'a, W>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Called when the client executes a previously prepared statement.

Any parameters included with the client’s command is given in params. A response to the query should be given using the provided QueryResultWriter.

Source

fn on_close<'a, 'async_trait>( &'a mut self, stmt: u32, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where W: 'async_trait, Self: 'async_trait, 'a: 'async_trait,

Called when the client wishes to deallocate resources associated with a previously prepared statement.

Source

fn on_query<'a, 'async_trait>( &'a mut self, query: &'a str, results: QueryResultWriter<'a, W>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Called when the client issues a query for immediate execution.

Results should be returned using the given QueryResultWriter.

Provided Methods§

Source

fn version(&self) -> String

Server version

Source

fn connect_id(&self) -> u32

Connection id

Source

fn default_auth_plugin(&self) -> &str

get auth plugin

Source

fn auth_plugin_for_username<'life0, 'life1, 'async_trait>( &'life0 self, _user: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = &str> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

get auth plugin

Source

fn salt(&self) -> [u8; 20]

Default salt(scramble) for auth plugin

Source

fn authenticate<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _auth_plugin: &'life1 str, _username: &'life2 [u8], _salt: &'life3 [u8], _auth_data: &'life4 [u8], ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

authenticate method for the specified plugin

Source

fn on_init<'a, 'async_trait>( &'a mut self, _: &'a str, __arg2: InitWriter<'a, W>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'a: 'async_trait,

Called when client switches database.

Implementors§