[−][src]Struct postgres_es::GenericQueryRepository
This provides a simple query repository that can be used both to return deserialized views and to act as a query processor.
Methods
impl<V, A, E> GenericQueryRepository<V, A, E> where
V: Query<A, E>,
E: DomainEvent<A>,
A: Aggregate,
[src]
V: Query<A, E>,
E: DomainEvent<A>,
A: Aggregate,
#[must_use]pub fn new(query_name: &str, conn: Connection) -> Self
[src]
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
).
pub fn with_error_handler(&mut self, error_handler: Box<dyn Fn(AggregateError)>)
[src]
Since inbound views cannot
#[must_use]pub fn view_name(&self) -> String
[src]
Returns the originally configured view name.
pub fn apply_events(
&self,
query_instance_id: &str,
events: &[EventEnvelope<A, E>]
)
[src]
&self,
query_instance_id: &str,
events: &[EventEnvelope<A, E>]
)
Used to apply committed events to a view.
pub fn load(&self, query_instance_id: String) -> Option<V>
[src]
Loads and deserializes a view based on the view id.
Trait Implementations
impl<Q, A, E> QueryProcessor<A, E> for GenericQueryRepository<Q, A, E> where
Q: Query<A, E>,
E: DomainEvent<A>,
A: Aggregate,
[src]
Q: Query<A, E>,
E: DomainEvent<A>,
A: Aggregate,
Auto Trait Implementations
impl<V, A, E> !RefUnwindSafe for GenericQueryRepository<V, A, E>
impl<V, A, E> !Send for GenericQueryRepository<V, A, E>
impl<V, A, E> !Sync for GenericQueryRepository<V, A, E>
impl<V, A, E> Unpin for GenericQueryRepository<V, A, E> where
A: Unpin,
E: Unpin,
V: Unpin,
A: Unpin,
E: Unpin,
V: Unpin,
impl<V, A, E> !UnwindSafe for GenericQueryRepository<V, A, E>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,