Releases: SeaQL/sea-query
Releases · SeaQL/sea-query
0.32.1
New Features
- Added
Value::as_null
let v = Value::Int(Some(2));
let n = v.as_null();
assert_eq!(n, Value::Int(None));
- Added bitwise and/or operators (
bit_and
,bit_or
) #841
let query = Query::select()
.expr(1.bit_and(2).eq(3))
.to_owned();
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT (1 & 2) = 3"#
);
Enhancements
- Added
GREATEST
&LEAST
function #844 - Added
ValueType::enum_type_name()
#836 - Removed "one common table" restriction on recursive CTE #835
House keeping
- Remove unnecessary string hashes #815
0.32.0
New Features
- Construct Postgres query with vector extension #774
- Added
postgres-vector
feature flag - Added
Value::Vector
,ColumnType::Vector
,ColumnDef::vector()
,PgBinOper::EuclideanDistance
,PgBinOper::NegativeInnerProduct
andPgBinOper::CosineDistance
assert_eq!( Query::select() .columns([Char::Character]) .from(Char::Table) .and_where( Expr::col(Char::Character).eq(Expr::val(pgvector::Vector::from(vec![1.0, 2.0]))) ) .to_string(PostgresQueryBuilder), r#"SELECT "character" FROM "character" WHERE "character" = '[1,2]'"# );
- Added
- Added
ExprTrait
to unifyExpr
andSimpleExpr
methods #791 - Support partial index
CREATE INDEX .. WHERE ..
#478
Enhancements
- Replace
Educe
with manual implementations #817
sea-query-derive
- Merged
#[enum_def]
intosea-query-derive
#[enum_def]
now impl additionalIdenStatic
andAsRef<str>
#769
sea-query-attr
- Updated
syn
,heck
anddarling
sea-query-attr
is now deprecated
Upgrades
0.32.0-rc.2
New Features
- Added
ExprTrait
to unifyExpr
andSimpleExpr
methods #791 - Support partial index
CREATE INDEX .. WHERE ..
#478
Enhancements
- Replace
Educe
with manual implementations #817
sea-query-derive
- Merged
#[enum_def]
intosea-query-derive
#[enum_def]
now impl additionalIdenStatic
andAsRef<str>
#769
sea-query-attr
- Updated
syn
,heck
anddarling
sea-query-attr
is now deprecated
Upgrades
- Upgrade
rusqlite
to0.32
#802
0.31.1
0.32.0-rc.1
New Features
- Construct Postgres query with vector extension #774
- Added
postgres-vector
feature flag - Added
Value::Vector
,ColumnType::Vector
,ColumnDef::vector()
,PgBinOper::EuclideanDistance
,PgBinOper::NegativeInnerProduct
andPgBinOper::CosineDistance
assert_eq!( Query::select() .columns([Char::Character]) .from(Char::Table) .and_where( Expr::col(Char::Character).eq(Expr::val(pgvector::Vector::from(vec![1.0, 2.0]))) ) .to_string(PostgresQueryBuilder), r#"SELECT "character" FROM "character" WHERE "character" = '[1,2]'"# );
- Added
Upgrades
0.31.0
New Features
Breaking Changes
- Rework SQLite type mapping #735
assert_eq!(
Table::create()
.table(Alias::new("strange"))
.col(ColumnDef::new(Alias::new("id")).integer().not_null().auto_increment().primary_key())
.col(ColumnDef::new(Alias::new("int1")).integer())
.col(ColumnDef::new(Alias::new("int2")).tiny_integer())
.col(ColumnDef::new(Alias::new("int3")).small_integer())
.col(ColumnDef::new(Alias::new("int4")).big_integer())
.col(ColumnDef::new(Alias::new("string1")).string())
.col(ColumnDef::new(Alias::new("string2")).string_len(24))
.col(ColumnDef::new(Alias::new("char1")).char())
.col(ColumnDef::new(Alias::new("char2")).char_len(24))
.col(ColumnDef::new(Alias::new("text_col")).text())
.col(ColumnDef::new(Alias::new("json_col")).json())
.col(ColumnDef::new(Alias::new("uuid_col")).uuid())
.col(ColumnDef::new(Alias::new("decimal1")).decimal())
.col(ColumnDef::new(Alias::new("decimal2")).decimal_len(12, 4))
.col(ColumnDef::new(Alias::new("money1")).money())
.col(ColumnDef::new(Alias::new("money2")).money_len(12, 4))
.col(ColumnDef::new(Alias::new("float_col")).float())
.col(ColumnDef::new(Alias::new("double_col")).double())
.col(ColumnDef::new(Alias::new("date_col")).date())
.col(ColumnDef::new(Alias::new("time_col")).time())
.col(ColumnDef::new(Alias::new("datetime_col")).date_time())
.col(ColumnDef::new(Alias::new("boolean_col")).boolean())
.col(ColumnDef::new(Alias::new("binary2")).binary_len(1024))
.col(ColumnDef::new(Alias::new("binary3")).var_binary(1024))
.col(ColumnDef::new(Alias::new("binary4")).blob())
.to_string(SqliteQueryBuilder),
[
r#"CREATE TABLE "strange" ( "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,"#,
r#""int1" integer,"#,
r#""int2" tinyint,"#,
r#""int3" smallint,"#,
r#""int4" bigint,"#,
r#""string1" varchar,"#,
r#""string2" varchar(24),"#,
r#""char1" char,"#,
r#""char2" char(24),"#,
r#""text_col" text,"#,
r#""json_col" json_text,"#,
r#""uuid_col" uuid_text,"#,
r#""decimal1" real,"#,
r#""decimal2" real(12, 4),"#,
r#""money1" real_money,"#,
r#""money2" real_money(12, 4),"#,
r#""float_col" float,"#,
r#""double_col" double,"#,
r#""date_col" date_text,"#,
r#""time_col" time_text,"#,
r#""datetime_col" datetime_text,"#,
r#""boolean_col" boolean,"#,
r#""binary2" blob(1024),"#,
r#""binary3" varbinary_blob(1024),"#,
r#""binary4" blob"#,
r#")"#,
]
.join(" ")
);
- MySQL money type maps to decimal
- MySQL blob types moved to
sea_query::extension::mysql::MySqlType
;ColumnDef::blob()
now takes no parameters
assert_eq!(
Table::create()
.table(BinaryType::Table)
.col(ColumnDef::new(BinaryType::BinaryLen).binary_len(32))
.col(ColumnDef::new(BinaryType::Binary).binary())
.col(ColumnDef::new(BinaryType::Blob).blob())
.col(ColumnDef::new(BinaryType::TinyBlob).custom(MySqlType::TinyBlob))
.col(ColumnDef::new(BinaryType::MediumBlob).custom(MySqlType::MediumBlob))
.col(ColumnDef::new(BinaryType::LongBlob).custom(MySqlType::LongBlob))
.to_string(MysqlQueryBuilder),
[
"CREATE TABLE `binary_type` (",
"`binlen` binary(32),",
"`bin` binary(1),",
"`b` blob,",
"`tb` tinyblob,",
"`mb` mediumblob,",
"`lb` longblob",
")",
]
.join(" ")
);
ColumnDef::binary()
set column type as binary with default length of 1- Removed
BlobSize
enum - Added
StringLen
to represent length of var-char/binary
/// Length for var-char/binary; default to 255
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum StringLen {
/// String size
N(u32),
Max,
#[default]
None,
}
ValueType::columntype()
ofVec<u8>
maps toVarBinary(StringLen::None)
ValueType::columntype()
ofString
maps toString(StringLen::None)
ColumnType::Bit
maps tobit
for PostgresColumnType::Binary
andColumnType::VarBinary
map tobytea
for PostgresValue::Decimal
andValue::BigDecimal
bind asreal
for SQLiteColumnType::Year(Option<MySqlYear>)
changed toColumnType::Year
Enhancements
- Added
IntoColumnDef
trait, allowing&mut ColumnDef
/ColumnDef
as argument - Added
ColumnType::string()
andColumnType::var_binary()
as shim for old API - Added
ON DUPLICATE KEY DO NOTHING
polyfill for MySQL #765 - Added non-TLS runtime #783
House keeping
- Added
ColumnType
mapping documentation - Replace
derivative
witheduce
#763
Upgrades
0.31.0-rc.9
- Publically export FuncArgMod #751
0.31.0-rc.8
- Added non-TLS runtime #783
0.31.0-rc.7
- Pin
educe
to0.5.11
0.31.0-rc.6
New Features
- Added
table_name
attribute toenum_def
macro #759
Breaking Changes
- Rework SQLite type mapping #735
assert_eq!(
Table::create()
.table(Alias::new("strange"))
.col(ColumnDef::new(Alias::new("id")).integer().not_null().auto_increment().primary_key())
.col(ColumnDef::new(Alias::new("int1")).integer())
.col(ColumnDef::new(Alias::new("int2")).tiny_integer())
.col(ColumnDef::new(Alias::new("int3")).small_integer())
.col(ColumnDef::new(Alias::new("int4")).big_integer())
.col(ColumnDef::new(Alias::new("string1")).string())
.col(ColumnDef::new(Alias::new("string2")).string_len(24))
.col(ColumnDef::new(Alias::new("char1")).char())
.col(ColumnDef::new(Alias::new("char2")).char_len(24))
.col(ColumnDef::new(Alias::new("text_col")).text())
.col(ColumnDef::new(Alias::new("json_col")).json())
.col(ColumnDef::new(Alias::new("uuid_col")).uuid())
.col(ColumnDef::new(Alias::new("decimal1")).decimal())
.col(ColumnDef::new(Alias::new("decimal2")).decimal_len(12, 4))
.col(ColumnDef::new(Alias::new("money1")).money())
.col(ColumnDef::new(Alias::new("money2")).money_len(12, 4))
.col(ColumnDef::new(Alias::new("float_col")).float())
.col(ColumnDef::new(Alias::new("double_col")).double())
.col(ColumnDef::new(Alias::new("date_col")).date())
.col(ColumnDef::new(Alias::new("time_col")).time())
.col(ColumnDef::new(Alias::new("datetime_col")).date_time())
.col(ColumnDef::new(Alias::new("boolean_col")).boolean())
.col(ColumnDef::new(Alias::new("binary2")).binary_len(1024))
.col(ColumnDef::new(Alias::new("binary3")).var_binary(1024))
.col(ColumnDef::new(Alias::new("binary4")).blob())
.to_string(SqliteQueryBuilder),
[
r#"CREATE TABLE "strange" ( "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,"#,
r#""int1" integer,"#,
r#""int2" tinyint,"#,
r#""int3" smallint,"#,
r#""int4" bigint,"#,
r#""string1" varchar,"#,
r#""string2" varchar(24),"#,
r#""char1" char,"#,
r#""char2" char(24),"#,
r#""text_col" text,"#,
r#""json_col" json_text,"#,
r#""uuid_col" uuid_text,"#,
r#""decimal1" real,"#,
r#""decimal2" real(12, 4),"#,
r#""money1" real_money,"#,
r#""money2" real_money(12, 4),"#,
r#""float_col" float,"#,
r#""double_col" double,"#,
r#""date_col" date_text,"#,
r#""time_col" time_text,"#,
r#""datetime_col" datetime_text,"#,
r#""boolean_col" boolean,"#,
r#""binary2" blob(1024),"#,
r#""binary3" varbinary_blob(1024),"#,
r#""binary4" blob"#,
r#")"#,
]
.join(" ")
);
- MySQL money type maps to decimal
- MySQL blob types moved to
sea_query::extension::mysql::MySqlType
;ColumnDef::blob()
now takes no parameters
assert_eq!(
Table::create()
.table(BinaryType::Table)
.col(ColumnDef::new(BinaryType::BinaryLen).binary_len(32))
.col(ColumnDef::new(BinaryType::Binary).binary())
.col(ColumnDef::new(BinaryType::Blob).blob())
.col(ColumnDef::new(BinaryType::TinyBlob).custom(MySqlType::TinyBlob))
.col(ColumnDef::new(BinaryType::MediumBlob).custom(MySqlType::MediumBlob))
.col(ColumnDef::new(BinaryType::LongBlob).custom(MySqlType::LongBlob))
.to_string(MysqlQueryBuilder),
[
"CREATE TABLE `binary_type` (",
"`binlen` binary(32),",
"`bin` binary(1),",
"`b` blob,",
"`tb` tinyblob,",
"`mb` mediumblob,",
"`lb` longblob",
")",
]
.join(" ")
);
ColumnDef::binary()
set column type as binary with default length of 1- Removed
BlobSize
enum - Added
StringLen
to represent length of var-char/binary
/// Length for var-char/binary; default to 255
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum StringLen {
/// String size
N(u32),
Max,
#[default]
None,
}
ValueType::columntype()
ofVec<u8>
maps toVarBinary(StringLen::None)
ValueType::columntype()
ofString
maps toString(StringLen::None)
ColumnType::Bit
maps tobit
for PostgresColumnType::Binary
andColumnType::VarBinary
map tobytea
for PostgresValue::Decimal
andValue::BigDecimal
bind asreal
for SQLiteColumnType::Year(Option<MySqlYear>)
changed toColumnType::Year
Enhancements
- Added
IntoColumnDef
trait, allowing&mut ColumnDef
/ColumnDef
as argument - Added
ColumnType::string()
andColumnType::var_binary()
as shim for old API - Added
ON DUPLICATE KEY DO NOTHING
polyfill for MySQL #765
House keeping
- Added
ColumnType
mapping documentation - Replace
derivative
witheduce
#763
Upgrades
- Upgrade
rusqlite
to0.31
#755