[−][src]Struct cqrs_postgres::PostgresStore
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]
A: Aggregate,
E: AggregateEvent<A>,
S: SnapshotStrategy + Default,
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]
conn: &'conn Connection,
snapshot_strategy: S
) -> Self
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]
&self,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
Loads a page of entity IDs.
pub fn get_entity_count_matching_pattern(
&self,
pattern: &str
) -> Result<u64, Error>
[src]
&self,
pattern: &str
) -> Result<u64, Error>
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.
pub fn get_entity_ids_matching_pattern(
&self,
pattern: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
[src]
&self,
pattern: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
Loads a page of entity IDs matching a particular PostgreSQL pattern.
PostgreSQL pattern matching rules:
_
matches any single character.%
matches any number of characters.
pub fn get_entity_count_matching_sql_regex(
&self,
regex: &str
) -> Result<u64, Error>
[src]
&self,
regex: &str
) -> Result<u64, Error>
Gets the total number of entities of this type matching a particular PostgreSQL regular expression in the store.
pub fn get_entity_ids_matching_sql_regex(
&self,
regex: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
[src]
&self,
regex: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
Loads a page of entity IDs matching a particular PostgreSQL regular expression.
pub fn get_entity_count_matching_posix_regex(
&self,
regex: &str
) -> Result<u64, Error>
[src]
&self,
regex: &str
) -> Result<u64, Error>
Gets the total number of entities of this type matching a particular POSIX regular expression in the store.
pub fn get_entity_ids_matching_posix_regex(
&self,
regex: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
[src]
&self,
regex: &str,
offset: u32,
limit: u32
) -> Result<Vec<String>, Error>
Loads a page of entity IDs matching a particular POSIX regular expression.
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]
&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>,
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]
A: Aggregate,
E: AggregateEvent<A>,
S: SnapshotStrategy,
fn clone(&self) -> PostgresStore<'conn, A, E, M, S>
[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]
A: Aggregate,
E: AggregateEvent<A>,
S: SnapshotStrategy + Debug,
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]
A: Aggregate,
E: AggregateEvent<A> + DeserializableEvent,
S: SnapshotStrategy,
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.
fn read_events<I>(
&self,
id: &I,
since: Since,
max_count: Option<u64>
) -> Result<Option<Self::Events>, Self::Error> where
I: AggregateId<A>,
[src]
&self,
id: &I,
since: Since,
max_count: Option<u64>
) -> Result<Option<Self::Events>, Self::Error> where
I: AggregateId<A>,
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]
A: Aggregate,
E: AggregateEvent<A> + SerializableEvent + Debug,
M: Serialize + Debug,
S: SnapshotStrategy,
type Error = PersistError<<E as SerializableEvent>::Error>
The error type.
fn append_events<I>(
&self,
id: &I,
events: &[E],
precondition: Option<Precondition>,
metadata: M
) -> Result<EventNumber, Self::Error> where
I: AggregateId<A>,
[src]
&self,
id: &I,
events: &[E],
precondition: Option<Precondition>,
metadata: M
) -> Result<EventNumber, Self::Error> where
I: AggregateId<A>,
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]
A: Aggregate + DeserializeOwned,
E: AggregateEvent<A>,
S: SnapshotStrategy,
type Error = Error
The error type.
fn get_snapshot<I>(
&self,
id: &I
) -> Result<Option<VersionedAggregate<A>>, Self::Error> where
I: AggregateId<A>,
[src]
&self,
id: &I
) -> Result<Option<VersionedAggregate<A>>, Self::Error> where
I: AggregateId<A>,
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]
A: Aggregate + Serialize + Debug,
E: AggregateEvent<A>,
S: SnapshotStrategy,
type Error = PersistError<Error>
The error type.
fn persist_snapshot<I>(
&self,
id: &I,
aggregate: &A,
version: Version,
last_snapshot_version: Option<Version>
) -> Result<Version, Self::Error> where
I: AggregateId<A>,
[src]
&self,
id: &I,
aggregate: &A,
version: Version,
last_snapshot_version: Option<Version>
) -> Result<Version, Self::Error> where
I: AggregateId<A>,
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]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
type Output = T
Should always be Self