Documentation ¶
Index ¶
- Variables
- func Atomic(ctx context.Context, fn func(ctx context.Context) error) error
- func AtomicReadOnly(ctx context.Context, fn func(ctx context.Context) error) error
- func ContextWithDB(ctx context.Context, db DB) context.Context
- func Exec(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func IsErrMultipleRows(err error) bool
- func IsErrNoRows(err error) bool
- func Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func SetLogger(l Logger)
- type BeginLogInfo
- type CommitLogInfo
- type DB
- type HookPoint
- type InvalidEnumError
- type Logger
- type QueryLogInfo
- type RollbackLogInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMultipleRows = errors.New("sqlbunny: multiple rows in result set")
View Source
var NullBytes = []byte("null")
Functions ¶
func Atomic ¶
Atomic invokes the passed function in the context of a managed SQL transaction. Any errors returned from the user-supplied function are returned from this function.
Retries are automatically performed in case of serialization failures or deadlocks.
func AtomicReadOnly ¶
AtomicReadOnly invokes the passed function in the context of a managed SQL read only transaction. Any errors returned from the user-supplied function are returned from this function.
Retries are automatically performed in case of serialization failures or deadlocks.
func IsErrMultipleRows ¶
func IsErrNoRows ¶
Types ¶
type BeginLogInfo ¶
type BeginLogInfo struct {
ReadOnly bool
}
type CommitLogInfo ¶
type DB ¶
type DB interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row }
DB can perform SQL queries.
func DBFromContext ¶
type InvalidEnumError ¶
func (*InvalidEnumError) Error ¶
func (e *InvalidEnumError) Error() string
type Logger ¶
type Logger interface { LogQuery(ctx context.Context, info QueryLogInfo) LogBegin(ctx context.Context, info BeginLogInfo) context.Context LogCommit(ctx context.Context, info CommitLogInfo) LogRollback(ctx context.Context, info RollbackLogInfo) }
type QueryLogInfo ¶
type RollbackLogInfo ¶
Click to show internal directories.
Click to hide internal directories.