use super::create_meta::CreateMeta;
use super::{Load, Register};
use crate::stmt::{Expr, IntoExpr, IntoInsert, List, Path};
use toasty_core::schema::app::FieldId;
pub trait Model: Register + Load<Output = Self> + Sized {
type Query;
type Create: Default + IntoInsert<Model = Self> + IntoExpr<Self>;
type Update<'a>;
type UpdateQuery;
type Path<Origin>;
type PrimaryKey;
type Many;
type ViaMany;
type ManyField<Origin>;
type One;
type ViaOne;
type OneField<Origin>;
type OptionOne;
type ViaOptionOne;
const CREATE_META: CreateMeta;
fn new_path<Origin>(path: Path<Origin, Self>) -> Self::Path<Origin>;
fn new_root_path() -> Self::Path<Self> {
Self::new_path(Path::root())
}
fn new_create() -> Self::Create {
Self::Create::default()
}
fn new_many_field<Origin>(path: Path<Origin, List<Self>>) -> Self::ManyField<Origin>;
fn field_name_to_id(name: &str) -> FieldId;
fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query;
}