[][src]Struct postgres_es::GenericQueryRepository

pub struct GenericQueryRepository<V, A, E> where
    V: Query<A, E>,
    E: DomainEvent<A>,
    A: Aggregate
{ /* fields omitted */ }

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]

#[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,
    conn: &Connection,
    query_instance_id: &str,
    events: &[MessageEnvelope<A, E>]
)
[src]

Used to apply committed events to a view.

pub fn load(&self, conn: &Connection, 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]

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

impl<V, A, E> !UnwindSafe for GenericQueryRepository<V, A, E>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.