Skip to main content

DbClient

Trait DbClient 

Source
pub trait DbClient: Send + Sync {
    // Required methods
    fn get(
        &self,
        connection: &Value,
        table: &str,
        columns: &[&str],
        where_clause: Option<&str>,
    ) -> Option<Vec<HashMap<String, Value>>>;
    fn set(
        &self,
        connection: &Value,
        table: &str,
        values: &HashMap<String, Value>,
        where_clause: Option<&str>,
    ) -> bool;
    fn delete(
        &self,
        connection: &Value,
        table: &str,
        where_clause: Option<&str>,
    ) -> bool;
}
Expand description

Relational DB client. Do NOT call State inside DbClient — it would cause recursion. connection is a Value::Object resolved from the manifest. columns are extracted from the manifest map definition.

Required Methods§

Source

fn get( &self, connection: &Value, table: &str, columns: &[&str], where_clause: Option<&str>, ) -> Option<Vec<HashMap<String, Value>>>

Source

fn set( &self, connection: &Value, table: &str, values: &HashMap<String, Value>, where_clause: Option<&str>, ) -> bool

Source

fn delete( &self, connection: &Value, table: &str, where_clause: Option<&str>, ) -> bool

Implementors§