Documentation ¶
Index ¶
- Variables
- func IsTx(cxt Context) bool
- func Now() time.Time
- type Context
- type DB
- func (d *DB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (d *DB) Migrate(rc string) (upgrade.Results, error)
- func (d *DB) Monitor(cxt context.Context, iv time.Duration) <-chan error
- func (d *DB) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (d *DB) QueryRow(query string, args ...interface{}) *sql.Row
- func (d *DB) QueryRowx(query string, args ...interface{}) *sqlx.Row
- func (d *DB) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- func (d *DB) Transaction(h TransactionHandler) error
- type Option
- type TransactionHandler
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("Not found") ErrImmutable = errors.New("Immutable") ErrInvalidField = errors.New("Invalid field") ErrInvalidKeyCount = errors.New("Invalid primary key count") ErrNotAPointer = errors.New("Not a pointer") ErrNotAStruct = errors.New("Not a struct") ErrMissingField = errors.New("Missing field") ErrDriverNotSupported = errors.New("Driver not supported") )
Functions ¶
Types ¶
type Context ¶
type Context interface { Exec(query string, args ...interface{}) (sql.Result, error) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row Queryx(query string, args ...interface{}) (*sqlx.Rows, error) QueryRowx(query string, args ...interface{}) *sqlx.Row }
An SQL context. This defines a unified type that encompasses the basic methods of sqlx.DB and sqlx.Tx so they can be used interchangably.
type DB ¶
func (*DB) Transaction ¶
func (d *DB) Transaction(h TransactionHandler) error
Execute in a transaction. A transaction is created and the handler is invoked. If the handler returns a non-nil error the transaction is rolled back, otherwise the transaction is committed.
type Option ¶
func WithConnMaxIdleTime ¶ added in v1.9.6
func WithConnMaxLifetime ¶ added in v1.9.6
func WithLogger ¶
func WithMaxIdleConns ¶
func WithMaxOpenConns ¶
type TransactionHandler ¶
Directories ¶
Path | Synopsis |
---|---|
DEPRECATED: everything in this package is deprecated and will be removed in a future release.
|
DEPRECATED: everything in this package is deprecated and will be removed in a future release. |
The `query` package replaces the `filter` package and improves support for both read- and write-oriented configuration options.
|
The `query` package replaces the `filter` package and improves support for both read- and write-oriented configuration options. |
Click to show internal directories.
Click to hide internal directories.