SeaQL / sea-orm

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

Support for `HashMap` #2333

Open IgnisDa opened 1 month ago

IgnisDa commented 1 month ago

Would it be possible to add support for this:

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "daily_user_activity")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: String,
    pub state: HashMap<String, String>,
}

Right now it throws a compile time error:

the trait bound `std::collections::HashMap<std::string::String, std::string::String>: sea_orm::sea_query::ValueType` is not satisfied

I tend to store these in JSONB columns in Postgres.