Documentation
¶
Index ¶
- Variables
- func IsInvalidTextRepresentation(err error) bool
- func IsUniqueViolation(err error, constraint ...string) bool
- func NullString(s *string) interface{ ... }
- func NullTime(t *time.Time) interface{ ... }
- func RunInTx(db BeginTxer, opts *TxOptions, fn func(*sql.Tx) error) error
- func RunInTxContext(ctx context.Context, db BeginTxer, opts *TxOptions, fn func(*sql.Tx) error) error
- type BeginTxer
- type Time
- type TxOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAbortTx = errors.New("pgsql: abort tx")
ErrAbortTx rollbacks transaction and return nil error
Functions ¶
func IsInvalidTextRepresentation ¶ added in v0.2.2
IsInvalidTextRepresentation checks is error an invalid_text_representation
func IsUniqueViolation ¶
IsUniqueViolation checks is error an unique_violation with given constraint, constraint can be empty to ignore constraint name checks
func NullString ¶ added in v0.2.5
NullString scans null into empty string
func RunInTxContext ¶
func RunInTxContext(ctx context.Context, db BeginTxer, opts *TxOptions, fn func(*sql.Tx) error) error
RunInTxContext runs fn inside retryable transaction with context. It use Serializable isolation level if tx options isolation is setted to sql.LevelDefault.
RunInTxContext DO NOT handle panic. But when panic, it will rollback the transaction.
Types ¶
Click to show internal directories.
Click to hide internal directories.