pub struct TransaccionPostgres { /* private fields */ }Expand description
An open transaction. Dropping it without TransaccionPostgres::commit rolls it back — an early
? in a use case is the rollback.
Implementations§
Source§impl TransaccionPostgres
impl TransaccionPostgres
pub async fn begin(pool: &PgPool) -> Result<Self, ErrorRepositorio>
Sourcepub fn tx(&mut self) -> &mut PgConnection
pub fn tx(&mut self) -> &mut PgConnection
The connection the entity’s own writes run on: query(…).execute(uow.tx()).
Sourcepub async fn registrar(
&mut self,
event: &impl EventoDominio,
) -> Result<(), ErrorRepositorio>
pub async fn registrar( &mut self, event: &impl EventoDominio, ) -> Result<(), ErrorRepositorio>
Records a new event in the outbox, inside this transaction.
Sourcepub async fn registrar_sobre(
&mut self,
event: &SobreEvento,
) -> Result<(), ErrorRepositorio>
pub async fn registrar_sobre( &mut self, event: &SobreEvento, ) -> Result<(), ErrorRepositorio>
Records an envelope built by the caller — one carrying headers (correlation_id).
pub async fn commit(self) -> Result<(), ErrorRepositorio>
Auto Trait Implementations§
impl !RefUnwindSafe for TransaccionPostgres
impl !UnwindSafe for TransaccionPostgres
impl Forget for TransaccionPostgres
impl Freeze for TransaccionPostgres
impl Move for TransaccionPostgres
impl Send for TransaccionPostgres
impl Sync for TransaccionPostgres
impl Unpin for TransaccionPostgres
impl UnsafeUnpin for TransaccionPostgres
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> 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