// Unlock is the implementation of the unlock for explicit locking
Unlock is the implementation of the unlock for explicit locking
// Unlock is the implementation of the unlock for explicit locking
func (p *Postgres) unlock(ctx context.Context) error {
	if !p.isLocked {
		return nil
	}
	aid, err := lock.Generate(p.DatabaseName, p.SchemaName)
	if err != nil {
		return err
	}
	query := `SELECT pg_advisory_unlock($1)`
	if _, err := p.conn.ExecContext(ctx, query, aid); err != nil {
		return err
	}
	p.isLocked = false
	return nil
}
func ( p * Postgres ) unlock ( ctx context . Context ) error { if ! p . isLocked { return nil } aid , err := lock . Generate ( p . DatabaseName , p . SchemaName ) if err != nil { return err } query := `SELECT pg_advisory_unlock($1)` if _ , err := p . conn . ExecContext ( ctx , query , aid ) ; err != nil { return err } p . isLocked = false return nil }
Unlock is the implementation of the unlock for explicit locking
Unlock is the implementation of the unlock for explicit locking