Skip to main content

SqlStore

Trait SqlStore 

Source
pub trait SqlStore<Op, Event: RoutableEvent>: Store<Op, ProcessorError<BoxError>, Event> {
    // Required methods
    fn query<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        sql: &'life1 str,
        params: &'life2 [DbValue],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DbRow>, DbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn dialect(&self) -> SqlDialect;
}
Expand description

A Store backed by SQL, adding ad-hoc reads.

The inherited Store surface (exec) always errors as the SQL engine’s ProcessorError<BoxError>, so it’s pinned in the supertrait bound rather than left as a parameter. query reports its own DbError instead.

Required Methods§

Source

fn query<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, sql: &'life1 str, params: &'life2 [DbValue], ) -> Pin<Box<dyn Future<Output = Result<Vec<DbRow>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Run a read-only query against the backend.

Source

fn dialect(&self) -> SqlDialect

The backend’s SQL dialect — lets a caller build dialect-correct SQL (placeholder style, quoting) to hand back to query.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<R: Reducer, D: Db, T: LogTracker<R::Op>> SqlStore<<R as Reducer>::Op, <R as Reducer>::Event> for Processor<R, D, T, EventBus<R::Event>>
where R::Event: RoutableEvent, R::Error: Error + Send + Sync + 'static, <R::Event as RoutableEvent>::Target: Send + Sync,