Documentation ¶
Index ¶
- func AdvisoryUnlock(ctx context.Context, q sqlx.QueryerContext, id int64) (bool, error)
- func QuoteIdent(s string) string
- func TryAdvisoryLock(ctx context.Context, q sqlx.QueryerContext, id int64) (bool, error)
- func TryAdvisoryXactLock(ctx context.Context, tx *sqlx.Tx, id int64) (bool, error)
- func WithConnection(f func(db *sqlx.DB) error) error
- type NullTransaction
- type Transaction
- type TransactionExecerContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvisoryUnlock ¶ added in v0.3.0
TryAdvisoryLock will release a previously-acquired exclusive session-level advisory lock. Returns true if the lock is successfully released. If the lock was not held, false is returned, and in addition, an SQL warning will be reported by the server.
https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
func TryAdvisoryLock ¶ added in v0.3.0
TryAdvisoryLock will try to obtain session-level exclusive lock. This will either obtain the lock immediately and return true, or return false without waiting if the lock cannot be acquired immediately.
https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
func TryAdvisoryXactLock ¶
TryAdvisoryXactLock will try to obtain transaction-level exclusive lock. It will not wait for the lock to become available. It will either obtain the lock immediately and return true, or return false if the lock cannot be acquired immediately. If acquired, is automatically released at the end of the current transaction and cannot be released explicitly.
https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS
Types ¶
type NullTransaction ¶ added in v0.3.0
type NullTransaction struct {
// contains filtered or unexported fields
}
NullTransaction represents fake transaction.
func (*NullTransaction) Commit ¶ added in v0.3.0
func (t *NullTransaction) Commit() error
func (*NullTransaction) ExecContext ¶ added in v0.3.0
func (*NullTransaction) Rollback ¶ added in v0.3.0
func (t *NullTransaction) Rollback() error
type Transaction ¶ added in v0.3.0
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents database transaction.
func (*Transaction) Commit ¶ added in v0.3.0
func (t *Transaction) Commit() error
func (*Transaction) ExecContext ¶ added in v0.3.0
func (*Transaction) Rollback ¶ added in v0.3.0
func (t *Transaction) Rollback() error
type TransactionExecerContext ¶ added in v0.3.0
type TransactionExecerContext interface { sqlx.ExecerContext Rollback() error Commit() error }