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

Generated entities: "the trait bound Option<Vec<Vec<u8>>>: TryGetable is not satisfied" #2342

Open
bragov4ik opened this issue Aug 29, 2024 · 0 comments

Comments

@bragov4ik
Copy link

Description

I run sea-orm-cli generate entity and the resulting rust code does not compile:

error[E0277]: the trait bound `Option<Vec<Vec<u8>>>: TryGetable` is not satisfied
  --> blockscout-db/entity/src/account_public_tags_requests.rs:5:35
   |
5  | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
   |                                   ^^^^^^^^^^^^^^^^^ the trait `TryGetable` is not implemented for `Option<Vec<Vec<u8>>>`

Steps to Reproduce

  1. Have a table with column of type bytea[]
  2. Generate entities from the table
  3. Try to compile the result

Expected Behavior

Compiles

Actual Behavior

Not compiles

Reproduces How Often

Consistent

Workarounds

Couldn't find any. postgres-array feature seems to be connected, but it doesn't compile with it enabled

Reproducible Example

Seems too simple to make a PR, let me know if it's actually needed:

//! `SeaORM` Entity, @generated by sea-orm-codegen 1.0.1

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "sample_table")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: i64,
    pub addresses: Option<Vec<Vec<u8>>>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}

Versions

  • database: postgres docker container (latest 5 months ago sha256:6b841c8f6a819884207402f1209a8116844365df15fca8cf556fc54a24c70800)
  • ❯ cargo tree | grep sea-
    │   └── sea-orm v1.0.1
    │       ├── sea-orm-macros v1.0.1 (proc-macro)
    │       │   ├── sea-bae v0.2.0 (proc-macro)
    │       ├── sea-query v0.31.0
    │       │   ├── sea-query-derive v0.4.1 (proc-macro)
    │       ├── sea-query-binder v0.6.0
    │       │   ├── sea-query v0.31.0 (*)
        └── sea-orm-migration v1.0.1
            ├── sea-orm v1.0.1 (*)
            ├── sea-orm-cli v1.0.1
            │   ├── sea-schema v0.15.0
            │   │   ├── sea-query v0.31.0 (*)
            │   │   └── sea-schema-derive v0.3.0 (proc-macro)
            ├── sea-schema v0.15.0 (*)
    
  • features = [ "sqlx-postgres", "runtime-tokio-rustls", "macros", "postgres-array" ], doesn't work with only postgres-array and without any as well
  • OS:
    System Version:	macOS 14.5 (23F79)
    Kernel Version:	Darwin 23.5.0
    

I would ask it in discord beforehand, but web version refuses to work for some reason 🤷

@bragov4ik bragov4ik changed the title Generated entities: the trait bound Option<Vec<Vec<u8>>>: TryGetable is not satisfied Generated entities: "the trait bound Option<Vec<Vec<u8>>>: TryGetable is not satisfied" Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant