use sea_orm::entity::prelude::*; use sea_orm::FromJsonQueryResult; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[sea_orm(table_name = "json_struct")] pub struct Model { #[sea_orm(primary_key)] pub id: i32, pub json: Json, pub json_value: KeyValue, pub json_value_opt: Option, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize, FromJsonQueryResult)] pub struct KeyValue { pub id: i32, pub name: String, pub price: f32, pub notes: Option, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} impl ActiveModelBehavior for ActiveModel {}