logo
pub trait ColumnTrait: IdenStatic + Iterable + FromStr {
    type EntityName: EntityName;

Show 27 methods fn def(&self) -> ColumnDef; fn entity_name(&self) -> DynIden { ... } fn as_column_ref(&self) -> (DynIden, DynIden) { ... } fn eq<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn ne<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn gt<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn gte<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn lt<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn lte<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn between<V>(&self, a: V, b: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn not_between<V>(&self, a: V, b: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn like(&self, s: &str) -> SimpleExpr { ... } fn not_like(&self, s: &str) -> SimpleExpr { ... } fn starts_with(&self, s: &str) -> SimpleExpr { ... } fn ends_with(&self, s: &str) -> SimpleExpr { ... } fn contains(&self, s: &str) -> SimpleExpr { ... } fn max(&self) -> SimpleExpr { ... } fn min(&self) -> SimpleExpr { ... } fn sum(&self) -> SimpleExpr { ... } fn count(&self) -> SimpleExpr { ... } fn is_null(&self) -> SimpleExpr { ... } fn is_not_null(&self) -> SimpleExpr { ... } fn if_null<V>(&self, v: V) -> SimpleExpr
    where
        V: Into<Value>
, { ... } fn is_in<V, I>(&self, v: I) -> SimpleExpr
    where
        V: Into<Value>,
        I: IntoIterator<Item = V>
, { ... } fn is_not_in<V, I>(&self, v: I) -> SimpleExpr
    where
        V: Into<Value>,
        I: IntoIterator<Item = V>
, { ... } fn in_subquery(&self, s: SelectStatement) -> SimpleExpr { ... } fn not_in_subquery(&self, s: SelectStatement) -> SimpleExpr { ... }
}
Expand description

Wrapper of the identically named method in sea_query::Expr

Required Associated Types

Required Methods

Define a column for an Entity

Provided Methods

Get the name of the entity the column belongs to

get the name of the entity the column belongs to

use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Id.between(2, 3))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` BETWEEN 2 AND 3"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Id.not_between(2, 3))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` NOT BETWEEN 2 AND 3"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Name.like("cheese"))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`name` LIKE 'cheese'"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Name.not_like("cheese"))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`name` NOT LIKE 'cheese'"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Name.starts_with("cheese"))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`name` LIKE 'cheese%'"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Name.ends_with("cheese"))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`name` LIKE '%cheese'"
);
use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};

assert_eq!(
    cake::Entity::find()
        .filter(cake::Column::Name.contains("cheese"))
        .build(DbBackend::MySql)
        .to_string(),
    "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`name` LIKE '%cheese%'"
);

See also SeaQuery’s method with same name.

See also SeaQuery’s method with same name.

See also SeaQuery’s method with same name.

See also SeaQuery’s method with same name.

See also SeaQuery’s method with same name.

See also SeaQuery’s method with same name.

Perform an operation if the column is null

Implementors