Trait sea_orm::entity::ColumnTrait [−][src]
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
Associated Types
type EntityName: EntityName
Required methods
Provided methods
fn entity_name(&self) -> DynIden
fn entity_name(&self) -> DynIden
Get the name of the entity the column belongs to
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 between<V>(&self, a: V, b: V) -> SimpleExpr where
V: Into<Value>,
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"
);
fn not_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>,
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"
);
fn like(&self, s: &str) -> SimpleExpr
fn like(&self, s: &str) -> SimpleExpr
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'"
);
fn not_like(&self, s: &str) -> SimpleExpr
fn not_like(&self, s: &str) -> SimpleExpr
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'"
);
fn starts_with(&self, s: &str) -> SimpleExpr
fn starts_with(&self, s: &str) -> SimpleExpr
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%'"
);
fn ends_with(&self, s: &str) -> SimpleExpr
fn ends_with(&self, s: &str) -> SimpleExpr
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'"
);
fn contains(&self, s: &str) -> SimpleExpr
fn contains(&self, s: &str) -> SimpleExpr
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%'"
);
fn max(&self) -> SimpleExpr
fn max(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn min(&self) -> SimpleExpr
fn min(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn sum(&self) -> SimpleExpr
fn sum(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn count(&self) -> SimpleExpr
fn count(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn is_null(&self) -> SimpleExpr
fn is_null(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn is_not_null(&self) -> SimpleExpr
fn is_not_null(&self) -> SimpleExpr
See also SeaQuery’s method with same name.
fn if_null<V>(&self, v: V) -> SimpleExpr where
V: Into<Value>,
fn if_null<V>(&self, v: V) -> SimpleExpr where
V: Into<Value>,
Perform an operation if the column is null