pub struct GenericQueryRepository<V, A>{ /* private fields */ }
Expand description
This provides a simple query repository that can be used both to return deserialized views and to act as a query processor.
Implementations§
Source§impl<V, A> GenericQueryRepository<V, A>
impl<V, A> GenericQueryRepository<V, A>
Sourcepub fn new(query_name: &str, conn: Client) -> Self
pub fn new(query_name: &str, conn: Client) -> Self
Creates a new GenericQueryRepository
that will store its’
views in the table named identically to the query_name
value provided. This table should be created by the user
previously (see /db/init.sql
).
Sourcepub fn with_error_handler(&mut self, error_handler: Box<dyn Fn(AggregateError)>)
pub fn with_error_handler(&mut self, error_handler: Box<dyn Fn(AggregateError)>)
Since inbound views cannot
Sourcepub fn apply_events(
&mut self,
query_instance_id: &str,
events: &[EventEnvelope<A>],
)
pub fn apply_events( &mut self, query_instance_id: &str, events: &[EventEnvelope<A>], )
Used to apply committed events to a view.
Trait Implementations§
Source§impl<Q, A> QueryProcessor<A> for GenericQueryRepository<Q, A>
impl<Q, A> QueryProcessor<A> for GenericQueryRepository<Q, A>
Source§fn dispatch(&mut self, query_instance_id: &str, events: &[EventEnvelope<A>])
fn dispatch(&mut self, query_instance_id: &str, events: &[EventEnvelope<A>])
Events will be dispatched here immediately after being
committed for the downstream queries to be updated.
Auto Trait Implementations§
impl<V, A> !Freeze for GenericQueryRepository<V, A>
impl<V, A> !RefUnwindSafe for GenericQueryRepository<V, A>
impl<V, A> !Send for GenericQueryRepository<V, A>
impl<V, A> !Sync for GenericQueryRepository<V, A>
impl<V, A> Unpin for GenericQueryRepository<V, A>
impl<V, A> !UnwindSafe for GenericQueryRepository<V, A>
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