[−][src]Derive Macro domain_derive::DomainEvent
#[derive(DomainEvent)]
The DomainEvent
macro should be applied to a struct that represents a DomainEvent. It completely
implements all methods of the DomainEvent
trait, as long as some preconditions are met:
- You are applying this to a struct.
- There needs to be an
id
field of typeUuid
. - There needs to be a version field of any integer type (floating point not allowed).
- There needs to be an
aggregate_id
field of typeUuid
. - There needs to be an
occurred
field of typei64
.
ⓘThis code runs with edition 2018
#[macro_use] extern crate domain_derive; use uuid::Uuid; use domain_patterns::event::DomainEvent; #[derive(Serialize, Clone, DomainEvent)] pub struct FirstNameUpdatedEvent { pub id: Uuid, pub aggregate_id: String, pub first_name: String, pub version: u64, pub occurred: i64, }