Documentation ¶
Index ¶
- Variables
- 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("mysql: abort tx")
ErrAbortTx rollbacks transaction and return nil error
Functions ¶
func IterContext ¶
func NullString ¶
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 ¶
type QueryContext interface {
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
}
QueryContext interface
Click to show internal directories.
Click to hide internal directories.