domain_derive
This crate provides domain_patterns
derive macros.
Entity macro
The Entity
derive macro can be used to automatically implement all methods of the Entity
trait
from the domain_patterns
crate. This only works if certain preconditions are met:
- You are applying this to a struct.
- Your struct has an
id
field of typeUuid
. - Your struct has a
version
field which is some integer type.
#[macro_use]
extern crate domain_derive;
use uuid::Uuid;
#[derive(Entity)]
struct User {
id: Uuid,
version: u64
};