Add examples
This commit is contained in:
parent
23523f0aac
commit
b14c143110
@ -718,6 +718,35 @@ pub trait QueryFilter: Sized {
|
||||
/// );
|
||||
/// ```
|
||||
///
|
||||
/// Like above, but using the `IN` operator.
|
||||
///
|
||||
/// ```
|
||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
|
||||
///
|
||||
/// assert_eq!(
|
||||
/// cake::Entity::find()
|
||||
/// .filter(cake::Column::Id.is_in([4, 5]))
|
||||
/// .build(DbBackend::MySql)
|
||||
/// .to_string(),
|
||||
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` IN (4, 5)"
|
||||
/// );
|
||||
/// ```
|
||||
///
|
||||
/// Like above, but using the `ANY` operator. Postgres only.
|
||||
///
|
||||
/// ```
|
||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
|
||||
/// use sea_orm::sea_query::{Expr, extension::postgres::PgFunc};
|
||||
///
|
||||
/// assert_eq!(
|
||||
/// cake::Entity::find()
|
||||
/// .filter(Expr::col((cake::Entity, cake::Column::Id)).eq(PgFunc::any(vec![4, 5])))
|
||||
/// .build(DbBackend::Postgres)
|
||||
/// .to_string(),
|
||||
/// r#"SELECT "cake"."id", "cake"."name" FROM "cake" WHERE "cake"."id" = ANY(ARRAY [4,5])"#
|
||||
/// );
|
||||
/// ```
|
||||
///
|
||||
/// Add a runtime-built condition tree.
|
||||
/// ```
|
||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
|
||||
|
Loading…
x
Reference in New Issue
Block a user