Skip to main content

SqlRead

Trait SqlRead 

Source
pub trait SqlRead {
    // Required methods
    fn query_row<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<T>
       where P: Params,
             F: FnOnce(&Row<'_>) -> Result<T>;
    fn query<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<Vec<T>>
       where P: Params,
             F: FnMut(&Row<'_>) -> Result<T>;
}
Expand description

Ordinary SQL reads through a read context or a write’s, so code that reads the same way inside a write and outside one is written once. Inside a write it sees the write’s own changes.

Required Methods§

Source

fn query_row<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<T>
where P: Params, F: FnOnce(&Row<'_>) -> Result<T>,

Map the first result row.

Source

fn query<T, P, F>(&self, sql: &str, params: P, map: F) -> Result<Vec<T>>
where P: Params, F: FnMut(&Row<'_>) -> Result<T>,

Map all result rows.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§