framework_cqrs_lib/cqrs/infra/daos/
dbos.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use mongodb::bson::oid::ObjectId;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct EntityDBO<DATA, ID> {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub id_mongo: Option<ObjectId>,
    pub version: Option<u32>,
    #[serde(rename = "id")]
    pub entity_id: ID,
    pub data: DATA,
}

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct EventDBO<DATA, ID> {
    #[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
    pub id_mongo: Option<ObjectId>,
    pub version: Option<u32>,
    pub entity_id: ID,
    #[serde(rename = "id")]
    pub event_id: ID,
    pub data: DATA,
}