fkl_parser/mir/tactic/
aggregate.rs

1use serde::Deserialize;
2use serde::Serialize;
3use crate::mir::tactic::entity::Entity;
4
5// Cluster the entities and value objects into aggregates and define boundaries around each.
6// Choose one entity to be the root of each aggregate, and allow external objects to hold
7// references to the root only (references to internal members passed out for use within
8// a single operation only). Define properties and invariants for the aggregate as a whole and
9// give enforcement responsibility to the root or some designated framework mechanism.
10#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
11pub struct Aggregate {
12  pub name: String,
13  pub description: String,
14  pub entities: Vec<Entity>,
15}
16
17impl Aggregate {
18  pub fn new(name: &str) -> Self {
19    Aggregate { name: name.to_string(), description: "".to_string(), entities: vec![] }
20  }
21}
22