Skip to content

Commit

Permalink
Merge branch 'main' into nullable-insert
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Oct 8, 2024
2 parents 6e403de + 5ae1f78 commit d5bafcf
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 29 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
4 changes: 2 additions & 2 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand All @@ -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"
4 changes: 2 additions & 2 deletions examples/mysql/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions examples/postgres/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions examples/sqlite/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"] }
Expand All @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand All @@ -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"
28 changes: 22 additions & 6 deletions src/builder_context/filter_types_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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::<T>(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::<T>(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::<T>(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::<T>(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 => {
Expand Down
9 changes: 3 additions & 6 deletions src/builder_context/types_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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}'"),
}
}

Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/filter_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/order_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}),
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
4 changes: 2 additions & 2 deletions src/outputs/connection_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/outputs/edge_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/outputs/entity_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d5bafcf

Please sign in to comment.