pub struct DbOpWithTime<'c> { /* private fields */ }Expand description
Equivileant of DbOp just that the time is guaranteed to be cached.
Used as a wrapper of a sqlx::Transaction with cached time of the transaction.
Implementations§
Source§impl<'c> DbOpWithTime<'c>
impl<'c> DbOpWithTime<'c>
Sourcepub fn now(&self) -> DateTime<Utc>
pub fn now(&self) -> DateTime<Utc>
The cached chrono::DateTime
Sourcepub async fn begin(&mut self) -> Result<DbOpWithTime<'_>, Error>
pub async fn begin(&mut self) -> Result<DbOpWithTime<'_>, Error>
Begins a nested transaction.
Sourcepub fn tx_mut(&mut self) -> &mut Transaction<'c, Postgres>
pub fn tx_mut(&mut self) -> &mut Transaction<'c, Postgres>
Gets a mutable handle to the inner transaction
Trait Implementations§
Source§impl<'o> AtomicOperation for DbOpWithTime<'o>
impl<'o> AtomicOperation for DbOpWithTime<'o>
Source§fn maybe_now(&self) -> Option<DateTime<Utc>>
fn maybe_now(&self) -> Option<DateTime<Utc>>
Function for querying when the operation is taking place - if it is cached.
Source§fn as_executor(&mut self) -> &mut PgConnection
fn as_executor(&mut self) -> &mut PgConnection
Returns the
sqlx::Executor implementation.
The desired way to represent this would actually be as a GAT: Read moreSource§fn add_commit_hook<H: CommitHook>(&mut self, hook: H) -> Result<(), H>
fn add_commit_hook<H: CommitHook>(&mut self, hook: H) -> Result<(), H>
Registers a commit hook that will run pre_commit before and post_commit after the transaction commits.
Returns Ok(()) if the hook was registered, Err(hook) if hooks are not supported.
Source§impl<'o> AtomicOperationWithTime for DbOpWithTime<'o>
impl<'o> AtomicOperationWithTime for DbOpWithTime<'o>
Auto Trait Implementations§
impl<'c> Freeze for DbOpWithTime<'c>
impl<'c> !RefUnwindSafe for DbOpWithTime<'c>
impl<'c> Send for DbOpWithTime<'c>
impl<'c> !Sync for DbOpWithTime<'c>
impl<'c> Unpin for DbOpWithTime<'c>
impl<'c> !UnwindSafe for DbOpWithTime<'c>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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