diff --git a/Cargo.toml b/Cargo.toml index f89b5c7f1..b2ae4abd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,8 @@ tracing = { version = "0.1", default-features = false, features = ["attributes", rust_decimal = { version = "1", default-features = false, optional = true } bigdecimal = { version = "0.3", default-features = false, optional = true } sea-orm-macros = { version = "0.12.0", path = "sea-orm-macros", default-features = false, features = ["strum"] } -sea-query = { version = "0.28.3", features = ["thread-safe"] } -sea-query-binder = { version = "0.3", default-features = false, optional = true } +sea-query = { version = "0.29.0-rc.1", features = ["thread-safe"] } +sea-query-binder = { version = "0.4.0-rc.1", default-features = false, optional = true } strum = { version = "0.24", default-features = false } serde = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false, optional = true } diff --git a/sea-orm-cli/Cargo.toml b/sea-orm-cli/Cargo.toml index baed609ef..dd377c5a5 100644 --- a/sea-orm-cli/Cargo.toml +++ b/sea-orm-cli/Cargo.toml @@ -38,7 +38,7 @@ clap = { version = "3.2", default-features = false, features = ["std", "env", "d dotenvy = { version = "0.15", default-features = false, optional = true } async-std = { version = "1.9", default-features = false, features = ["attributes", "tokio1"], optional = true } sea-orm-codegen = { version = "=0.12.0", path = "../sea-orm-codegen", default-features = false, optional = true } -sea-schema = { version = "0.11" } +sea-schema = { version = "0.12.0-rc.1" } sqlx = { version = "0.6", default-features = false, features = ["mysql", "postgres"], optional = true } tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] } tracing = { version = "0.1", default-features = false } diff --git a/sea-orm-codegen/Cargo.toml b/sea-orm-codegen/Cargo.toml index 56ac646c1..a12a58d63 100644 --- a/sea-orm-codegen/Cargo.toml +++ b/sea-orm-codegen/Cargo.toml @@ -17,7 +17,7 @@ name = "sea_orm_codegen" path = "src/lib.rs" [dependencies] -sea-query = { version = "0.28.3", default-features = false, features = ["thread-safe"] } +sea-query = { version = "0.29.0-rc.1", default-features = false, features = ["thread-safe"] } syn = { version = "1", default-features = false, features = ["parsing", "proc-macro", "derive", "printing"] } quote = { version = "1", default-features = false } heck = { version = "0.4", default-features = false } diff --git a/sea-orm-macros/src/derives/entity_model.rs b/sea-orm-macros/src/derives/entity_model.rs index c642d9a8e..e50b8a66d 100644 --- a/sea-orm-macros/src/derives/entity_model.rs +++ b/sea-orm-macros/src/derives/entity_model.rs @@ -255,12 +255,12 @@ pub fn expand_derive_entity_model(data: Data, attrs: Vec) -> syn::Res if let Some(select_as) = select_as { columns_select_as.push(quote! { - Self::#field_name => expr.cast_as(sea_orm::sea_query::Alias::new(&#select_as)) + Self::#field_name => expr.cast_as(sea_orm::sea_query::Alias::new(#select_as)) }); } if let Some(save_as) = save_as { columns_save_as.push(quote! { - Self::#field_name => val.cast_as(sea_orm::sea_query::Alias::new(&#save_as)) + Self::#field_name => val.cast_as(sea_orm::sea_query::Alias::new(#save_as)) }); } diff --git a/sea-orm-migration/Cargo.toml b/sea-orm-migration/Cargo.toml index 15610308c..c095b6b21 100644 --- a/sea-orm-migration/Cargo.toml +++ b/sea-orm-migration/Cargo.toml @@ -25,7 +25,7 @@ clap = { version = "3.2", default-features = false, features = ["std", "env", "d dotenvy = { version = "0.15", default-features = false, optional = true } sea-orm = { version = "0.12.0", path = "../", default-features = false, features = ["macros"] } sea-orm-cli = { version = "0.12.0", path = "../sea-orm-cli", default-features = false, optional = true } -sea-schema = { version = "0.11" } +sea-schema = { version = "0.12.0-rc.1" } tracing = { version = "0.1", default-features = false, features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt"] } futures = { version = "0.3", default-features = false, features = ["std"] } diff --git a/sea-orm-migration/src/migrator.rs b/sea-orm-migration/src/migrator.rs index d0058bacb..2509d9a6c 100644 --- a/sea-orm-migration/src/migrator.rs +++ b/sea-orm-migration/src/migrator.rs @@ -322,7 +322,7 @@ where let type_name: String = row.try_get("", "typname")?; info!("Dropping type '{}'", type_name); let mut stmt = Type::drop(); - stmt.name(Alias::new(&type_name as &str)); + stmt.name(Alias::new(&type_name)); db.execute(db_backend.build(&stmt)).await?; info!("Type '{}' has been dropped", type_name); } diff --git a/src/entity/active_model.rs b/src/entity/active_model.rs index 40d6a1569..656fc1853 100644 --- a/src/entity/active_model.rs +++ b/src/entity/active_model.rs @@ -155,31 +155,14 @@ pub trait ActiveModelTrait: Clone + Debug { let s3 = next!(); Some(ValueTuple::Three(s1, s2, s3)) } - 4 => { - let s1 = next!(); - let s2 = next!(); - let s3 = next!(); - let s4 = next!(); - Some(ValueTuple::Four(s1, s2, s3, s4)) - } - 5 => { - let s1 = next!(); - let s2 = next!(); - let s3 = next!(); - let s4 = next!(); - let s5 = next!(); - Some(ValueTuple::Five(s1, s2, s3, s4, s5)) - } - 6 => { - let s1 = next!(); - let s2 = next!(); - let s3 = next!(); - let s4 = next!(); - let s5 = next!(); - let s6 = next!(); - Some(ValueTuple::Six(s1, s2, s3, s4, s5, s6)) + len => { + let mut vec = Vec::with_capacity(len); + for _ in 0..len { + let s = next!(); + vec.push(s); + } + Some(ValueTuple::Many(vec)) } - _ => panic!("The arity cannot be larger than 6"), } } diff --git a/src/entity/column.rs b/src/entity/column.rs index 991aa6995..1cf2e61b8 100644 --- a/src/entity/column.rs +++ b/src/entity/column.rs @@ -270,7 +270,7 @@ pub trait ColumnTrait: IdenStatic + Iterable + FromStr { cast_enum_as(val, self, |col, enum_name, col_type| { let type_name = match col_type { ColumnType::Array(_) => { - Alias::new(&format!("{}[]", enum_name.to_string())).into_iden() + Alias::new(format!("{}[]", enum_name.to_string())).into_iden() } _ => enum_name, }; diff --git a/src/entity/link.rs b/src/entity/link.rs index 214754c52..df30c8220 100644 --- a/src/entity/link.rs +++ b/src/entity/link.rs @@ -21,9 +21,9 @@ pub trait Linked { fn find_linked(&self) -> Select { let mut select = Select::new(); for (i, mut rel) in self.link().into_iter().rev().enumerate() { - let from_tbl = Alias::new(&format!("r{i}")).into_iden(); + let from_tbl = Alias::new(format!("r{i}")).into_iden(); let to_tbl = if i > 0 { - Alias::new(&format!("r{}", i - 1)).into_iden() + Alias::new(format!("r{}", i - 1)).into_iden() } else { unpack_table_ref(&rel.to_tbl) }; diff --git a/src/executor/cursor.rs b/src/executor/cursor.rs index 772635669..bb88326c1 100644 --- a/src/executor/cursor.rs +++ b/src/executor/cursor.rs @@ -3,8 +3,8 @@ use crate::{ Select, SelectModel, SelectorTrait, }; use sea_query::{ - Condition, DynIden, Expr, IntoValueTuple, Order, OrderedStatement, SeaRc, SelectStatement, - SimpleExpr, Value, ValueTuple, + Condition, DynIden, Expr, IntoValueTuple, Order, SeaRc, SelectStatement, SimpleExpr, Value, + ValueTuple, }; use std::marker::PhantomData; diff --git a/src/executor/paginator.rs b/src/executor/paginator.rs index 6ca075694..6907457e6 100644 --- a/src/executor/paginator.rs +++ b/src/executor/paginator.rs @@ -249,7 +249,7 @@ where type Selector = S; fn paginate(self, db: &'db C, page_size: u64) -> Paginator<'db, C, S> { assert!(page_size != 0, "page_size should not be zero"); - let sql = &self.stmt.sql.trim()[6..].trim(); + let sql = self.stmt.sql.trim()[6..].trim(); let mut query = SelectStatement::new(); query.expr(if let Some(values) = self.stmt.values { Expr::cust_with_values(sql, values.0) diff --git a/src/query/combine.rs b/src/query/combine.rs index 99f2d8021..9ffb8e6ed 100644 --- a/src/query/combine.rs +++ b/src/query/combine.rs @@ -37,7 +37,7 @@ where match &sel.alias { Some(alias) => { let alias = format!("{}{}", pre, alias.to_string().as_str()); - sel.alias = Some(SeaRc::new(Alias::new(&alias))); + sel.alias = Some(SeaRc::new(Alias::new(alias))); } None => { let col = match &sel.expr { @@ -65,7 +65,7 @@ where _ => panic!("cannot apply alias for expr other than Column or AsEnum"), }; let alias = format!("{}{}", pre, col.to_string().as_str()); - sel.alias = Some(SeaRc::new(Alias::new(&alias))); + sel.alias = Some(SeaRc::new(Alias::new(alias))); } }; }); @@ -149,7 +149,7 @@ where let alias = format!("{}{}", SelectB.as_str(), col.as_str()); selector.query().expr(SelectExpr { expr: col.select_as(col.into_expr()), - alias: Some(SeaRc::new(Alias::new(&alias))), + alias: Some(SeaRc::new(Alias::new(alias))), window: None, }); } diff --git a/src/query/join.rs b/src/query/join.rs index f7a81c932..6923d96c7 100644 --- a/src/query/join.rs +++ b/src/query/join.rs @@ -70,9 +70,9 @@ where { let mut slf = self; for (i, mut rel) in l.link().into_iter().enumerate() { - let to_tbl = Alias::new(&format!("r{i}")).into_iden(); + let to_tbl = Alias::new(format!("r{i}")).into_iden(); let from_tbl = if i > 0 { - Alias::new(&format!("r{}", i - 1)).into_iden() + Alias::new(format!("r{}", i - 1)).into_iden() } else { unpack_table_ref(&rel.from_tbl) }; @@ -96,12 +96,12 @@ where for col in ::iter() { let alias = format!("{}{}", SelectB.as_str(), col.as_str()); let expr = Expr::col(( - Alias::new(&format!("r{}", l.link().len() - 1)).into_iden(), + Alias::new(format!("r{}", l.link().len() - 1)).into_iden(), col.into_iden(), )); select_two.query().expr(SelectExpr { expr: col.select_as(expr), - alias: Some(SeaRc::new(Alias::new(&alias))), + alias: Some(SeaRc::new(Alias::new(alias))), window: None, }); }