ColumnDef TODO
This commit is contained in:
parent
5c3bd08b99
commit
60fd9061bd
@ -2,6 +2,14 @@ use crate::{EntityName, IdenStatic, Iterable};
|
||||
pub use sea_query::ColumnType;
|
||||
use sea_query::{DynIden, Expr, SeaRc, SimpleExpr, Value};
|
||||
|
||||
// TODO: ColumnDef with builder API to replace sea_query::ColumnType in Entity def
|
||||
pub struct ColumnDef {
|
||||
pub(crate) col_type: ColumnType,
|
||||
pub(crate) not_null: bool,
|
||||
pub(crate) unique: bool,
|
||||
pub(crate) indexed: bool,
|
||||
}
|
||||
|
||||
macro_rules! bind_oper {
|
||||
( $op: ident ) => {
|
||||
fn $op<V>(&self, v: V) -> SimpleExpr
|
||||
@ -40,10 +48,6 @@ pub trait ColumnTrait: IdenStatic + Iterable {
|
||||
|
||||
fn def(&self) -> ColumnType;
|
||||
|
||||
// we may add more:
|
||||
// fn indexed(&self) -> bool;
|
||||
// fn unique(&self) -> bool;
|
||||
|
||||
fn entity_name(&self) -> DynIden {
|
||||
SeaRc::new(Self::EntityName::default()) as DynIden
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::{ColumnTrait, IdenStatic, Iterable};
|
||||
|
||||
//LINT: composite primary key cannot auto increment
|
||||
pub trait PrimaryKeyTrait: IdenStatic + Iterable {
|
||||
fn auto_increment() -> bool;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user