1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
use super::*;
/// Generic trait to be implemented by SQL drivers (or more likely by proxy to SQL drivers) so that the
/// functionalities provided by this crate can be leveraged
pub trait QueryTrait<R>
where R: Row,
{
/*
fn query_first<T, P, R, F>(&mut self, query: &str, params: P, f: F) -> Result<Option<T>>
where P: Params,
R: Row,
F: FnOnce(&R) -> Result<T>;
*/
fn query_row(&mut self, query: &str) -> Result<Vec<R>>;
/*
{
self.query_row_with_params(query, ())
}
fn query_row_with_params<P>(&mut self, query: &str, params: P) -> Result<Vec<R>>
where P: Params;
*/
}
/*
pub trait Row {
fn get_string(&self, i: usize) -> Result<Option<String>>;
fn get_i64(&self, i: usize) -> Result<Option<i64>>;
}
*/
/*
struct Value<T>
where T: FromValue
{
value: T,
}
pub trait FromValue {
fn as_string(&self) -> Option<String>;
fn as_i64(&self) -> Option<i64>;
}
#[cfg(attribute = "sqlite")]
impl FromValue for ::rusqlite::types::FromSql {
*/
/*
pub struct Value<T>
where T: FromValue,
{
t: T,
}
pub trait FromValue<T> {
fn from(t: T) -> Result<Self>;
}
#[cfg(feature = "sqlite")]
impl FromValue<T: rusqlite::types::ValueRef<'_>> for String {
fn from(t: T) -> Result<Self> { Ok(rusqlite::types::FromSql::column_result(t)?) }
}
*/