[][src]Struct cqrs_postgres::PostgresStore

pub struct PostgresStore<'conn, A, E, M, S = NeverSnapshot> where
    A: Aggregate,
    E: AggregateEvent<A>,
    S: SnapshotStrategy
{ /* fields omitted */ }

A PostgreSQL storage backend.

Methods

impl<'conn, A, E, M, S> PostgresStore<'conn, A, E, M, S> where
    A: Aggregate,
    E: AggregateEvent<A>,
    S: SnapshotStrategy + Default
[src]

pub fn new(conn: &'conn Connection) -> Self[src]

Constructs a transient store based on a provided PostgreSQL connection using the default snapshot strategy.

pub fn with_snapshot_strategy(
    conn: &'conn Connection,
    snapshot_strategy: S
) -> Self
[src]

Constructs a transient store based on a provided PostgreSQL connection and snapshot strategy.

pub fn create_tables(&self) -> Result<(), Error>[src]

Creates the base set of tables required to support the CQRS system.

pub fn is_latest(&self) -> Result<bool, Error>[src]

Checks to see if the database is the latest version as seen by the current executable..

pub fn is_compatible(&self) -> Result<bool, Error>[src]

Checks to see if the database is compatible with the current executable.

pub fn get_entity_count(&self) -> Result<u64, Error>[src]

Gets the total number of entities of this type in the store.

pub fn get_entity_ids(
    &self,
    offset: u32,
    limit: u32
) -> Result<Vec<String>, Error>
[src]

Loads a page of entity IDs.

pub fn get_entity_count_matching_pattern(
    &self,
    pattern: &str
) -> Result<u64, Error>
[src]

Gets the total number of entities of this type matching a particular PostgreSQL pattern in the store.

PostgreSQL pattern matching rules:

  • _ matches any single character.
  • % matches any number of characters.

See the PostgreSQL documentation on pattern matching

pub fn get_entity_ids_matching_pattern(
    &self,
    pattern: &str,
    offset: u32,
    limit: u32
) -> Result<Vec<String>, Error>
[src]

Loads a page of entity IDs matching a particular PostgreSQL pattern.

PostgreSQL pattern matching rules:

  • _ matches any single character.
  • % matches any number of characters.

See the PostgreSQL documentation on pattern matching

pub fn get_entity_count_matching_sql_regex(
    &self,
    regex: &str
) -> Result<u64, Error>
[src]

Gets the total number of entities of this type matching a particular PostgreSQL regular expression in the store.

See the PostgreSQL documentation on pattern matching

pub fn get_entity_ids_matching_sql_regex(
    &self,
    regex: &str,
    offset: u32,
    limit: u32
) -> Result<Vec<String>, Error>
[src]

Loads a page of entity IDs matching a particular PostgreSQL regular expression.

See the PostgreSQL documentation on pattern matching

pub fn get_entity_count_matching_posix_regex(
    &self,
    regex: &str
) -> Result<u64, Error>
[src]

Gets the total number of entities of this type matching a particular POSIX regular expression in the store.

See the PostgreSQL documentation on pattern matching

pub fn get_entity_ids_matching_posix_regex(
    &self,
    regex: &str,
    offset: u32,
    limit: u32
) -> Result<Vec<String>, Error>
[src]

Loads a page of entity IDs matching a particular POSIX regular expression.

See the PostgreSQL documentation on pattern matching

pub fn read_events_with_metadata<I>(
    &self,
    id: &I,
    since: Since,
    max_count: Option<u64>
) -> Result<Option<Vec<Result<VersionedEventWithMetadata<E, M>, LoadError<E::Error>>>>, LoadError<E::Error>> where
    I: AggregateId<A>,
    E: DeserializableEvent,
    M: for<'de> Deserialize<'de>, 
[src]

Reads events and associated metadata from the event source for a given identifier.

Only loads events after the event number provided in since (See Since), and will only load a maximum of max_count events, if given. If not given, will read all remaining events.

Trait Implementations

impl<'conn, A: Clone, E: Clone, M: Clone, S: Clone> Clone for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate,
    E: AggregateEvent<A>,
    S: SnapshotStrategy
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'conn, A, E, M, S> Debug for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate,
    E: AggregateEvent<A>,
    S: SnapshotStrategy + Debug
[src]

impl<'conn, A, E, M, S> EventSource<A, E> for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate,
    E: AggregateEvent<A> + DeserializableEvent,
    S: SnapshotStrategy
[src]

type Error = LoadError<<E as DeserializableEvent>::Error>

The error type.

type Events = Vec<VersionedEvent<E>>

Represents the sequence of events read from the event source.

impl<'conn, A, E, M, S> EventSink<A, E, M> for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate,
    E: AggregateEvent<A> + SerializableEvent + Debug,
    M: Serialize + Debug,
    S: SnapshotStrategy
[src]

type Error = PersistError<<E as SerializableEvent>::Error>

The error type.

impl<'conn, A, E, M, S> SnapshotSource<A> for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate + DeserializeOwned,
    E: AggregateEvent<A>,
    S: SnapshotStrategy
[src]

type Error = Error

The error type.

impl<'conn, A, E, M, S> SnapshotSink<A> for PostgresStore<'conn, A, E, M, S> where
    A: Aggregate + Serialize + Debug,
    E: AggregateEvent<A>,
    S: SnapshotStrategy
[src]

type Error = PersistError<Error>

The error type.

Auto Trait Implementations

impl<'conn, A, E, M, S = NeverSnapshot> !Send for PostgresStore<'conn, A, E, M, S>

impl<'conn, A, E, M, S = NeverSnapshot> !Sync for PostgresStore<'conn, A, E, M, S>

Blanket Implementations

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

impl<T> From for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T