pub struct VitrailTransaction { /* private fields */ }Expand description
Explicit Postgres transaction handle for executing Vitrail operations atomically.
VitrailTransaction mirrors the core query and write methods on
crate::VitrailClient, which makes it straightforward to begin a
transaction, pass &VitrailTransaction through service layers, and then
explicitly commit() or rollback() when the workflow is complete.
A transaction owns a single database connection. Queries executed through the same transaction therefore run serially on that one connection, even if user code attempts to poll multiple futures concurrently.
Dropping an open transaction rolls it back through the underlying sqlx
transaction behavior, but explicit commit() or rollback() should remain
the primary application control flow.
Implementations§
Source§impl VitrailTransaction
impl VitrailTransaction
pub async fn find_many<Q>(
&self,
query: Q,
) -> Result<Vec<<Q as QuerySpec>::Output>, Error>where
Q: QuerySpec,
pub async fn find_optional<Q>(
&self,
query: Q,
) -> Result<Option<<Q as QuerySpec>::Output>, Error>where
Q: QuerySpec,
pub async fn find_first<Q>(
&self,
query: Q,
) -> Result<<Q as QuerySpec>::Output, Error>where
Q: QuerySpec,
pub async fn insert<I>(
&self,
insert: I,
) -> Result<<I as InsertSpec>::Output, Error>where
I: InsertSpec,
pub async fn update_many<U>(
&self,
update: U,
) -> Result<<U as UpdateSpec>::Output, Error>where
U: UpdateSpec,
pub async fn delete_many<D>(
&self,
delete: D,
) -> Result<<D as DeleteSpec>::Output, Error>where
D: DeleteSpec,
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for VitrailTransaction
impl !RefUnwindSafe for VitrailTransaction
impl Send for VitrailTransaction
impl Sync for VitrailTransaction
impl Unpin for VitrailTransaction
impl UnsafeUnpin for VitrailTransaction
impl !UnwindSafe for VitrailTransaction
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