handler.go

 1package db
 2
 3import (
 4	"context"
 5	"database/sql"
 6
 7	"github.com/jmoiron/sqlx"
 8)
 9
10// Handler is a database handler.
11type Handler interface {
12	DriverName() string
13	Rebind(string) string
14
15	Select(interface{}, string, ...interface{}) error
16	Get(interface{}, string, ...interface{}) error
17	Queryx(string, ...interface{}) (*sqlx.Rows, error)
18	QueryRowx(string, ...interface{}) *sqlx.Row
19	Exec(string, ...interface{}) (sql.Result, error)
20
21	SelectContext(context.Context, interface{}, string, ...interface{}) error
22	GetContext(context.Context, interface{}, string, ...interface{}) error
23	QueryxContext(context.Context, string, ...interface{}) (*sqlx.Rows, error)
24	QueryRowxContext(context.Context, string, ...interface{}) *sqlx.Row
25	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
26}