Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Strum #2088

Merged
merged 8 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Master - Pending

* Added feature flag `sqlite-use-returning-for-3_35` to use SQLite's returning https://github.com/SeaQL/sea-orm/pull/2070
* Update Strum to version 0.26 https://github.com/SeaQL/sea-orm/pull/2088
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this too!


## 0.12.12 - 2023-01-22

Expand Down
99 changes: 84 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ keywords = ["async", "orm", "mysql", "postgres", "sqlite"]
rust-version = "1.65"

[package.metadata.docs.rs]
features = ["default", "sqlx-all", "mock", "proxy", "runtime-async-std-native-tls", "postgres-array", "sea-orm-internal"]
features = [
"default",
"sqlx-all",
"mock",
"proxy",
"runtime-async-std-native-tls",
"postgres-array",
"sea-orm-internal",
]
rustdoc-args = ["--cfg", "docsrs"]

[lib]
Expand All @@ -30,13 +38,24 @@ chrono = { version = "0.4.30", default-features = false, optional = true }
time = { version = "0.3", default-features = false, optional = true }
futures = { version = "0.3", default-features = false, features = ["std"] }
log = { version = "0.4", default-features = false }
tracing = { version = "0.1", default-features = false, features = ["attributes", "log"] }
tracing = { version = "0.1", default-features = false, features = [
"attributes",
"log",
] }
rust_decimal = { version = "1", default-features = false, optional = true }
bigdecimal = { version = "0.3", default-features = false, optional = true }
sea-orm-macros = { version = "0.12.12", path = "sea-orm-macros", default-features = false, features = ["strum"] }
sea-query = { version = "0.30.4", default-features = false, features = ["thread-safe", "hashable-value", "backend-mysql", "backend-postgres", "backend-sqlite"] }
sea-orm-macros = { version = "0.12.12", path = "sea-orm-macros", default-features = false, features = [
"strum",
] }
sea-query = { version = "0.30.4", default-features = false, features = [
"thread-safe",
"hashable-value",
"backend-mysql",
"backend-postgres",
"backend-sqlite",
] }
sea-query-binder = { version = "0.5.0", default-features = false, optional = true }
strum = { version = "0.25", default-features = false }
strum = { version = "0.26", default-features = false }
serde = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, optional = true }
sqlx = { version = "0.7", default-features = false, optional = true }
Expand All @@ -54,7 +73,13 @@ tokio = { version = "1.6", features = ["full"] }
actix-rt = { version = "2.2.0" }
maplit = { version = "1" }
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
sea-orm = { path = ".", features = ["mock", "debug-print", "tests-cfg", "postgres-array", "sea-orm-internal"] }
sea-orm = { path = ".", features = [
"mock",
"debug-print",
"tests-cfg",
"postgres-array",
"sea-orm-internal",
] }
pretty_assertions = { version = "0.7" }
time = { version = "0.3", features = ["macros"] }
uuid = { version = "1", features = ["v4"] }
Expand All @@ -76,19 +101,63 @@ default = [
macros = ["sea-orm-macros/derive"]
mock = []
proxy = ["serde_json", "serde/derive"]
with-json = ["serde_json", "sea-query/with-json", "chrono?/serde", "time?/serde", "uuid?/serde", "sea-query-binder?/with-json", "sqlx?/json"]
with-chrono = ["chrono", "sea-query/with-chrono", "sea-query-binder?/with-chrono", "sqlx?/chrono"]
with-rust_decimal = ["rust_decimal", "sea-query/with-rust_decimal", "sea-query-binder?/with-rust_decimal", "sqlx?/rust_decimal"]
with-bigdecimal = ["bigdecimal", "sea-query/with-bigdecimal", "sea-query-binder?/with-bigdecimal", "sqlx?/bigdecimal"]
with-uuid = ["uuid", "sea-query/with-uuid", "sea-query-binder?/with-uuid", "sqlx?/uuid"]
with-time = ["time", "sea-query/with-time", "sea-query-binder?/with-time", "sqlx?/time"]
postgres-array = ["sea-query/postgres-array", "sea-query-binder?/postgres-array", "sea-orm-macros/postgres-array"]
json-array = ["postgres-array"] # this does not actually enable sqlx-postgres, but only a few traits to support array in sea-query
with-json = [
"serde_json",
"sea-query/with-json",
"chrono?/serde",
"time?/serde",
"uuid?/serde",
"sea-query-binder?/with-json",
"sqlx?/json",
]
with-chrono = [
"chrono",
"sea-query/with-chrono",
"sea-query-binder?/with-chrono",
"sqlx?/chrono",
]
with-rust_decimal = [
"rust_decimal",
"sea-query/with-rust_decimal",
"sea-query-binder?/with-rust_decimal",
"sqlx?/rust_decimal",
]
with-bigdecimal = [
"bigdecimal",
"sea-query/with-bigdecimal",
"sea-query-binder?/with-bigdecimal",
"sqlx?/bigdecimal",
]
with-uuid = [
"uuid",
"sea-query/with-uuid",
"sea-query-binder?/with-uuid",
"sqlx?/uuid",
]
with-time = [
"time",
"sea-query/with-time",
"sea-query-binder?/with-time",
"sqlx?/time",
]
postgres-array = [
"sea-query/postgres-array",
"sea-query-binder?/postgres-array",
"sea-orm-macros/postgres-array",
]
json-array = [
"postgres-array",
] # this does not actually enable sqlx-postgres, but only a few traits to support array in sea-query
sea-orm-internal = []
sqlx-dep = []
sqlx-all = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite"]
sqlx-mysql = ["sqlx-dep", "sea-query-binder/sqlx-mysql", "sqlx/mysql"]
sqlx-postgres = ["sqlx-dep", "sea-query-binder/sqlx-postgres", "sqlx/postgres", "postgres-array"]
sqlx-postgres = [
"sqlx-dep",
"sea-query-binder/sqlx-postgres",
"sqlx/postgres",
"postgres-array",
]
sqlx-sqlite = ["sqlx-dep", "sea-query-binder/sqlx-sqlite", "sqlx/sqlite"]
sqlite-use-returning-for-3_35 = []
runtime-async-std = []
Expand Down
5 changes: 3 additions & 2 deletions sea-orm-macros/src/strum/enum_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
#[allow(
missing_copy_implementations,
)]
#vis struct #iter_name #ty_generics {
#vis struct #iter_name #impl_generics {
idx: usize,
back_idx: usize,
marker: ::core::marker::PhantomData #phantom_data,
}

impl #impl_generics core::fmt::Debug for #iter_name #ty_generics #where_clause {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
// We don't know if the variants implement debug themselves so the only thing we
Expand Down Expand Up @@ -159,6 +158,8 @@ pub fn enum_iter_inner(ast: &DeriveInput) -> syn::Result<TokenStream> {
}
}

impl #impl_generics ::core::iter::FusedIterator for #iter_name #ty_generics #where_clause { }

impl #impl_generics Clone for #iter_name #ty_generics #where_clause {
fn clone(&self) -> #iter_name #ty_generics {
#iter_name {
Expand Down
Loading