pub async fn acquire<C: AsMut<PgConnection>>(
        &self,
        mut conn: C,
    ) -> Result<PgAdvisoryLockGuard<'_, C>> {
        match &self.key {
            PgAdvisoryLockKey::BigInt(key) => {
                crate::query::query("SELECT pg_advisory_lock($1)")
                    .bind(key)
                    .execute(conn.as_mut())
                    .await?;
            }
            PgAdvisoryLockKey::IntPair(key1, key2) => {
                crate::query::query("SELECT pg_advisory_lock($1, $2)")
                    .bind(key1)
                    .bind(key2)
                    .execute(conn.as_mut())
                    .await?;
            }
        }

        Ok(PgAdvisoryLockGuard::new(self, conn))
    }
/// Acquires an exclusive lock using `pg_advisory_lock()`, waiting until the lock is acquired.
///
/// For a version that returns immediately instead of waiting, see [`Self::try_acquire()`].
///
/// A connection-like type is required to execute the call. Allowed types include `PgConnection`,
/// `PoolConnection<Postgres>` and `Transaction<Postgres>`, as well as mutable references to
/// any of these.
///
/// The returned guard queues a `pg_advisory_unlock()` call on the connection when dropped,
/// which will be executed the next time the connection is used, or when returned to a
/// [`PgPool`][crate::postgres::PgPool] in the case of `PoolConnection<Postgres>`.
///
/// Postgres allows a single connection to acquire a given lock more than once without releasing
/// it first, so in that sense the lock is re-entrant. However, the number of unlock operations
/// must match the number of lock operations for the lock to actually be released.
///
/// See [Postgres' documentation for the Advisory Lock Functions][advisory-funcs] for details.
///
/// [advisory-funcs]: https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
Acquires an exclusive lock using `pg_advisory_lock()`, waiting until the lock is acquired.
For a version that returns immediately instead of waiting, see [`Self::try_acquire()`].

A connection-like type is required to execute the call.



Postgres allows a single connection to acquire a given lock more than once without releasing
it first, so in that sense the lock is re-entrant. However, the number of unlock operations
must match the number of lock operations for the lock to actually be released.

See [Postgres' documentation for the Advisory Lock Functions][advisory-funcs] for details.


Acquires an exclusive lock using ` pg_advisory_lock () ` waiting until the lock is acquired . For a version that returns immediately instead of waiting see [ ` Self :: try_acquire () ` ] . A connection - like type is required to execute the call . Postgres allows a single connection to acquire a given lock more than once without releasing it first so in that sense the lock is re - entrant . However the number of unlock operations must match the number of lock operations for the lock to actually be released . See [ Postgres ' documentation for the Advisory Lock Functions ] [ advisory - funcs ] for details .
pub async fn acquire<C: AsMut<PgConnection>>(
        &self,
        mut conn: C,
    ) -> Result<PgAdvisoryLockGuard<'_, C>> {
        match &self.key {
            PgAdvisoryLockKey::BigInt(key) => {
                crate::query::query("SELECT pg_advisory_lock($1)")
                    .bind(key)
                    .execute(conn.as_mut())
                    .await?;
            }
            PgAdvisoryLockKey::IntPair(key1, key2) => {
                crate::query::query("SELECT pg_advisory_lock($1, $2)")
                    .bind(key1)
                    .bind(key2)
                    .execute(conn.as_mut())
                    .await?;
            }
        }
        Ok(PgAdvisoryLockGuard::new(self, conn))
    }
pub async fn acquire < C : AsMut < PgConnection > > ( & self , mut conn : C , ) -> Result < PgAdvisoryLockGuard < ' _ , C > > { match & self . key { PgAdvisoryLockKey :: BigInt ( key ) => { crate :: query :: query ( " " ) . bind ( key ) . execute ( conn . as_mut ( ) ) . await ? ; } PgAdvisoryLockKey :: IntPair ( key1 , key2 ) => { crate :: query :: query ( " " ) . bind ( key1 ) . bind ( key2 ) . execute ( conn . as_mut ( ) ) . await ? ; } } Ok ( PgAdvisoryLockGuard :: new ( self , conn ) ) }
Acquires an exclusive lock using `pg_advisory_lock()`, waiting until the lock is acquired.
Acquires an exclusive lock using ` pg_advisory_lock () ` waiting until the lock is acquired .
&self
conn
C