sourcerer-derive 0.1.2

Procedural macros for the sourcerer event-sourcing framework. Provides #[derive(Event)] for automatic event trait implementation.
Documentation

sourcerer-derive

Procedural macros for the sourcerer event-sourcing framework.

Currently it provides a single derive macro:

#[derive(Event)]

Implements the sourcerer::Event trait for enums and supports the #[event(...)] helper attribute.

use serde::{Serialize, Deserialize};
use sourcerer_derive::Event;

#[derive(Serialize, Deserialize, Event)]
#[event(version = 2, source = "urn:my-service")]
enum AccountEvent {
    Opened,
    #[event(version = 3)]
    Credited { amount: u64 },
    #[event(source = "urn:custom")]
    Debited(u64),
}

The generated implementation:

  • returns the variant name from event_type().
  • uses the configured version/source, with per-variant overrides.

Add the macro via the re-exported derive feature on sourcerer, or depend directly:

[dependencies]
sourcerer-derive = "0.1"

Licensed under MIT – see LICENSE.