Trait sql_introspection_tests::test_api::Queryable
source · pub trait Queryable: Send + Sync {
Show 17 methods
// Required methods
fn query<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Query<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn query_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn query_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Query<'life1>
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn execute_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn execute_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn raw_cmd<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn version<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn is_healthy(&self) -> bool;
fn set_tx_isolation_level<'life0, 'async_trait>(
&'life0 self,
isolation_level: IsolationLevel
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn requires_isolation_first(&self) -> bool;
// Provided methods
fn select<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Select<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Insert<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Update<'life1>
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Delete<'life1>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn server_reset_query<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 dyn Transaction
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait { ... }
fn begin_statement(&self) -> &'static str { ... }
}
Expand description
Represents a connection or a transaction that can be queried.
Required Methods§
sourcefn query<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Query<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn query<'life0, 'life1, 'async_trait>( &'life0 self, q: Query<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute the given query.
sourcefn query_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn query_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [Value<'life3>] ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,
Execute a query given as SQL, interpolating the given parameters.
sourcefn query_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn query_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [Value<'life3>] ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,
Execute a query given as SQL, interpolating the given parameters.
On Postgres, query parameters types will be inferred from the values instead of letting Postgres infer them based on their usage in the SQL query.
NOTE: This method will eventually be removed & merged into Queryable::query_raw().
sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Query<'life1>
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>( &'life0 self, q: Query<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute the given query, returning the number of affected rows.
sourcefn execute_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn execute_raw<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [Value<'life3>] ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,
Execute a query given as SQL, interpolating the given parameters and returning the number of affected rows.
sourcefn execute_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
sql: &'life1 str,
params: &'life2 [Value<'life3>]
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn execute_raw_typed<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [Value<'life3>] ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,
Execute a query given as SQL, interpolating the given parameters and returning the number of affected rows.
On Postgres, query parameters types will be inferred from the values instead of letting Postgres infer them based on their usage in the SQL query.
NOTE: This method will eventually be removed & merged into Queryable::query_raw().
sourcefn raw_cmd<'life0, 'life1, 'async_trait>(
&'life0 self,
cmd: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn raw_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Run a command in the database, for queries that can’t be run using prepared statements.
sourcefn version<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, Self: 'async_trait,
Return the version of the underlying database, queried directly from the
source. This corresponds to the version()
function on PostgreSQL for
example. The version string is returned directly without any form of
parsing or normalization.
sourcefn is_healthy(&self) -> bool
fn is_healthy(&self) -> bool
Returns false, if connection is considered to not be in a working state.
sourcefn set_tx_isolation_level<'life0, 'async_trait>(
&'life0 self,
isolation_level: IsolationLevel
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn set_tx_isolation_level<'life0, 'async_trait>( &'life0 self, isolation_level: IsolationLevel ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, Self: 'async_trait,
Sets the transaction isolation level to given value. Implementers have to make sure that the passed isolation level is valid for the underlying database.
sourcefn requires_isolation_first(&self) -> bool
fn requires_isolation_first(&self) -> bool
Signals if the isolation level SET needs to happen before or after the tx BEGIN.
Provided Methods§
sourcefn select<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Select<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn select<'life0, 'life1, 'async_trait>( &'life0 self, q: Select<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute a SELECT
query.
sourcefn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Insert<'life1>
) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn insert<'life0, 'life1, 'async_trait>( &'life0 self, q: Insert<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute an INSERT
query.
sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Update<'life1>
) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update<'life0, 'life1, 'async_trait>( &'life0 self, q: Update<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64, Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute an UPDATE
query, returning the number of affected rows.
sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
q: Delete<'life1>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>( &'life0 self, q: Delete<'life1> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute a DELETE
query.
sourcefn server_reset_query<'life0, 'life1, 'async_trait>(
&'life0 self,
_: &'life1 dyn Transaction
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn server_reset_query<'life0, 'life1, 'async_trait>( &'life0 self, _: &'life1 dyn Transaction ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,
Execute an arbitrary function in the beginning of each transaction.
sourcefn begin_statement(&self) -> &'static str
fn begin_statement(&self) -> &'static str
Statement to begin a transaction