Struct postgres_es::GenericQueryRepository[][src]

pub struct GenericQueryRepository<V, A> where
    V: Query<A>,
    A: Aggregate
{ /* fields omitted */ }
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

impl<V, A> GenericQueryRepository<V, A> where
    V: Query<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, query_instance_id: &str, events: &[EventEnvelope<A>])[src]

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> QueryProcessor<A> for GenericQueryRepository<Q, A> where
    Q: Query<A>,
    A: Aggregate
[src]

fn dispatch(&self, query_instance_id: &str, events: &[EventEnvelope<A>])[src]

Events will be dispatched here immediately after being committed for the downstream queries to be updated. Read more

Auto Trait Implementations

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> where
    A: Unpin,
    V: Unpin

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

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.