Skip to content

Commit

Permalink
Cast enums in lt, lte, gt, gte (revert 10f3de0, discussed under SeaQL…
Browse files Browse the repository at this point in the history
  • Loading branch information
Expurple committed Dec 17, 2023
1 parent 0ad6c2f commit afce5da
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions src/entity/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ pub struct ColumnDef {
}

macro_rules! bind_oper {
( $op: ident ) => {
#[allow(missing_docs)]
fn $op<V>(&self, v: V) -> SimpleExpr
where
V: Into<Value>,
{
Expr::col((self.entity_name(), *self)).$op(v)
}
};
}

macro_rules! bind_oper_with_enum_casting {
( $op: ident, $bin_op: ident ) => {
#[allow(missing_docs)]
fn $op<V>(&self, v: V) -> SimpleExpr
Expand Down Expand Up @@ -97,12 +85,12 @@ pub trait ColumnTrait: IdenStatic + Iterable + FromStr {
(self.entity_name(), SeaRc::new(*self) as DynIden)
}

bind_oper_with_enum_casting!(eq, Equal);
bind_oper_with_enum_casting!(ne, NotEqual);
bind_oper!(gt);
bind_oper!(gte);
bind_oper!(lt);
bind_oper!(lte);
bind_oper!(eq, Equal);
bind_oper!(ne, NotEqual);
bind_oper!(gt, GreaterThan);
bind_oper!(gte, GreaterThanOrEqual);
bind_oper!(lt, SmallerThan);
bind_oper!(lte, SmallerThanOrEqual);

/// ```
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
Expand Down

0 comments on commit afce5da

Please sign in to comment.