You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an error when trying to use Vec<RoleEnum> with sea-orm's DeriveEntityModel macro. The error message indicates that the method into_value exists for ActiveValue<Vec<RoleEnum>>, but its trait bounds were not satisfied.
Steps to Reproduce
Use the CLI command to generate the entity: sea-orm-cli generate entity -u postgres://postgres:postgres@db:5432/postgres -o entity/src -l --with-serde both --serde-skip-deserializing-primary-key
Use Vec<RoleEnum> as a field in a struct that derives DeriveEntityModel.
Run the build command: cargo build --manifest-path crates/entity/Cargo.toml
Expected Behavior
The Vec<RoleEnum> should be correctly converted to sea_orm::Value and work seamlessly with DeriveEntityModel, but sea-orm-cli does not generate the necessary trait implementations.
Actual Behavior
The compiler throws an error indicating that sea_orm::Value: From<Vec> is not satisfied, and thus Vec cannot be converted into sea_orm::Value.
dev ➜ /workspaces/workerd-manager (master) $ cargo build --manifest-path crates/entity/Cargo.toml
Compiling entity v0.1.0 (/workspaces/workerd-manager/crates/entity)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
note: required by a bound in `ActiveValue`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:42:8
|
40 | pub enum ActiveValue<V>
| ----------- required by a bound in this enum
41 | where
42 | V: Into<Value>,
| ^^^^^^^^^^^ required by this bound in `ActiveValue`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Vec<RoleEnum>: ValueType` is not satisfied
--> crates/entity/src/user.rs:18:5
|
18 | pub roles: Vec<RoleEnum>,
| ^^^ the trait `ValueType` is not implemented for `Vec<RoleEnum>`
|
= help: the trait `ValueType` is implemented for `Vec<u8>`
error[E0277]: the trait bound `Vec<RoleEnum>: TryGetable` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `TryGetable` is not implemented for `Vec<RoleEnum>`
|
= help: the following other types implement trait `TryGetable`:
Vec<T>
Vec<u8>
note: required by a bound in `QueryResult::try_get`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/executor/query.rs:93:12
|
91 | pub fn try_get<T>(&self, pre: &str, col: &str) -> Result<T, DbErr>
| ------- required by a bound in this associated function
92 | where
93 | T: TryGetable,
| ^^^^^^^^^^ required by this bound in `QueryResult::try_get`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `Vec<RoleEnum>: ValueType` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `ValueType` is not implemented for `Vec<RoleEnum>`
|
= help: the trait `ValueType` is implemented for `Vec<u8>`
note: required by a bound in `sea_orm::Value::unwrap`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.31.0/src/value.rs:310:12
|
308 | pub fn unwrap<T>(self) -> T
| ------ required by a bound in this associated function
309 | where
310 | T: ValueType,
| ^^^^^^^^^ required by this bound in `Value::unwrap`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `ActiveValue<Vec<RoleEnum>>: Clone`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
= note: required for `ActiveValue<Vec<RoleEnum>>` to implement `Clone`
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `ActiveValue<Vec<RoleEnum>>: Debug`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
= note: required for `ActiveValue<Vec<RoleEnum>>` to implement `Debug`
= note: required for the cast from `&ActiveValue<Vec<RoleEnum>>` to `&dyn Debug`
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `==` cannot be applied to type `ActiveValue<Vec<RoleEnum>>`
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
note: required by a bound in `ActiveValue::<V>::unchanged`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:775:8
|
775 | V: Into<Value>,
| ^^^^^^^^^^^ required by this bound in `ActiveValue::<V>::unchanged`
...
788 | pub fn unchanged(value: V) -> Self {
| --------- required by a bound in this associated function
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `into_wrapped_value` exists for enum `ActiveValue<Vec<RoleEnum>>`, but its trait bounds were not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ method cannot be called on `ActiveValue<Vec<RoleEnum>>` due to unsatisfied trait bounds
|
::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.31.0/src/value.rs:132:1
|
132 | pub enum Value {
| -------------- doesn't satisfy `sea_orm::Value: From<Vec<RoleEnum>>`
|
::: /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:1
|
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= note: the following trait bounds were not satisfied:
`sea_orm::Value: From<Vec<RoleEnum>>`
which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `clone` exists for enum `ActiveValue<Vec<RoleEnum>>`, but its trait bounds were not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ method cannot be called on `ActiveValue<Vec<RoleEnum>>` due to unsatisfied trait bounds
|
::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:40:1
|
40 | pub enum ActiveValue<V>
| ----------------------- doesn't satisfy `ActiveValue<Vec<RoleEnum>>: Clone`
|
::: /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:1
|
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= note: the following trait bounds were not satisfied:
`Vec<RoleEnum>: Into<sea_orm::Value>`
which is required by `ActiveValue<Vec<RoleEnum>>: Clone`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
note: required by a bound in `ActiveValue::<V>::set`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:775:8
|
775 | V: Into<Value>,
| ^^^^^^^^^^^ required by this bound in `ActiveValue::<V>::set`
...
778 | pub fn set(value: V) -> Self {
| --- required by a bound in this associated function
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
note: required by a bound in `ActiveValue::<V>::not_set`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:775:8
|
775 | V: Into<Value>,
| ^^^^^^^^^^^ required by this bound in `ActiveValue::<V>::not_set`
...
798 | pub fn not_set() -> Self {
| ------- required by a bound in this associated function
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `is_not_set` exists for enum `ActiveValue<Vec<RoleEnum>>`, but its trait bounds were not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ method cannot be called on `ActiveValue<Vec<RoleEnum>>` due to unsatisfied trait bounds
|
::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.31.0/src/value.rs:132:1
|
132 | pub enum Value {
| -------------- doesn't satisfy `sea_orm::Value: From<Vec<RoleEnum>>`
|
::: /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:1
|
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= note: the following trait bounds were not satisfied:
`sea_orm::Value: From<Vec<RoleEnum>>`
which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `reset` exists for enum `ActiveValue<Vec<RoleEnum>>`, but its trait bounds were not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ method cannot be called on `ActiveValue<Vec<RoleEnum>>` due to unsatisfied trait bounds
|
::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.31.0/src/value.rs:132:1
|
132 | pub enum Value {
| -------------- doesn't satisfy `sea_orm::Value: From<Vec<RoleEnum>>`
|
::: /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:1
|
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= note: the following trait bounds were not satisfied:
`sea_orm::Value: From<Vec<RoleEnum>>`
which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `sea_orm::Value: From<Vec<RoleEnum>>` is not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ the trait `From<Vec<RoleEnum>>` is not implemented for `sea_orm::Value`, which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= help: the following other types implement trait `From<T>`:
<sea_orm::Value as From<&[u8]>>
<sea_orm::Value as From<&std::string::String>>
<sea_orm::Value as From<&str>>
<sea_orm::Value as From<Cow<'_, str>>>
<sea_orm::Value as From<JsonValue>>
<sea_orm::Value as From<Vec<u8>>>
<sea_orm::Value as From<bool>>
<sea_orm::Value as From<char>>
and 29 others
= note: required for `Vec<RoleEnum>` to implement `Into<sea_orm::Value>`
note: required by a bound in `NotSet`
--> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-orm-1.0.0/src/entity/active_model.rs:42:8
|
42 | V: Into<Value>,
| ^^^^^^^^^^^ required by this bound in `NotSet`
...
49 | NotSet,
| ------ required by a bound in this unit variant
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0599]: the method `into_value` exists for enum `ActiveValue<Vec<RoleEnum>>`, but its trait bounds were not satisfied
--> crates/entity/src/user.rs:7:35
|
7 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
| ^^^^^^^^^^^^^^^^^ method cannot be called on `ActiveValue<Vec<RoleEnum>>` due to unsatisfied trait bounds
|
::: /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/sea-query-0.31.0/src/value.rs:132:1
|
132 | pub enum Value {
| -------------- doesn't satisfy `sea_orm::Value: From<Vec<RoleEnum>>`
|
::: /usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:398:1
|
398 | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
| ------------------------------------------------------------------------------------------------ doesn't satisfy `Vec<RoleEnum>: Into<sea_orm::Value>`
|
= note: the following trait bounds were not satisfied:
`sea_orm::Value: From<Vec<RoleEnum>>`
which is required by `Vec<RoleEnum>: Into<sea_orm::Value>`
= note: this error originates in the derive macro `DeriveEntityModel` (in Nightly builds, run with -Z macro-backtrace for more info)
Some errors have detailed explanations: E0277, E0369, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `entity` (lib) due to 20 previous errors
Description
I am encountering an error when trying to use
Vec<RoleEnum>
with sea-orm's DeriveEntityModel macro. The error message indicates that the method into_value exists forActiveValue<Vec<RoleEnum>>
, but its trait bounds were not satisfied.Steps to Reproduce
sea-orm-cli generate entity -u postgres://postgres:postgres@db:5432/postgres -o entity/src -l --with-serde both --serde-skip-deserializing-primary-key
Vec<RoleEnum>
as a field in a struct that derives DeriveEntityModel.cargo build --manifest-path crates/entity/Cargo.toml
Expected Behavior
The
Vec<RoleEnum>
should be correctly converted tosea_orm::Value
and work seamlessly with DeriveEntityModel, but sea-orm-cli does not generate the necessary trait implementations.Actual Behavior
The compiler throws an error indicating that sea_orm::Value: From<Vec> is not satisfied, and thus Vec cannot be converted into sea_orm::Value.
Additional Information
Versions
The text was updated successfully, but these errors were encountered: