Skip to content

Commit

Permalink
Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Apr 18, 2024
1 parent a45318c commit a8184da
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,29 @@ impl Expr {
/// r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE IFNULL("size_w", 0) > 2"#
/// );
/// ```
///
/// ```
/// use sea_query::{tests_cfg::*, *};
///
/// let query = Query::select()
/// .column(Char::Character)
/// .from(Char::Table)
/// .and_where(Expr::expr(Func::lower(Expr::col(Char::Character))).is_in(["a", "b"]))
/// .to_owned();
///
/// assert_eq!(
/// query.to_string(MysqlQueryBuilder),
/// r#"SELECT `character` FROM `character` WHERE LOWER(`character`) IN ('a', 'b')"#
/// );
/// assert_eq!(
/// query.to_string(PostgresQueryBuilder),
/// r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
/// );
/// assert_eq!(
/// query.to_string(SqliteQueryBuilder),
/// r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
/// );
/// ```
#[allow(clippy::self_named_constructors)]
pub fn expr<T>(expr: T) -> Self
where
Expand Down

0 comments on commit a8184da

Please sign in to comment.