use super::{Load, Model};
use toasty_core::schema::Name;
use toasty_core::schema::app::{FieldId, FieldTy, ForeignKey};
use toasty_core::stmt;
pub enum Direct {}
pub enum Via {}
pub trait RelationManyField: Load<Output = Self> {
type Model: Model;
const DEFERRED: bool;
const NULLABLE: bool = false;
fn reload(target: &mut Self, value: stmt::Value) -> crate::Result<()>;
fn many_relation_field_ty(
singular: Name,
pair: Option<FieldId>,
via: Option<stmt::Path>,
) -> FieldTy;
}
pub trait RelationOneField: Load<Output = Self> {
type Model: Model;
type One;
type ViaOne;
type Expr;
const DEFERRED: bool;
const NULLABLE: bool;
fn reload(target: &mut Self, value: stmt::Value) -> crate::Result<()>;
fn has_one_relation_field_ty(pair: Option<FieldId>, via: Option<stmt::Path>) -> FieldTy;
fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy;
}