SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
7.37k stars 517 forks source link

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

Open bragov4ik opened 2 months ago

bragov4ik commented 2 months ago

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

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