Documentation
¶
Index ¶
- Variables
- func IsForeignKeyViolation(err error, constraint ...string) bool
- func IsInvalidTextRepresentation(err error) bool
- func IsUniqueViolation(err error, constraint ...string) bool
- func Iter(q interface{ ... }, iter Iterator, query string, args ...interface{}) error
- func IterContext(ctx context.Context, q interface{ ... }, iter Iterator, query string, ...) error
- func JSON(value interface{}) interface{ ... }
- 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 Iterator
- type QueryContext
- type Scanner
- 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 IsForeignKeyViolation ¶ added in v0.2.8
IsForeignKeyViolation checks is error an foreign_key_violation
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 IterContext ¶ added in v0.5.0
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 ¶
type QueryContext ¶ added in v0.5.0
type QueryContext interface {
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
}
QueryContext interface
Click to show internal directories.
Click to hide internal directories.