Documentation ¶
Index ¶
- Constants
- Variables
- func Add(table string, insertData map[string]interface{}) (int64, error)
- func Delete(table string, condition map[string]interface{}) (int64, error)
- func Exec(query string, args ...interface{}) (sql.Result, error)
- func Query(query string, args ...interface{}) (*sql.Rows, error)
- func QueryRow(query string, args ...interface{}) *sql.Row
- func Update(table string, updateData map[string]interface{}, ...) (int64, error)
- type Mysql
- type MysqlConfig
- type MysqlMode
- type TxInstance
- func (i *TxInstance) Add(table string, insertData map[string]interface{}) (int64, error)
- func (i *TxInstance) Commit() error
- func (i *TxInstance) Delete(table string, condition map[string]interface{}) (int64, error)
- func (i *TxInstance) Rollback() error
- func (i *TxInstance) Update(table string, updateData map[string]interface{}, ...) (int64, error)
Constants ¶
View Source
const ( MysqlParent = MysqlMode("parent") MysqlChild = MysqlMode("child") )
Variables ¶
View Source
var (
ErrNoTx = errors.New("no tx")
)
Functions ¶
Types ¶
type Mysql ¶
func NewMysql ¶
func NewMysql(config MysqlConfig) *Mysql
func Setup ¶
func Setup(configs []MysqlConfig) *Mysql
type MysqlConfig ¶
type TxInstance ¶
func BeginTx ¶
func BeginTx() (*TxInstance, error)
func (*TxInstance) Add ¶
func (i *TxInstance) Add(table string, insertData map[string]interface{}) (int64, error)
func (*TxInstance) Commit ¶
func (i *TxInstance) Commit() error
func (*TxInstance) Delete ¶
func (i *TxInstance) Delete(table string, condition map[string]interface{}) (int64, error)
func (*TxInstance) Rollback ¶
func (i *TxInstance) Rollback() error
Click to show internal directories.
Click to hide internal directories.