-
Notifications
You must be signed in to change notification settings - Fork 3
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
upgrade to sea-orm 0.12 and fix code #5
upgrade to sea-orm 0.12 and fix code #5
Conversation
@@ -187,7 +187,7 @@ pub fn get_actix_admin_fields_searchable(fields: &Vec<ModelField>) -> Vec<TokenS | |||
let column_name = capitalize_first_letter(&model_field.ident.to_string()); | |||
let column_ident = Ident::new(&column_name, Span::call_site()); | |||
quote! { | |||
.add(Column::#column_ident.contains(&search)) | |||
.add(Column::#column_ident.contains(search)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the main error;
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `actix-admin` (test "post_create_and_edit_is_success") due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `actix-admin` (test "delete_is_success") due to 4 previous errors
error: could not compile `actix-admin` (test "get_request_is_success") due to 4 previous errors
error[E0277]: the trait bound `std::string::String: std::convert::From<&&str>` is not satisfied
--> examples/basic/entity/post.rs:9:123
|
9 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize, DeriveActixAdmin, DeriveActixAdminViewModel, DeriveActixAdminModel, DeriveActixAdminModelSelectList)]
| ^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<&&str>` is not implemented for `std::string::String`
|
= note: required for `&&str` to implement `Into<std::string::String>`
note: required by a bound in `sea_orm::ColumnTrait::contains`
--> /Users/keith/.asdf/installs/rust/1.71.1/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-0.12.2/src/entity/column.rs:228:12
|
226 | fn contains<T>(&self, s: T) -> SimpleExpr
| -------- required by a bound in this associated function
227 | where
228 | T: Into<String>,
| ^^^^^^^^^^^^ required by this bound in `ColumnTrait::contains`
= note: this error originates in the derive macro `DeriveActixAdminModel` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider dereferencing here
|
9 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize, DeriveActixAdmin, DeriveActixAdminViewModel, *DeriveActixAdminModel, DeriveActixAdminModelSelectList)]
|
@@ -46,7 +46,7 @@ impl Related<super::comment::Entity> for Entity { | |||
|
|||
impl ActiveModelBehavior for ActiveModel {} | |||
|
|||
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Deserialize, Serialize, DeriveActixAdminEnumSelectList)] | |||
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveDisplay, DeriveActiveEnum, Deserialize, Serialize, DeriveActixAdminEnumSelectList)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the main error was fixed I got errors about these.
error[E0599]: `Tea` doesn't implement `std::fmt::Display`
--> tests/test_setup/post.rs:8:123
|
8 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Deserialize, Serialize, DeriveActixAdmin, DeriveActixAdminViewModel, DeriveActixAdminModel, DeriveActixAdminModelSelectList)]
| ^^^^^^^^^^^^^^^^^^^^^ `Tea` cannot be formatted with the default formatter
...
51 | pub enum Tea {
| ------------
| |
| method `to_string` not found for this enum
| doesn't satisfy `Tea: ToString`
| doesn't satisfy `Tea: std::fmt::Display`
|
= note: the following trait bounds were not satisfied:
`Tea: std::fmt::Display`
which is required by `Tea: ToString`
note: the trait `std::fmt::Display` must be implemented
--> /Users/keith/.asdf/installs/rust/1.71.1/toolchains/1.71.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:648:1
|
648 | pub trait Display {
| ^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `DeriveActixAdminModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: `Tea` doesn't implement `std::fmt::Display`
--> tests/test_setup/post.rs:49:87
|
49 | #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Deserialize, Serialize, DeriveActixAdminEnumSelectList)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Tea` cannot be formatted with the default formatter
50 | #[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "tea")]
51 | pub enum Tea {
| ------------
| |
| method `to_string` not found for this enum
| doesn't satisfy `Tea: ToString`
| doesn't satisfy `Tea: std::fmt::Display`
|
= note: the following trait bounds were not satisfied:
`Tea: std::fmt::Display`
which is required by `Tea: ToString`
note: the trait `std::fmt::Display` must be implemented
--> /Users/keith/.asdf/installs/rust/1.71.1/toolchains/1.71.1-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:648:1
|
648 | pub trait Display {
| ^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `DeriveActixAdminEnumSelectList` (in Nightly builds, run with -Z macro-backtrace for more info)
Which lead me to SeaQL/sea-orm#1726 where I saw that they pulled out the default Display
impl.
Hi @keithamus Thank you so much for your effort and work! |
Hey @mgugger, I tried to use this project with sea-orm 0.12 and got some errors due to a double reference on
.contains
. When trying to fix it I noticed that sea-orm 0.12 also dropped the defaultDisplay
implementation forDeriveActiveEnum
, which meansDisplay
needs to either be manually implemented, or you can use the fallbackDeriveDisplay
which re-introduces the old derived trait, so I've altered the enums in the example code to addDeriveDisplay
which gets the code compiling.Itertools was also out of date so I updated that, no other changes needed to be made for that though.