Skip to content

Commit a8184da

Browse files
committed
Add example
1 parent a45318c commit a8184da

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/expr.rs

+23
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,29 @@ impl Expr {
267267
/// r#"SELECT "character", "size_w", "size_h" FROM "character" WHERE IFNULL("size_w", 0) > 2"#
268268
/// );
269269
/// ```
270+
///
271+
/// ```
272+
/// use sea_query::{tests_cfg::*, *};
273+
///
274+
/// let query = Query::select()
275+
/// .column(Char::Character)
276+
/// .from(Char::Table)
277+
/// .and_where(Expr::expr(Func::lower(Expr::col(Char::Character))).is_in(["a", "b"]))
278+
/// .to_owned();
279+
///
280+
/// assert_eq!(
281+
/// query.to_string(MysqlQueryBuilder),
282+
/// r#"SELECT `character` FROM `character` WHERE LOWER(`character`) IN ('a', 'b')"#
283+
/// );
284+
/// assert_eq!(
285+
/// query.to_string(PostgresQueryBuilder),
286+
/// r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
287+
/// );
288+
/// assert_eq!(
289+
/// query.to_string(SqliteQueryBuilder),
290+
/// r#"SELECT "character" FROM "character" WHERE LOWER("character") IN ('a', 'b')"#
291+
/// );
292+
/// ```
270293
#[allow(clippy::self_named_constructors)]
271294
pub fn expr<T>(expr: T) -> Self
272295
where

0 commit comments

Comments
 (0)