Skip to main content

TimedSqlxKeepsakeRepository

Struct TimedSqlxKeepsakeRepository 

Source
pub struct TimedSqlxKeepsakeRepository<'repo, B, C = NoopRelationCache>{ /* private fields */ }
Expand description

Timestamp-scoped repository view.

This wrapper does not read the system clock. Callers choose the timestamp once at an operation boundary, then use the forwarding methods to keep related writes and expiry scans on the same deterministic instant.

Implementations§

Source§

impl<'repo, B, C> TimedSqlxKeepsakeRepository<'repo, B, C>

Source

pub const fn repository(&self) -> &'repo SqlxKeepsakeRepository<B, C>

Returns the repository backing this timestamp-scoped view.

Source

pub const fn timestamp(&self) -> DateTime<Utc>

Returns the timestamp applied by forwarding methods.

Source§

impl<C> TimedSqlxKeepsakeRepository<'_, PostgresBackend, C>
where C: RelationCache,

Source

pub async fn upsert_relation( &self, relation: &RelationDefinition, ) -> RepositoryResult<RelationDefinition>

Inserts or updates a relation definition using this view’s timestamp.

Source

pub async fn upsert_relation_spec<Spec>( &self, ) -> RepositoryResult<RelationDefinition>
where Spec: RelationSpec,

Inserts or updates a typed relation spec using this view’s timestamp.

Source

pub async fn set_relation_enabled( &self, relation_id: RelationId, enabled: bool, ) -> RepositoryResult<bool>

Enables or disables a relation using this view’s timestamp.

Source

pub async fn due_timed_expiry( &self, limit: i64, ) -> RepositoryResult<Vec<TimedExpiryCandidate>>

Lists due timed expiry candidates using this view’s timestamp.

Source

pub async fn expire_due_timed(&self, limit: i64) -> RepositoryResult<u64>

Expires a stable batch of due timed keepsakes using this view’s timestamp.

Source

pub async fn fulfillment_snapshot( &self, keepsake_id: Uuid, ) -> RepositoryResult<FulfillmentSnapshot>

Reads the persisted fulfillment counter snapshot for a keepsake.

Source

pub async fn due_fulfilled_expiry( &self, limit: i64, ) -> RepositoryResult<Vec<FulfilledExpiryCandidate>>

Lists fulfillment expiry candidates.

Source

pub async fn expire_due_fulfilled(&self, limit: i64) -> RepositoryResult<u64>

Expires fulfillment-satisfied keepsakes using this view’s timestamp.

Source

pub async fn upsert_counter_projection( &self, keepsake_id: Uuid, key: &str, value: i64, ) -> RepositoryResult<()>

Upserts a simple fulfillment counter projection using this view’s timestamp.

Source

pub async fn increment_counter_projection( &self, keepsake_id: Uuid, key: &str, delta: i64, ) -> RepositoryResult<i64>

Atomically increments a fulfillment counter using this view’s timestamp.

Source

pub async fn upsert_checklist_projection( &self, keepsake_id: Uuid, item: &str, complete: bool, ) -> RepositoryResult<()>

Upserts a checklist item completion projection using this view’s timestamp.

Trait Implementations§

Source§

impl<'repo, B, C: Clone> Clone for TimedSqlxKeepsakeRepository<'repo, B, C>

Source§

fn clone(&self) -> TimedSqlxKeepsakeRepository<'repo, B, C>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'repo, B, C: Copy> Copy for TimedSqlxKeepsakeRepository<'repo, B, C>

Source§

impl<'repo, B, C: Debug> Debug for TimedSqlxKeepsakeRepository<'repo, B, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'repo, B, C = NoopRelationCache> !RefUnwindSafe for TimedSqlxKeepsakeRepository<'repo, B, C>

§

impl<'repo, B, C = NoopRelationCache> !UnwindSafe for TimedSqlxKeepsakeRepository<'repo, B, C>

§

impl<'repo, B, C> Freeze for TimedSqlxKeepsakeRepository<'repo, B, C>

§

impl<'repo, B, C> Send for TimedSqlxKeepsakeRepository<'repo, B, C>
where C: Sync,

§

impl<'repo, B, C> Sync for TimedSqlxKeepsakeRepository<'repo, B, C>
where C: Sync,

§

impl<'repo, B, C> Unpin for TimedSqlxKeepsakeRepository<'repo, B, C>

§

impl<'repo, B, C> UnsafeUnpin for TimedSqlxKeepsakeRepository<'repo, B, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more