use construe::StrConstrue;
use crate::Table;
use crate::table::TableDef;
pub trait Schema {
type Tables: TableList;
const DEFINITIONS: &'static [TableDef];
const CREATE: &'static str;
}
pub const fn define<const N: usize>(mut tables: &[&str]) -> StrConstrue<N> {
let mut sc = StrConstrue::new();
sc = sc.push_str("BEGIN TRANSACTION;\n");
while let [table, rest @ ..] = tables {
sc = sc.push_str(table);
sc = sc.push_str("\n");
tables = rest;
}
sc.push_str("END TRANSACTION;\n")
}
pub trait TableList: private::Sealed {}
impl<T: Table> TableList for (T, ) {}
impl<T: Table, L: TableList> TableList for (T, L) {}
mod private {
use super::*;
pub trait Sealed {}
impl<T: Table> Sealed for (T, ) {}
impl<T: Table, L: TableList> Sealed for (T, L) {}
}