luncheon 0.2.11

A library to make working with SQLITE in a more typed and traited way
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rusqlite::ToSql;

use crate::{Database, Res, Table};


/// ?1 must be the id and ?2 must be the value
pub trait Update<I: PartialEq + ToSql, E: ToSql>
where
    Self: Table,
{
    const UPDATE: &str;

    fn update(database: &Database, id: I, new_value: E) -> Res<()> {
        let mut conn = database.prepare_writer(Self::UPDATE)?;
        conn.execute((id, new_value))?;
        Ok(())
    }
}