pub enum PostgresAdvisoryLockKey {
Single(i64),
Pair(i32, i32),
}Expand description
Key for PostgreSQL advisory locks.
Advisory locks use either a single 64-bit key or a pair of 32-bit keys. These represent different key spaces and do not overlap.
Variants§
Implementations§
Source§impl PostgresAdvisoryLockKey
impl PostgresAdvisoryLockKey
Sourcepub fn from_name(
name: &str,
allow_hashing: bool,
) -> Result<PostgresAdvisoryLockKey, LockError>
pub fn from_name( name: &str, allow_hashing: bool, ) -> Result<PostgresAdvisoryLockKey, LockError>
Create a key from a string name.
- ASCII strings up to 9 chars are encoded directly (collision-free)
- 16-char hex strings are parsed as i64
- “XXXXXXXX,XXXXXXXX” format parsed as (i32, i32)
- Other strings are hashed to i64 (if
allow_hashingis true)
Sourcepub fn has_single_key(&self) -> bool
pub fn has_single_key(&self) -> bool
Returns true if this is a single key.
Sourcepub fn to_sql_args(&self) -> String
pub fn to_sql_args(&self) -> String
Convert to SQL function arguments.
Trait Implementations§
Source§impl Clone for PostgresAdvisoryLockKey
impl Clone for PostgresAdvisoryLockKey
Source§fn clone(&self) -> PostgresAdvisoryLockKey
fn clone(&self) -> PostgresAdvisoryLockKey
Returns a duplicate of the value. Read more
1.0.0 · 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 PostgresAdvisoryLockKey
impl Debug for PostgresAdvisoryLockKey
Source§impl Hash for PostgresAdvisoryLockKey
impl Hash for PostgresAdvisoryLockKey
Source§impl PartialEq for PostgresAdvisoryLockKey
impl PartialEq for PostgresAdvisoryLockKey
impl Copy for PostgresAdvisoryLockKey
impl Eq for PostgresAdvisoryLockKey
impl StructuralPartialEq for PostgresAdvisoryLockKey
Auto Trait Implementations§
impl Freeze for PostgresAdvisoryLockKey
impl RefUnwindSafe for PostgresAdvisoryLockKey
impl Send for PostgresAdvisoryLockKey
impl Sync for PostgresAdvisoryLockKey
impl Unpin for PostgresAdvisoryLockKey
impl UnwindSafe for PostgresAdvisoryLockKey
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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