Skip to content

Commit

Permalink
Add doc test
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Feb 7, 2023
1 parent ff1536f commit 2d82347
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,29 @@ impl Func {
/// r#"SELECT LOWER("character") FROM "character""#
/// );
/// ```
///
/// ```
/// use sea_query::{tests_cfg::*, *};
///
/// let query = Query::select()
/// .column(Font::Id)
/// .from(Font::Table)
/// .and_where(Expr::expr(Func::lower(Expr::col(Font::Name))).eq("abc".trim().to_lowercase()))
/// .take();
///
/// assert_eq!(
/// query.to_string(MysqlQueryBuilder),
/// "SELECT `id` FROM `font` WHERE LOWER(`name`) = 'abc'"
/// );
/// assert_eq!(
/// query.to_string(PostgresQueryBuilder),
/// r#"SELECT "id" FROM "font" WHERE LOWER("name") = 'abc'"#
/// );
/// assert_eq!(
/// query.to_string(SqliteQueryBuilder),
/// r#"SELECT "id" FROM "font" WHERE LOWER("name") = 'abc'"#
/// );
/// ```
pub fn lower<T>(expr: T) -> FunctionCall
where
T: Into<SimpleExpr>,
Expand Down

0 comments on commit 2d82347

Please sign in to comment.