use crate::*;
use sqlx_core::database::Database;
#[derive(Debug)]
pub struct Turso;
impl Database for Turso {
type Connection = TursoConnection;
type TransactionManager = TursoTransactionManager;
type Row = TursoRow;
type QueryResult = TursoQueryResult;
type Column = TursoColumn;
type TypeInfo = TursoTypeInfo;
type Value = TursoValue;
type ValueRef<'r> = TursoValueRef<'r>;
type Arguments = TursoArguments;
type ArgumentBuffer = Vec<turso::Value>;
type Statement = TursoStatement;
const NAME: &'static str = "Turso";
const URL_SCHEMES: &'static [&'static str] = &["file", "turso-memory"];
}
#[derive(Debug, Default)]
pub struct TursoQueryResult {
pub(crate) rows_affected: u64,
}
impl TursoQueryResult {
pub fn rows_affected(&self) -> u64 {
self.rows_affected
}
}
impl Extend<Self> for TursoQueryResult {
fn extend<T: IntoIterator<Item = Self>>(&mut self, iter: T) {
for result in iter {
self.rows_affected += result.rows_affected;
}
}
}