Skip to content

Releases: SeaQL/sea-query

0.28.5

11 May 09:16
Compare
Choose a tag to compare
  • Added implementation SqlxBinder, RusqliteBinder and PostgresBinder for WithQuery #580
    • sea-query-binder 0.3.1
    • sea-query-postgres 0.2.1
    • sea-query-rusqlite 0.2.1

0.28.4

11 Apr 06:55
Compare
Choose a tag to compare

Bug fixes

  • Fix quoted string bug while inserting array of strings to Postgres #576
  • Added comma if multiple names are passed to TypeDropStatement #623

0.28.3

18 Jan 11:03
Compare
Choose a tag to compare

Enhancements

  • Added getter for the UpdateStatement::values field #578
  • Implements PartialEq for ColumnType #579
  • Added helper function to construct ColumnType::Custom #579

0.28.2

04 Jan 06:56
Compare
Choose a tag to compare

Enhancements

  • Added Cow<str> conversion to Value #550
  • Added convert various UUID defined in uuid::fmt module into sea_query::Value::Uuid #563

0.28.1

29 Dec 06:46
Compare
Choose a tag to compare

Bug fixes

  • Fixes Postgres GEN_RANDOM_UUID #568

0.28.0

09 Dec 09:13
Compare
Choose a tag to compare

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

0.27.2

14 Nov 07:46
Compare
Choose a tag to compare
  • Made value::with_array module public and therefore making NotU8 trait public #511

0.27.1

18 Oct 15:15
Compare
Choose a tag to compare
  • Fix consecutive spacing on schema statements #481
  • SQLite bind rust_decimal & bigdecimal as f64 #480

0.27.0

16 Oct 14:09
Compare
Choose a tag to compare

New Features

  • Support CROSS JOIN #376
  • We are going through series of changes to how database drivers work
    (#416, #423):
    1. sea-query-binder is now the recommended way (trait based) of working with SQLx, replacing sea-query-driver (macro based) #434
    2. sea-query-binder is now a separate dependency, instead of integrated with sea-query #432
    3. rusqlite support is moved to sea-query-rusqlite #422
    4. postgres support is moved to sea-query-postgres #433
  • Added sub-query operators: EXISTS, ALL, ANY, SOME #379
  • Added support to ON CONFLICT WHERE #447
  • Added support DROP COLUMN for SQLite #455
  • Added YEAR, BIT and VARBIT types #466
  • Added support one dimension Postgres array for SQLx #467

Enhancements

  • Handle Postgres schema name for schema statements #385
  • Added %, << and >> binary operators #419
  • Added RAND function #430
  • Implements Display for Value #425
  • Added INTERSECT and EXCEPT to UnionType #438
  • Added OnConflict::value and OnConflict::values #451
  • ColumnDef::default now accepts both Value and SimpleExpr #436
  • OrderedStatement::order_by_customs, OrderedStatement::order_by_columns, OverStatement::partition_by_customs, OverStatement::partition_by_columns now accepts IntoIterator<Item = T> instead of Vec<T> #448
  • Expr::case, CaseStatement::case and CaseStatement::finally now accepts Into<SimpleExpr> instead of Into<Expr> #460
  • UpdateStatement::value now accept Into<SimpleExpr> instead of Into<Value> #460
  • TableAlterStatement::rename_column, TableAlterStatement::drop_column, ColumnDef::new, ColumnDef::new_with_type now accepts IntoIden instead of Iden #472

Bug Fixes

  • distinct_on properly handles ColumnRef #450
  • Removed ON for DROP INDEX for SQLite #462
  • Change datetime string format to include microseconds #468
  • ALTER TABLE for PosgreSQL with UNIQUE constraint #472

Breaking changes

  • Changed in_tuples interface to accept IntoValueTuple #386
  • Removed deprecated methods (or_where, or_having, table_column etc) #380
  • Changed cond_where chaining semantics #417
// Before: will extend current Condition
assert_eq!(
    Query::select()
        .cond_where(any![Expr::col(Glyph::Id).eq(1), Expr::col(Glyph::Id).eq(2)])
        .cond_where(Expr::col(Glyph::Id).eq(3))
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 1 OR "id" = 2 OR "id" = 3"#
);
// Before: confusing, since it depends on the order of invocation:
assert_eq!(
    Query::select()
        .cond_where(Expr::col(Glyph::Id).eq(3))
        .cond_where(any![Expr::col(Glyph::Id).eq(1), Expr::col(Glyph::Id).eq(2)])
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 3 AND ("id" = 1 OR "id" = 2)"#
);
// Now: will always conjoin with `AND`
assert_eq!(
    Query::select()
        .cond_where(Expr::col(Glyph::Id).eq(1))
        .cond_where(any![Expr::col(Glyph::Id).eq(2), Expr::col(Glyph::Id).eq(3)])
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE "id" = 1 AND ("id" = 2 OR "id" = 3)"#
);
// Now: so they are now equivalent
assert_eq!(
    Query::select()
        .cond_where(any![Expr::col(Glyph::Id).eq(2), Expr::col(Glyph::Id).eq(3)])
        .cond_where(Expr::col(Glyph::Id).eq(1))
        .to_owned()
        .to_string(PostgresQueryBuilder),
    r#"SELECT WHERE ("id" = 2 OR "id" = 3) AND "id" = 1"#
);
  • CURRENT_TIMESTAMP changed from being a function to keyword #441
  • Update SQLite boolean type from integer to boolean #400
  • Changed type of ColumnType::Enum from (String, Vec<String>) to: #435
Enum {
    name: DynIden,
    variants: Vec<DynIden>,
}
  • Deprecated InsertStatement::exprs, InsertStatement::exprs_panic, OnConflict::update_value, OnConflict::update_values, OnConflict::update_expr, OnConflict::update_exprs, UpdateStatement::col_expr, UpdateStatement::value_expr, UpdateStatement::exprs #460
  • InsertStatement::values, UpdateStatement::values now accepts IntoIterator<Item = SimpleExpr> instead of IntoIterator<Item = Value> #460
  • Use native api from SQLx for SQLite to work with time #412

House keeping

  • Cleanup IndexBuilder trait methods #426
  • Introduce SqlWriter trait #436
  • Remove unneeded vec! from examples #448

Upgrades

  • Upgrade sqlx driver to 0.6.1

Contributors

Full Changelog: 0.26.0...0.27.0

0.26.4

13 Oct 15:19
Compare
Choose a tag to compare

New Features

  • Added support DROP COLUMN for SQLite #455

Bug Fixes

  • Removed ON for DROP INDEX for SQLite #462
  • Changed datetime display format to include microseconds #468