Under this section, the following example fails to compile because f32 does not implement Eq:
https://www.sea-ql.org/SeaORM/docs/generate-entity/entity-structure/#column-type
If you need your JSON field to be deserialized into a struct. You would need to derive FromJsonQueryResult for it.
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "json_struct")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
// JSON column defined in `serde_json::Value`
pub json: Json,
// JSON column defined in custom struct
pub json_value: KeyValue,
pub json_value_opt: Option<KeyValue>,
}
// The custom struct must derive `FromJsonQueryResult`, `Serialize` and `Deserialize`
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, FromJsonQueryResult)]
pub struct KeyValue {
pub id: i32,
pub name: String,
pub price: f32,
pub notes: Option<String>,
}
Under this section, the following example fails to compile because
f32does not implementEq:https://www.sea-ql.org/SeaORM/docs/generate-entity/entity-structure/#column-type