Fixed Issues
- Disable SQLx query logging #290
- Code generated by
sea-orm-cli
cannot pass clippy #296 - Should return detailed error message for connection failure #310
DateTimeWithTimeZone
does not implementSerialize
andDeserialize
#319- Support returning clause to avoid database hits #183
Merged PRs
- chore: update to Rust 2021 Edition by @sno2 in #273
- Enumeration - 3 by @billy1624 in #274
- Enumeration - 2 by @billy1624 in #261
- Codegen fix clippy warnings by @billy1624 in #303
- Add axum example by @YoshieraHuang in #297
- Enumeration by @billy1624 in #258
- Add
PaginatorTrait
andCountTrait
for more constrains by @YoshieraHuang in #306 - Continue
PaginatorTrait
by @billy1624 in #307 - Refactor
Schema
by @billy1624 in #309 - Detailed connection errors by @billy1624 in #312
- Suppress
ouroboros
missing docs warnings by @billy1624 in #288 with-json
feature requireschrono/serde
by @billy1624 in #320- Pass the argument
entity.table_ref()
instead of justentity
. by @josh-codes in #318 - Unknown types could be a newtypes instead of
ActiveEnum
by @billy1624 in #324 - Returning by @billy1624 in #292
Breaking Changes
- Refactor
paginate()
&count()
utilities intoPaginatorTrait
. You can use the paginator as usual but you might need to importPaginatorTrait
manually when upgrading from previous version.use futures::TryStreamExt; use sea_orm::{entity::*, query::*, tests_cfg::cake}; let mut cake_stream = cake::Entity::find() .order_by_asc(cake::Column::Id) .paginate(db, 50) .into_stream(); while let Some(cakes) = cake_stream.try_next().await? { // Do something on cakes: Vec<cake::Model> }
- The helper struct
Schema
convertingEntityTrait
into differentsea-query
statement now has to be initialized withDbBackend
.use sea_orm::{tests_cfg::*, DbBackend, Schema}; use sea_orm::sea_query::TableCreateStatement; // 0.3.x let _: TableCreateStatement = Schema::create_table_from_entity(cake::Entity); // 0.4.x let schema: Schema = Schema::new(DbBackend::MySql); let _: TableCreateStatement = schema.create_table_from_entity(cake::Entity);
- When performing insert or update operation on
ActiveModel
against PostgreSQL,RETURNING
clause will be used to perform select in a single SQL statement.// For PostgreSQL cake::ActiveModel { name: Set("Apple Pie".to_owned()), ..Default::default() } .insert(&postgres_db) .await?; assert_eq!( postgres_db.into_transaction_log(), vec![Transaction::from_sql_and_values( DbBackend::Postgres, r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#, vec!["Apple Pie".into()] )]);
// For MySQL & SQLite cake::ActiveModel { name: Set("Apple Pie".to_owned()), ..Default::default() } .insert(&other_db) .await?; assert_eq!( other_db.into_transaction_log(), vec![ Transaction::from_sql_and_values( DbBackend::MySql, r#"INSERT INTO `cake` (`name`) VALUES (?)"#, vec!["Apple Pie".into()] ), Transaction::from_sql_and_values( DbBackend::MySql, r#"SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = ? LIMIT ?"#, vec![15.into(), 1u64.into()] )]);
New Contributors
- @sno2 made their first contribution in #273
- @YoshieraHuang made their first contribution in #297
- @josh-codes made their first contribution in #318
Full Changelog: 0.3.2...0.4.0