pub struct PostgresKvStore { /* private fields */ }Expand description
A KvStore in a PostgreSQL table.
Implementations§
Source§impl PostgresKvStore
impl PostgresKvStore
Sourcepub fn with_table(pool: PgPool, table: &str) -> Result<Self, KvError>
pub fn with_table(pool: PgPool, table: &str) -> Result<Self, KvError>
A store in the table table, which may be prefixed by its schema.
§Errors
When table is not a plain SQL identifier.
Sourcepub async fn initialize(&self) -> Result<(), KvError>
pub async fn initialize(&self) -> Result<(), KvError>
Create the table and its index if they do not exist. Safe to run from every process at start-up.
§Errors
When the database refuses.
Trait Implementations§
Source§impl Clone for PostgresKvStore
impl Clone for PostgresKvStore
Source§fn clone(&self) -> PostgresKvStore
fn clone(&self) -> PostgresKvStore
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 PostgresKvStore
impl Debug for PostgresKvStore
Source§impl KvStore for PostgresKvStore
impl KvStore for PostgresKvStore
Source§async fn set(
&self,
key: &[&str],
value: Value,
ttl: Option<Duration>,
) -> Result<(), KvError>
async fn set( &self, key: &[&str], value: Value, ttl: Option<Duration>, ) -> Result<(), KvError>
Put
value under key, replacing what was there, to expire after
ttl if given.Source§async fn insert(
&self,
key: &[&str],
value: Value,
ttl: Option<Duration>,
) -> Result<bool, KvError>
async fn insert( &self, key: &[&str], value: Value, ttl: Option<Duration>, ) -> Result<bool, KvError>
Put
value under key only if nothing is there, and say whether it
was put. Of any number of callers at once, in any number of
processes, exactly one is told it was: this is what makes “has this
activity been processed?” safe to ask from two workers.Auto Trait Implementations§
impl !RefUnwindSafe for PostgresKvStore
impl !UnwindSafe for PostgresKvStore
impl Freeze for PostgresKvStore
impl Send for PostgresKvStore
impl Sync for PostgresKvStore
impl Unpin for PostgresKvStore
impl UnsafeUnpin for PostgresKvStore
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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