Documentation ¶
Index ¶
- func ColumnForSQL(s interface{}) string
- func New(host, dbname, user, pass string, port uint16) error
- type MS
- func (ms *MS) Close()
- func (ms *MS) Connection() (*sql.DB, error)
- func (ms *MS) Exec(sql string, args ...interface{}) (int64, error)
- func (ms *MS) Exec2(sql string, args ...interface{}) error
- func (ms *MS) Insert(sql string, args ...interface{}) (int64, error)
- func (ms *MS) Scan(x interface{}) bool
- func (ms *MS) ScanOne(x interface{}) bool
- func (ms *MS) Select(selectSQL string, args ...interface{}) ([]map[string]interface{}, []string, error)
- func (ms *MS) SelectCount(countSQL string, args ...interface{}) (int, error)
- func (ms *MS) SelectIns(selectSQL string, args ...interface{}) *MS
- func (ms *MS) SetMaxIdleConns(n int)
- func (ms *MS) SetMaxOpenConns(n int)
- type ServerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColumnForSQL ¶
func ColumnForSQL(s interface{}) string
ColumnForSQL is to scan struct data for get column tag
Types ¶
type MS ¶
MS is struct for MySQL
func NewInstance ¶
NewInstance makes a new instance
func (*MS) Connection ¶
Connection is to connect MySQL server Be careful, sql.Open() doesn't return err. Use db.Ping() to check DB condition.
func (*MS) Select ¶
func (ms *MS) Select(selectSQL string, args ...interface{}) ([]map[string]interface{}, []string, error)
Select is to get all field you set
func (*MS) SelectCount ¶
SelectCount is to get number of rows
func (*MS) SetMaxIdleConns ¶
SetMaxIdleConns is to set the maximum number of connections in the idle connection pool.
func (*MS) SetMaxOpenConns ¶
SetMaxOpenConns is to set the maximum number of open connections to the database.
type ServerInfo ¶
type ServerInfo struct {
// contains filtered or unexported fields
}
ServerInfo is struct of server information
Click to show internal directories.
Click to hide internal directories.