diff --git a/CHANGELOG.md b/CHANGELOG.md index 936f655a..ad956afe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.1.0 - Pending + +### Versions + ++ `1.1.0-rc.1`: 2024-08-12 + +### Upgrades + +* Upgrade `sea-orm` to 1.1.0 +* Upgrade `sea-query` to 0.32.0 + ## 1.0.0 - 2024-08-06 ### Versions @@ -19,6 +30,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Upgrades * Upgrade `sea-orm` to 1.0.0 +* Upgrade `sea-query` to 0.31.0 * Upgrade `async-graphql` to 7.0 * Upgrade `poem` to 3.0 diff --git a/Cargo.toml b/Cargo.toml index 09127a8b..9e6d4a3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [".", "cli", "generator"] [package] name = "seaography" -version = "1.0.0" +version = "1.1.0-rc.1" edition = "2021" rust-version = "1.70" authors = ["Panagiotis Karatakis "] diff --git a/README.md b/README.md index ca3ef6a0..674838d1 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ | Seaography | SeaORM | |----------------------------------------------------------|-------------------------------------------------------| +| [1.1-rc](https://crates.io/crates/seaography/1.1.0-rc.1) | [1.1-rc](https://crates.io/crates/sea-orm/1.1.0-rc.1) | | [1.0](https://crates.io/crates/seaography/1.0.0) | [1.0](https://crates.io/crates/sea-orm/1.0.0) | | [0.12](https://crates.io/crates/seaography/0.12.0) | [0.12](https://crates.io/crates/sea-orm/0.12.14) | | [0.3](https://crates.io/crates/seaography/0.3.0) | [0.10](https://crates.io/crates/sea-orm/0.10.7) | diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 01f95bf2..64f9a970 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "seaography-cli" -version = "1.0.0" +version = "1.1.0-rc.1" edition = "2021" rust-version = "1.70" authors = ["Panagiotis Karatakis "] @@ -15,5 +15,5 @@ categories = ["database"] [dependencies] async-std = { version = "1.12.0", features = [ "attributes", "tokio1" ] } clap = { version = "4.3.19", features = ["derive"] } -seaography-generator = { version = "~1.0.0", path = "../generator" } +seaography-generator = { version = "~1.1.0-rc.1", path = "../generator" } url = "2.4.0" \ No newline at end of file diff --git a/examples/mysql/Cargo.toml b/examples/mysql/Cargo.toml index 043f51d8..1f6a13b0 100644 --- a/examples/mysql/Cargo.toml +++ b/examples/mysql/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "seaography-mysql-example" -version = "1.0.0" +version = "1.1.0-rc.1" [dependencies] axum = { version = "0.7" } @@ -16,7 +16,7 @@ lazy_static = { version = "1.4.0" } [dependencies.seaography] path = "../../" -version = "~1.0.0" # seaography version +version = "~1.1.0-rc.1" # seaography version features = ["with-decimal", "with-chrono"] [dev-dependencies] diff --git a/examples/postgres/Cargo.toml b/examples/postgres/Cargo.toml index 9ab7b8b8..6ffe215f 100644 --- a/examples/postgres/Cargo.toml +++ b/examples/postgres/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "seaography-postgres-example" -version = "1.0.0" +version = "1.1.0-rc.1" [dependencies] poem = { version = "3.0" } @@ -16,7 +16,7 @@ lazy_static = { version = "1.4.0" } [dependencies.seaography] path = "../../" -version = "~1.0.0" # seaography version +version = "~1.1.0-rc.1" # seaography version features = ["with-decimal", "with-chrono", "with-postgres-array"] [dev-dependencies] diff --git a/examples/sqlite/Cargo.toml b/examples/sqlite/Cargo.toml index c32ee677..5af603d6 100644 --- a/examples/sqlite/Cargo.toml +++ b/examples/sqlite/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "seaography-sqlite-example" -version = "1.0.0" +version = "1.1.0-rc.1" [dependencies] actix-web = { version = "4.5", default-features = false, features = ["macros"] } @@ -16,7 +16,7 @@ lazy_static = { version = "1.4.0" } [dependencies.seaography] path = "../../" -version = "~1.0.0" # seaography version +version = "~1.1.0-rc.1" # seaography version features = ["with-decimal", "with-chrono"] [dev-dependencies] diff --git a/generator/Cargo.toml b/generator/Cargo.toml index b23e7b71..d6a1a93f 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "seaography-generator" -version = "1.0.0" +version = "1.1.0-rc.1" edition = "2021" rust-version = "1.70" authors = ["Panagiotis Karatakis "] @@ -18,5 +18,5 @@ proc-macro2 = "1.0.66" syn = { version = "2.0.27", features = ["full"] } heck = "0.4.1" itertools = "0.11.0" -sea-query = { version = "~0.31.0", default-features = false } +sea-query = { version = "~0.32.0-rc.1", default-features = false } thiserror = "1.0.44" \ No newline at end of file diff --git a/src/builder_context/filter_types_map.rs b/src/builder_context/filter_types_map.rs index c5b00dcf..658f19ef 100644 --- a/src/builder_context/filter_types_map.rs +++ b/src/builder_context/filter_types_map.rs @@ -180,7 +180,7 @@ impl FilterTypesMapHelper { .context .filter_types .overwrites - .get(&format!("{}.{}", entity_name, column_name)) + .get(&format!("{entity_name}.{column_name}")) { return ty.clone(); } @@ -426,7 +426,7 @@ impl FilterTypesMapHelper { .context .filter_types .condition_functions - .get(&format!("{}.{}", entity_name, column_name)) + .get(&format!("{entity_name}.{column_name}")) { return filter_condition_fn(condition, filter); } else { @@ -522,28 +522,44 @@ impl FilterTypesMapHelper { if let Some(value) = filter.get("contains") { let value = types_map_helper .async_graphql_value_to_sea_orm_value::(column, &value)?; - condition = condition.add(column.contains(value.to_string())); + let s = match value { + sea_orm::sea_query::Value::String(Some(s)) => s.to_string(), + _ => value.to_string(), + }; + condition = condition.add(column.contains(s)); } } FilterOperation::StartsWith => { if let Some(value) = filter.get("starts_with") { let value = types_map_helper .async_graphql_value_to_sea_orm_value::(column, &value)?; - condition = condition.add(column.starts_with(value.to_string())); + let s = match value { + sea_orm::sea_query::Value::String(Some(s)) => s.to_string(), + _ => value.to_string(), + }; + condition = condition.add(column.starts_with(s)); } } FilterOperation::EndsWith => { if let Some(value) = filter.get("ends_with") { let value = types_map_helper .async_graphql_value_to_sea_orm_value::(column, &value)?; - condition = condition.add(column.ends_with(value.to_string())); + let s = match value { + sea_orm::sea_query::Value::String(Some(s)) => s.to_string(), + _ => value.to_string(), + }; + condition = condition.add(column.ends_with(s)); } } FilterOperation::Like => { if let Some(value) = filter.get("like") { let value = types_map_helper .async_graphql_value_to_sea_orm_value::(column, &value)?; - condition = condition.add(column.like(value.to_string())); + let s = match value { + sea_orm::sea_query::Value::String(Some(s)) => s.to_string(), + _ => value.to_string(), + }; + condition = condition.add(column.like(s)); } } FilterOperation::NotLike => { diff --git a/src/builder_context/types_map.rs b/src/builder_context/types_map.rs index 6397486a..fdc61ce2 100644 --- a/src/builder_context/types_map.rs +++ b/src/builder_context/types_map.rs @@ -77,7 +77,7 @@ impl TypesMapHelper { column_type: &ColumnType, ) -> ConvertedType { let context = self.context; - let name = format!("{}.{}", entity_name, column_name); + let name = format!("{entity_name}.{column_name}"); if let Some(overwrite) = context.types.overwrites.get(&name) { return overwrite.clone(); @@ -195,10 +195,7 @@ impl TypesMapHelper { ColumnType::MacAddr => ConvertedType::String, // #[cfg(feature = "with-mac_address")] // ColumnType::MacAddr => ConvertedType::MacAddress, - _ => panic!( - "Type mapping is not implemented for '{}.{}'", - entity_name, column_name - ), + _ => panic!("Type mapping is not implemented for '{entity_name}.{column_name}'"), } } @@ -222,7 +219,7 @@ impl TypesMapHelper { .context .types .input_conversions - .get(&format!("{}.{}", entity_name, column_name)) + .get(&format!("{entity_name}.{column_name}")) { return parser.as_ref()(value); } diff --git a/src/inputs/filter_input.rs b/src/inputs/filter_input.rs index e543831c..d591e3c3 100644 --- a/src/inputs/filter_input.rs +++ b/src/inputs/filter_input.rs @@ -13,7 +13,7 @@ impl std::default::Default for FilterInputConfig { fn default() -> Self { FilterInputConfig { type_name: Box::new(|object_name: &str| -> String { - format!("{}FilterInput", object_name) + format!("{object_name}FilterInput") }), } } diff --git a/src/inputs/order_input.rs b/src/inputs/order_input.rs index 51382d16..f1bfeb69 100644 --- a/src/inputs/order_input.rs +++ b/src/inputs/order_input.rs @@ -13,7 +13,7 @@ impl std::default::Default for OrderInputConfig { fn default() -> Self { OrderInputConfig { type_name: Box::new(|object_name: &str| -> String { - format!("{}OrderInput", object_name) + format!("{object_name}OrderInput") }), } } diff --git a/src/lib.rs b/src/lib.rs index 2734ffb2..cb5d50c2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,7 @@ //! //! | Seaography | SeaORM | //! |----------------------------------------------------------|-------------------------------------------------------| +//! | [1.1-rc](https://crates.io/crates/seaography/1.1.0-rc.1) | [1.1-rc](https://crates.io/crates/sea-orm/1.1.0-rc.1) | //! | [1.0](https://crates.io/crates/seaography/1.0.0) | [1.0](https://crates.io/crates/sea-orm/1.0.0) | //! | [0.12](https://crates.io/crates/seaography/0.12.0) | [0.12](https://crates.io/crates/sea-orm/0.12.14) | //! | [0.3](https://crates.io/crates/seaography/0.3.0) | [0.10](https://crates.io/crates/sea-orm/0.10.7) | diff --git a/src/outputs/connection_object.rs b/src/outputs/connection_object.rs index a01b16de..c172d502 100644 --- a/src/outputs/connection_object.rs +++ b/src/outputs/connection_object.rs @@ -40,7 +40,7 @@ impl std::default::Default for ConnectionObjectConfig { fn default() -> Self { ConnectionObjectConfig { type_name: Box::new(|object_name: &str| -> String { - format!("{}Connection", object_name) + format!("{object_name}Connection") }), page_info: "pageInfo".into(), pagination_info: "paginationInfo".into(), @@ -96,7 +96,7 @@ impl ConnectionObjectBuilder { if let Some(value) = connection .pagination_info .as_ref() - .map(|v| FieldValue::borrowed_any(v)) + .map(FieldValue::borrowed_any) { Ok(Some(value)) } else { diff --git a/src/outputs/edge_object.rs b/src/outputs/edge_object.rs index 358ac749..459637a7 100644 --- a/src/outputs/edge_object.rs +++ b/src/outputs/edge_object.rs @@ -30,7 +30,7 @@ pub struct EdgeObjectConfig { impl std::default::Default for EdgeObjectConfig { fn default() -> EdgeObjectConfig { EdgeObjectConfig { - type_name: Box::new(|object_name: &str| -> String { format!("{}Edge", object_name) }), + type_name: Box::new(|object_name: &str| -> String { format!("{object_name}Edge") }), cursor: "cursor".into(), node: "node".into(), } diff --git a/src/outputs/entity_object.rs b/src/outputs/entity_object.rs index 96509f25..fbc3789f 100644 --- a/src/outputs/entity_object.rs +++ b/src/outputs/entity_object.rs @@ -139,7 +139,7 @@ impl EntityObjectBuilder { .context .types .output_conversions - .get(&format!("{}.{}", entity_name, column_name)); + .get(&format!("{entity_name}.{column_name}")); let field = Field::new(column_name, graphql_type, move |ctx| { let guard_flag = if let Some(guard) = guard {