pub trait ReadContext {
    fn execute_query<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 mut self,
        statement: &'life1 str,
        parameters: &'life2 [(&'life3 str, &'life4 (dyn ToSpanner + Sync))]
    ) -> Pin<Box<dyn Future<Output = Result<ResultSet, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        'life4: 'async_trait,
        Self: 'async_trait
; }
Expand description

Defines the interface to read data out of Cloud Spanner.

Required Methods

Execute a read-only SQL statement and returns a ResultSet.

Parameters

As per the Cloud Spanner documentation, the statement may contain named parameters, e.g.: @param_name. When such parameters are present in the SQL query, their value must be provided in the second argument to this function.

See ToSpanner to determine how Rust values can be mapped to Cloud Spanner values.

If the parameter values do not line up with parameters in the statement, an Error is returned.

Example
let my_id = 42;
let rs = client.read_only().execute_query(
   "SELECT id FROM person WHERE id > @my_id",
   &[("my_id", &my_id)],
).await?;
for row in rs.iter() {
   let id: u32 = row.get("id")?;
   println!("id: {}", id);
}

Implementors