Documentation ¶
Index ¶
- Variables
- func IsCharacterNotInRepertoire(err error) bool
- func IsErrorClass(err error, class string) bool
- func IsErrorCode(err error, code string) bool
- func IsForeignKeyViolation(err error, constraint ...string) bool
- func IsInvalidTextRepresentation(err error) bool
- func IsQueryCanceled(err error) bool
- func IsSerializationFailure(err error) bool
- func IsUniqueViolation(err error, constraint ...string) bool
- func Iter(q interface{ ... }, iter Iterator, query string, args ...any) error
- func IterContext(ctx context.Context, q interface{ ... }, iter Iterator, query string, ...) error
- func JSON(value any) interface{ ... }
- func Null[T comparable](v *T) interface{ ... }
- func NullInt64(i *int64) 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 Row
- type Rows
- type Scanner
- type Time
- type TxOptions
Constants ¶
This section is empty.
Variables ¶
var ErrAbortTx = errors.New("pgsql: abort tx")
ErrAbortTx rollbacks transaction and return nil error
Functions ¶
func IsCharacterNotInRepertoire ¶ added in v0.8.1
IsCharacterNotInRepertoire checks is error a character_not_in_repertoire
func IsErrorClass ¶ added in v0.8.1
IsErrorClass checks is error has given class
func IsErrorCode ¶ added in v0.8.1
IsErrorCode checks is error has given code
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 IsQueryCanceled ¶ added in v0.8.0
IsQueryCanceled checks is error an query_canceled error (pq: canceling statement due to user request)
func IsSerializationFailure ¶ added in v0.14.0
IsSerializationFailure checks is error a serialization_failure error (pq: could not serialize access due to read/write dependencies among transactions)
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 NullInt64 ¶ added in v0.9.0
NullInt64 scans null into zero int64 and convert zero into sql null
func NullString ¶ added in v0.2.5
NullString scans null into empty string and convert empty string into sql null
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
QueryContext interface