Skip to main content

Backend

Trait Backend 

Source
pub trait Backend {
    // Required methods
    fn dialect(&self) -> Dialect;
    fn exec(&self, sql: &str, params: &[Value]) -> Result<u64>;
    fn query(&self, sql: &str, params: &[Value]) -> Result<Vec<Row>>;
}
Expand description

A pluggable, synchronous storage backend.

Object-safe on purpose: primitives take &dyn Backend, so a single compiled primitive serves every backend.

Required Methods§

Source

fn dialect(&self) -> Dialect

The dialect this backend speaks.

Source

fn exec(&self, sql: &str, params: &[Value]) -> Result<u64>

Run a statement, returning the number of rows affected.

Source

fn query(&self, sql: &str, params: &[Value]) -> Result<Vec<Row>>

Run a query, returning all rows. Also used for RETURNING statements.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§