Releases: SeaQL/sea-query
Releases · SeaQL/sea-query
0.29.1
Versions
sea-query
/0.29.0-rc.1
: 2023-03-22sea-query
/0.29.0
(Yanked)sea-query
/0.29.1
: 2023-07-12sea-query-binder
/0.4.0
sea-query-postgres
/0.3.0
sea-query-rusqlite
/0.3.0
New Features
- Added
ValueTuple::Many
for tuple with length up to 12 #564 - Added
CREATE TABLE CHECK
constraints #567 - Added support generated column spec #581
- Added
BIT_AND
,BIT_OR
functions #582 - Added implementation
SqlxBinder
,RusqliteBinder
andPostgresBinder
forWithQuery
#580 - Added new type
Asteriks
#596 - Added
IF NOT EXISTS
forDROP INDEX
in Postgres and Sqlite #610 - Added
->
and->>
operators for Postgres #617 - Added
TableCreateStatement::set_extra
andTableCreateStatement::get_extra
#611 - Added
TableCreateStatement::comment
andColumnDef::comment
for MySQL comments #622 - Added
PgExpr::get_json_field
andPgExpr::cast_json_field
methods for constructing Postgres JSON expressions #630 - Added
PgBinOper::Regex
andPgBinOper::RegexCaseInsensitive
for Postgres Regex operators - Added
BinOper::Custom
for defining custom binary operators - Added
GLOB
operator for Sqlite #651 - Added
CREATE or DROP EXTENSION
statements for Postgres #616 - Added a feature flag
hashable-value
, which willimpl Hash for Value
; when enabled,Value::Float(NaN) == Value::Float(NaN)
would be true #598 - Added
PgBinOper::Overlap
for Postgres operators #653
Enhancements
- Implemented
PartialEq
forDynIden
,SimpleExpr
and related types #620
Breaking changes
- Removed variants
Four, Five, Six
fromenum ValueTuple
as part of #564 - Removed
Expr::tbl
,Expr::greater_than
,Expr::greater_or_equal
,Expr::less_than
,Expr::less_or_equal
,Expr::into_simple_expr
#551 - Removed
SimpleExpr::equals
andSimpleExpr::not_equals
#551 - Removed
InsertStatement::exprs
,InsertStatement::exprs_panic
#551 - Removed
OnConflict::update_value
,OnConflict::update_values
,OnConflict::update_expr
,OnConflict::update_exprs
#551 - Removed
UpdateStatement::exprs
,UpdateStatement::col_expr
,UpdateStatement::value_expr
#551 BigInteger
now maps tobigint
instead ofinteger
on SQLite #556Table::truncate
now panic for Sqlite #590- Deprecated
Expr::asteriks
andExpr::table_asteriks
#596 Expr::cust
,Expr::cust_with_values
,Expr::cust_with_expr
,Expr::cust_with_exprs
,TableForeignKey::name
,ForeignKeyCreateStatement::name
,ForeignKeyDropStatement::name
,TableIndex::name
,IndexCreateStatement::name
,IndexDropStatement::name
,SqlWriterValues::new
,ColumnType::custom
,TableCreateStatement::engine
,TableCreateStatement::collate
,TableCreateStatement::character_set
,TableRef::new
,LikeExpr::str
now acceptT: Into<String>
#594OnConflict::values
andOnConflict::update_columns
will append the new values keeping the old values intact instead of erasing them #609- As part of #620,
SeaRc
now becomes a wrapper type.
If you usedSeaRc
for something other thandyn Iden
, you now have to useRcOrArc
.
However be reminded that it is not an intended use of the API anyway.
// new definition
struct SeaRc<I>(RcOrArc<I>);
// remains unchanged
type DynIden = SeaRc<dyn Iden>;
// if you did:
let _: DynIden = Rc::new(Alias::new("char"));
// replace with:
let _: DynIden = SeaRc::new(Alias::new("char"));
- Added new type
Quote
and changed theIden
trait:
struct Quote(pub(crate) u8, pub(crate) u8);
trait Iden {
// then:
fn prepare(&self, s: &mut dyn fmt::Write, q: char);
// now:
fn prepare(&self, s: &mut dyn fmt::Write, q: Quote);
// then:
fn quoted(&self, q: char) -> String;
// now:
fn quoted(&self, q: Quote) -> String;
}
House keeping
- Elided unnecessary lifetimes #552
- Changed all
version = "^x.y.z"
intoversion = "x.y.z"
in all Cargo.toml #547 - Disabled default features and enable only the needed ones #547
tests_cfg
module is available only if you enabledtests-cfg
feature #584- Removed hard coded quotes #613
- Enabled required
syn
v1 features #624 - Fix macro hygiene (
any!
/all!
) #639 #640
Bug fixes
ALTER TABLE
now panic if has multiple column for Sqlite #595- Fixed alter primary key column statements for Postgres #646
New Contributors
- @cemremengu made their first contribution in #549
- @beckend made their first contribution in #550
- @LemarAb made their first contribution in #542
- @siketyan made their first contribution in #569
- @sh-soltanpour made their first contribution in #576
- @elbertronnie made their first contribution in #590
- @matt-phylum made their first contribution in #580
- @wolfv made their first contribution in #610
- @TannerRogalsky made their first contribution in #617
- @nrot made their first contribution in #611
- @Caisin made their first contribution in #622
- @MohamedBassem made their first contribution in #630
- @rakbladsvalsen made their first contribution in #641
- @f8thl3ss made their first contribution in #651
- @darkmmon made their first contribution in #655
- @nrskt made their first contribution in #653
Full Changelog: 0.28.0...0.29.1
0.28.5
0.28.4
0.28.3
0.28.2
0.28.1
0.28.0
New Features
- New struct
FunctionCall
which hold function and arguments #475 - New trait
IdenStatic
with methodfn as_str(&self) -> &'static str
#508 - New traits
PgExpr
andSqliteExpr
for custom expressions #519 - Support
BigDecimal
,IpNetwork
andMacAddress
forsea-query-postgres
#503
API Additions
- Added
SelectStatement::from_function
#475 - Added binary operators from the Postgres
pg_trgm
extension #486 - Added
ILIKE
andNOT ILIKE
operators #473 - Added the
mul
anddiv
methods forSimpleExpr
#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
andSimpleExpr::not
#535 - Added
SimpleExpr::like
,SimpleExpr::not_like
andExpr::cast_as
#539 - Added support for
NULLS NOT DISTINCT
clause for Postgres #532 - Added
Expr::cust_with_expr
andExpr::cust_with_exprs
#531 - Added support for converting
&String
to Value #537
Enhancements
- Made
value::with_array
module public and therefore makingNotU8
trait public #511 - Drop the
Sized
requirement on implementers ofSchemaBuilders
#524
Bug fixes
// 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 fromArray(SeaRc<Box<ColumnType>>)
toArray(SeaRc<ColumnType>)
#492Func::*
now returnsFunctionCall
instead ofSimpleExpr
#475Func::coalesce
now acceptsIntoIterator<Item = SimpleExpr>
instead ofIntoIterator<Item = Into<SimpleExpr>
#475- Removed
Expr::arg
andExpr::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 acceptsInto<SimpleExpr>
instead ofInto<Value>
#476Expr::is_in
,Expr::is_not_in
now acceptsInto<SimpleExpr>
instead ofInto<Value>
and convert it toSimpleExpr::Tuple
instead ofSimpleExpr::Values
#476Expr::expr
now acceptsInto<SimpleExpr>
instead ofSimpleExpr
#475- Moved
Expr::ilike
,Expr::not_ilike
,Expr::matches
,Expr::contains
,Expr::contained
,Expr::concatenate
,Expr::concat
,SimpleExpr::concatenate
andSimpleExpr::concat
to new traitPgExpr
#519 Expr::equals
now acceptsC: IntoColumnRef
instead ofT: 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
andExpr::less_or_equal
#476 - Deprecated
SimpleExpr::equals
,SimpleExpr::not_equals
#528 - Deprecated
Expr::tbl
, please useExpr::col
with a tuple #540
House keeping
- Replace
impl Default
with#[derive(Default)]
#535 - Exclude
sqlx
default features #543 - Use
dtolnay/rust-toolchain
instead ofactions-rs/toolchain
inCI
#544
Full Changelog: 0.27.0...0.28.0
0.27.2
0.27.1
0.27.0
New Features
- Support
CROSS JOIN
#376 - We are going through series of changes to how database drivers work
(#416, #423):sea-query-binder
is now the recommended way (trait based) of working with SQLx, replacingsea-query-driver
(macro based) #434sea-query-binder
is now a separate dependency, instead of integrated withsea-query
#432rusqlite
support is moved tosea-query-rusqlite
#422postgres
support is moved tosea-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
andVARBIT
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
forValue
#425 - Added
INTERSECT
andEXCEPT
toUnionType
#438 - Added
OnConflict::value
andOnConflict::values
#451 ColumnDef::default
now accepts bothValue
andSimpleExpr
#436OrderedStatement::order_by_customs
,OrderedStatement::order_by_columns
,OverStatement::partition_by_customs
,OverStatement::partition_by_columns
now acceptsIntoIterator<Item = T>
instead ofVec<T>
#448Expr::case
,CaseStatement::case
andCaseStatement::finally
now acceptsInto<SimpleExpr>
instead ofInto<Expr>
#460UpdateStatement::value
now acceptInto<SimpleExpr>
instead ofInto<Value>
#460TableAlterStatement::rename_column
,TableAlterStatement::drop_column
,ColumnDef::new
,ColumnDef::new_with_type
now acceptsIntoIden
instead ofIden
#472
Bug Fixes
distinct_on
properly handlesColumnRef
#450- Removed
ON
forDROP INDEX
for SQLite #462 - Change datetime string format to include microseconds #468
ALTER TABLE
for PosgreSQL withUNIQUE
constraint #472
Breaking changes
- Changed
in_tuples
interface to acceptIntoValueTuple
#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 frominteger
toboolean
#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 acceptsIntoIterator<Item = SimpleExpr>
instead ofIntoIterator<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
- @ikrivosheev was the big contributor in this release
- @nahuakang made their first contribution in #385
- @robjtede made their first contribution in #410
- @tooboredtocode made their first contribution in #419
- @alper made their first contribution in #430
- @Martichou made their first contribution in #438
- @EstebanBorai made their first contribution in #443
- @anshulxyz made their first contribution in #400
- @ryanahall made their first contribution in #384
- @Cobular made their first contribution in #450
- @pweglik made their first contribution in #455
- @baszalmstra made their first contribution in #462
- @kyoto7250 made their first contribution in #412
Full Changelog: 0.26.0...0.27.0