pub struct Projector<'conn> { /* private fields */ }Expand description
Replays events into the SQLite projection.
Create a Projector with a connection, then call [project_event] for
each event or [project_batch] for a slice.
Implementations§
Source§impl<'conn> Projector<'conn>
impl<'conn> Projector<'conn>
Sourcepub fn new(conn: &'conn Connection) -> Self
pub fn new(conn: &'conn Connection) -> Self
Create a new projector backed by the given connection.
Ensures the projected_events tracking table exists before any
projection work is attempted.
Sourcepub fn project_batch(&self, events: &[Event]) -> Result<ProjectionStats>
pub fn project_batch(&self, events: &[Event]) -> Result<ProjectionStats>
Project a batch of events, returning aggregate statistics.
Events are applied inside a single transaction for performance.
Duplicate events (same event_hash) are silently skipped.
§Errors
Returns an error if the transaction fails to commit. Individual event
projection errors are counted in stats.errors but do not abort the
batch.
Auto Trait Implementations§
impl<'conn> Freeze for Projector<'conn>
impl<'conn> !RefUnwindSafe for Projector<'conn>
impl<'conn> !Send for Projector<'conn>
impl<'conn> !Sync for Projector<'conn>
impl<'conn> Unpin for Projector<'conn>
impl<'conn> UnsafeUnpin for Projector<'conn>
impl<'conn> !UnwindSafe for Projector<'conn>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more