Skip to content

0.28.0

Compare
Choose a tag to compare
@tyt2y3 tyt2y3 released this 09 Dec 09:13

New Features

  • New struct FunctionCall which hold function and arguments #475
  • New trait IdenStatic with method fn as_str(&self) -> &'static str #508
  • New traits PgExpr and SqliteExpr for custom expressions #519
  • Support BigDecimal, IpNetwork and MacAddress for sea-query-postgres #503

API Additions

  • Added SelectStatement::from_function #475
  • Added binary operators from the Postgres pg_trgm extension #486
  • Added ILIKE and NOT ILIKE operators #473
  • Added the mul and div methods for SimpleExpr #510
  • Added the MATCH, -> and ->> operators for SQLite #513
  • Added the FULL OUTER JOIN #497
  • Added PgFunc::get_random_uuid #530
  • Added SimpleExpr::eq, SimpleExpr::ne, Expr::not_equals #528
  • Added PgFunc::starts_with #529
  • Added Expr::custom_keyword and SimpleExpr::not #535
  • Added SimpleExpr::like, SimpleExpr::not_like and Expr::cast_as #539
  • Added support for NULLS NOT DISTINCT clause for Postgres #532
  • Added Expr::cust_with_expr and Expr::cust_with_exprs #531
  • Added support for converting &String to Value #537

Enhancements

  • Made value::with_array module public and therefore making NotU8 trait public #511
  • Drop the Sized requirement on implementers of SchemaBuilders #524

Bug fixes

  • Wrap unions into parenthesis #498
  • Syntax error on empty condition #505
// given
let (statement, values) = sea_query::Query::select()
    .column(Glyph::Id)
    .from(Glyph::Table)
    .cond_where(Cond::any()
        .add(Cond::all()) // empty all() => TRUE
        .add(Cond::any()) // empty any() => FALSE
    )
    .build(sea_query::MysqlQueryBuilder);

// old behavior
assert_eq!(statement, r#"SELECT `id` FROM `glyph`"#);

// new behavior
assert_eq!(
    statement,
    r#"SELECT `id` FROM `glyph` WHERE (TRUE) OR (FALSE)"#
);

Breaking changes

  • MSRV is up to 1.62 #535
  • ColumnType::Array definition changed from Array(SeaRc<Box<ColumnType>>) to Array(SeaRc<ColumnType>) #492
  • Func::* now returns FunctionCall instead of SimpleExpr #475
  • Func::coalesce now accepts IntoIterator<Item = SimpleExpr> instead of IntoIterator<Item = Into<SimpleExpr> #475
  • Removed Expr::arg and Expr::args - these functions are no longer needed #475
  • Moved all Postgres specific operators to PgBinOper #507
  • Expr::value, Expr::gt, Expr::gte, Expr::lt, Expr::lte, Expr::add, Expr::div, Expr::sub, Expr::modulo, Expr::left_shift, Expr::right_shift, Expr::between, Expr::not_between, Expr::is, Expr::is_not, Expr::if_null now accepts Into<SimpleExpr> instead of Into<Value> #476
  • Expr::is_in, Expr::is_not_in now accepts Into<SimpleExpr> instead of Into<Value> and convert it to SimpleExpr::Tuple instead of SimpleExpr::Values #476
  • Expr::expr now accepts Into<SimpleExpr> instead of SimpleExpr #475
  • Moved Expr::ilike, Expr::not_ilike, Expr::matches, Expr::contains, Expr::contained, Expr::concatenate, Expr::concat, SimpleExpr::concatenate and SimpleExpr::concat to new trait PgExpr #519
  • Expr::equals now accepts C: IntoColumnRef instead of T: IntoIden, C: IntoIden #528
  • Removed integer and date time column types' display length / precision option #525

Deprecations

  • Deprecated Expr::greater_than, Expr::greater_or_equal, Expr::less_than and Expr::less_or_equal #476
  • Deprecated SimpleExpr::equals, SimpleExpr::not_equals #528
  • Deprecated Expr::tbl, please use Expr::col with a tuple #540

House keeping

  • Replace impl Default with #[derive(Default)] #535
  • Exclude sqlx default features #543
  • Use dtolnay/rust-toolchain instead of actions-rs/toolchain in CI #544

Full Changelog: 0.27.0...0.28.0