pub struct PostgresEventRepository { /* private fields */ }
Expand description

An event repository relying on a Postgres database for persistence.

Implementations

Creates a new PostgresEventRepository from the provided database connection. This uses the default tables ‘events’ and ‘snapshots’.

use sqlx::{Pool, Postgres};
use postgres_es::PostgresEventRepository;

fn configure_repo(pool: Pool<Postgres>) -> PostgresEventRepository {
    PostgresEventRepository::new(pool)
}

Configures a PostgresEventRepository to use a streaming queue of the provided size.

Example: configure the repository to stream with a 1000 event buffer.

use sqlx::{Pool, Postgres};
use postgres_es::PostgresEventRepository;

fn configure_repo(pool: Pool<Postgres>) -> PostgresEventRepository {
    let store = PostgresEventRepository::new(pool);
    store.with_streaming_channel_size(1000)
}

Configures a PostgresEventRepository to use the provided table names.

Example: configure the repository to use “my_event_table” and “my_snapshot_table” for the event and snapshot table names.

use sqlx::{Pool, Postgres};
use postgres_es::PostgresEventRepository;

fn configure_repo(pool: Pool<Postgres>) -> PostgresEventRepository {
    let store = PostgresEventRepository::new(pool);
    store.with_tables("my_event_table", "my_snapshot_table")
}

Trait Implementations

An iterator of serialized event returned for streaming calls. Returns all events for a single aggregate instance. Read more

Returns the last events for a single aggregate instance.

Returns the current snapshot for an aggregate instance.

Commits the updated aggregate and accompanying events.

Streams all events for an aggregate instance.

Streams all events for an aggregate type.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.