Documentation ¶
Index ¶
- type SQLConnPool
- func (p *SQLConnPool) Begin() (*SQLConnTransaction, error)
- func (p *SQLConnPool) Close() error
- func (p *SQLConnPool) Delete(deleteStr string, args ...interface{}) (int64, error)
- func (p *SQLConnPool) Insert(insertStr string, args ...interface{}) (int64, error)
- func (p *SQLConnPool) Query(queryStr string, args ...interface{}) ([]map[string]interface{}, error)
- func (p *SQLConnPool) Update(updateStr string, args ...interface{}) (int64, error)
- type SQLConnTransaction
- func (t *SQLConnTransaction) Commit() error
- func (t *SQLConnTransaction) Delete(deleteStr string, args ...interface{}) (int64, error)
- func (t *SQLConnTransaction) Insert(insertStr string, args ...interface{}) (int64, error)
- func (t *SQLConnTransaction) Query(queryStr string, args ...interface{}) ([]map[string]interface{}, error)
- func (t *SQLConnTransaction) Rollback() error
- func (t *SQLConnTransaction) Update(updateStr string, args ...interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SQLConnPool ¶
type SQLConnPool struct { DriverName string DataSourceName string MaxOpenConns int MaxIdleConns int SQLDB *sql.DB }
SQLConnPool is DB pool struct
func InitMySQLPool ¶
func InitMySQLPool(host, database, user, password, charset string, maxOpenConns, maxIdleConns int) *SQLConnPool
InitMySQLPool func init DB pool
func (*SQLConnPool) Begin ¶
func (p *SQLConnPool) Begin() (*SQLConnTransaction, error)
Begin transaction
func (*SQLConnPool) Delete ¶
func (p *SQLConnPool) Delete(deleteStr string, args ...interface{}) (int64, error)
Delete via pool
func (*SQLConnPool) Insert ¶
func (p *SQLConnPool) Insert(insertStr string, args ...interface{}) (int64, error)
Insert via pool
type SQLConnTransaction ¶
SQLConnTransaction is for transaction connection
func (*SQLConnTransaction) Delete ¶
func (t *SQLConnTransaction) Delete(deleteStr string, args ...interface{}) (int64, error)
Delete via transaction
func (*SQLConnTransaction) Insert ¶
func (t *SQLConnTransaction) Insert(insertStr string, args ...interface{}) (int64, error)
Insert via transaction
func (*SQLConnTransaction) Query ¶
func (t *SQLConnTransaction) Query(queryStr string, args ...interface{}) ([]map[string]interface{}, error)
Query via transaction
func (*SQLConnTransaction) Rollback ¶
func (t *SQLConnTransaction) Rollback() error
Rollback transaction
Click to show internal directories.
Click to hide internal directories.