#[projection]Expand description
Adds a cursor: String field and implements ProjectionCursor.
This attribute macro transforms a struct to track its position in the event stream.
It automatically adds a cursor field and implements the ProjectionCursor trait.
§Generated Code
- Adds
pub cursor: Stringfield - Adds
DefaultandClonederives (preserves existing derives) - Implements
ProjectionCursortrait
§Additional Derives
Pass additional derives as arguments:
ⓘ
#[evento::projection(serde::Serialize)]
pub struct MyView { ... }§Example
ⓘ
#[evento::projection]
#[derive(Debug)]
pub struct MyStruct {
pub id: String,
pub name: String,
}
// Generates:
// #[derive(Default, Clone, Debug)]
// pub struct MyStruct {
// pub id: String,
// pub name: String,
// pub cursor: String,
// }
//
// impl evento::ProjectionCursor for MyStruct { ... }