Documentation ¶
Index ¶
- type Config
- type IDB
- type MySQL
- func (m *MySQL) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
- func (m *MySQL) Close()
- func (m *MySQL) Exec(query string, args ...interface{}) (sql.Result, error)
- func (m *MySQL) ExecMany(stmts []string, chunkSize int) (e error)
- func (m *MySQL) Host() string
- func (m *MySQL) Name() string
- func (m *MySQL) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (m *MySQL) QueryRow(query string, args ...interface{}) *sql.Row
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDB ¶
type IDB interface { Close() Exec(query string, args ...interface{}) (sql.Result, error) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) ExecMany(stmts []string, chunkSize int) (e error) Host() string // The host name (from config) Name() string // The name of the database (from config) Query(query string, args ...interface{}) (*sql.Rows, error) QueryRow(query string, args ...interface{}) *sql.Row }
IDB is a container for db interactions
type MySQL ¶ added in v1.8.77
type MySQL struct {
// contains filtered or unexported fields
}
MySQL is mysql
func (*MySQL) BeginTx ¶ added in v1.8.77
BeginTx starts a transaction.
The provided context is used until the transaction is committed or rolled back. If the context is canceled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to BeginTx is canceled.
The provided TxOptions is optional and may be nil if defaults should be used. If a non-default isolation level is used that the driver doesn't support, an error will be returned.
func (*MySQL) Close ¶ added in v1.8.77
func (m *MySQL) Close()
Close closes the database and prevents new queries from starting. Close then waits for all queries that have started processing on the server to finish.
It is rare to Close a DB, as the DB handle is meant to be long-lived and shared between many goroutines.
func (*MySQL) Exec ¶ added in v1.8.77
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query.