pub struct PgOutboxPublisher { /* private fields */ }Expand description
PostgreSQL implementation of OutboxPublisher backed by sqlx::PgPool.
Cheap to clone (the pool and the cached insert statement are reference-counted).
Implementations§
Source§impl PgOutboxPublisher
impl PgOutboxPublisher
Sourcepub fn new(
pool: PgPool,
table_name: impl Into<String>,
) -> Result<Self, OutboxError>
pub fn new( pool: PgPool, table_name: impl Into<String>, ) -> Result<Self, OutboxError>
Create a new publisher for the given pool and table.
§Errors
Returns OutboxError::Internal if table_name is not a valid
identifier matching ^[a-zA-Z_][a-zA-Z0-9_]*$.
Sourcepub fn pool(&self) -> &PgPool
pub fn pool(&self) -> &PgPool
Underlying pool, exposed for callers that open their own transactions.
Sourcepub fn table_name(&self) -> &str
pub fn table_name(&self) -> &str
Configured table name.
Trait Implementations§
Source§impl Clone for PgOutboxPublisher
impl Clone for PgOutboxPublisher
Source§fn clone(&self) -> PgOutboxPublisher
fn clone(&self) -> PgOutboxPublisher
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PgOutboxPublisher
impl Debug for PgOutboxPublisher
Source§impl OutboxPublisher for PgOutboxPublisher
impl OutboxPublisher for PgOutboxPublisher
Source§type Tx<'tx> = Transaction<'tx, Postgres>
type Tx<'tx> = Transaction<'tx, Postgres>
Backend-specific transaction handle borrowed by
publish_in_tx. Read moreSource§async fn publish_in_tx<E: Event>(
&self,
tx: &mut Self::Tx<'_>,
event: &E,
) -> Result<Uuid, OutboxError>
async fn publish_in_tx<E: Event>( &self, tx: &mut Self::Tx<'_>, event: &E, ) -> Result<Uuid, OutboxError>
Insert an event using an existing business transaction. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PgOutboxPublisher
impl !UnwindSafe for PgOutboxPublisher
impl Freeze for PgOutboxPublisher
impl Send for PgOutboxPublisher
impl Sync for PgOutboxPublisher
impl Unpin for PgOutboxPublisher
impl UnsafeUnpin for PgOutboxPublisher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more