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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: '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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn execute<'life0, 'life1, 'async_trait>( &'life0 self, q: Query<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: '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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait; fn raw_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn insert<'life0, 'life1, 'async_trait>( &'life0 self, q: Insert<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn update<'life0, 'life1, 'async_trait>( &'life0 self, q: Update<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn delete<'life0, 'life1, 'async_trait>( &'life0 self, q: Delete<'life1> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn server_reset_query<'life0, 'life1, 'async_trait>( &'life0 self, _: &'life1 dyn Transaction ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn begin_statement(&self) -> &'static str { ... }
}
Expand description

Represents a connection or a transaction that can be queried.

Required Methods§

source

fn query<'life0, 'life1, 'async_trait>( &'life0 self, q: Query<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the given query.

source

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>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute a query given as SQL, interpolating the given parameters.

source

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>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: '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().

source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, q: Query<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the given query, returning the number of affected rows.

source

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>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Execute a query given as SQL, interpolating the given parameters and returning the number of affected rows.

source

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>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: '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().

source

fn raw_cmd<'life0, 'life1, 'async_trait>( &'life0 self, cmd: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run a command in the database, for queries that can’t be run using prepared statements.

source

fn version<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: '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.

source

fn is_healthy(&self) -> bool

Returns false, if connection is considered to not be in a working state.

source

fn set_tx_isolation_level<'life0, 'async_trait>( &'life0 self, isolation_level: IsolationLevel ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: '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.

source

fn requires_isolation_first(&self) -> bool

Signals if the isolation level SET needs to happen before or after the tx BEGIN.

Provided Methods§

source

fn select<'life0, 'life1, 'async_trait>( &'life0 self, q: Select<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a SELECT query.

source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, q: Insert<'life1> ) -> Pin<Box<dyn Future<Output = Result<ResultSet>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an INSERT query.

source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, q: Update<'life1> ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an UPDATE query, returning the number of affected rows.

source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, q: Delete<'life1> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a DELETE query.

source

fn server_reset_query<'life0, 'life1, 'async_trait>( &'life0 self, _: &'life1 dyn Transaction ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute an arbitrary function in the beginning of each transaction.

source

fn begin_statement(&self) -> &'static str

Statement to begin a transaction

Implementors§