[][src]Trait smoldb::Store

pub trait Store<T> {
    type Indicies;
    type Error;
    fn create_table(&self, table_name: &str) -> Result<(), Self::Error>;
fn insert(&self, table_name: &str, t: &T) -> Result<(), Self::Error>;
fn select(
        &self,
        table_name: &str,
        indicies: &[Self::Indicies]
    ) -> Result<Vec<T>, Self::Error>;
fn update(
        &self,
        table_name: &str,
        indicies: &[Self::Indicies],
        t: &T
    ) -> Result<(), Self::Error>;
fn delete(
        &self,
        table_name: &str,
        indicies: &[Self::Indicies]
    ) -> Result<(), Self::Error>; }

Associated Types

type Indicies

type Error

Loading content...

Required methods

fn create_table(&self, table_name: &str) -> Result<(), Self::Error>

fn insert(&self, table_name: &str, t: &T) -> Result<(), Self::Error>

fn select(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies]
) -> Result<Vec<T>, Self::Error>

fn update(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies],
    t: &T
) -> Result<(), Self::Error>

fn delete(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies]
) -> Result<(), Self::Error>

Loading content...

Implementors

impl<T> Store<T> for Connection where
    T: Storable + Serialize + DeserializeOwned,
    <T as Storable>::Indicies: ToSql + Debug
[src]

Generic store implementation for all Storable types

type Error = Error

type Indicies = <T as Storable>::Indicies

fn create_table(&self, table_name: &str) -> Result<(), Self::Error>[src]

Create a new table of the associated type with the specified name

fn insert(&self, table_name: &str, t: &T) -> Result<(), Self::Error>[src]

Insert a new object into the specified table

fn select(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies]
) -> Result<Vec<T>, Self::Error>
[src]

Select objects matching the provided indicies from the specified table

fn update(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies],
    t: &T
) -> Result<(), Self::Error>
[src]

Update an object in the specified table, matching the provided indicies

fn delete(
    &self,
    table_name: &str,
    indicies: &[Self::Indicies]
) -> Result<(), Self::Error>
[src]

Delete (an) object(s) in the specified table matching the provided indicies

Loading content...