Documentation ¶
Index ¶
- Variables
- func GetGorm(name string) *gorm.DB
- func InitMysqlGorm()
- func NewMysqlDB(host, port, user, password, database string) (err error)
- func NewORM(database, user, password, host, port string, disablePrepared bool) (*gorm.DB, error)
- func SetGorm(c *gorm.DB, name string)
- func StringValueMysql(i interface{}) string
- type Mysql
- func (m *Mysql) CloseLog()
- func (m *Mysql) Conn() (err error)
- func (m *Mysql) Delete(sql string) error
- func (m *Mysql) DeleteTable(tableName string) error
- func (m *Mysql) Describe(table string) (*TableDescribe, error)
- func (m *Mysql) Exec(sql string) error
- func (m *Mysql) GetFieldList(table string) (fieldList []string)
- func (m *Mysql) HasTable(tableName string) bool
- func (m *Mysql) Insert(table string, fieldData map[string]interface{}) error
- func (m *Mysql) InsertAt(table string, fieldData map[string]interface{}) error
- func (m *Mysql) InsertAtGd(table string, fieldData *utils.GDMap) error
- func (m *Mysql) InsertAtJson(table, jsonStr string) error
- func (m *Mysql) IsHaveTable(table string) bool
- func (m *Mysql) NewTable(table string, fields map[string]string) error
- func (m *Mysql) NewTableGd(table string, fields *utils.GDMap) error
- func (m *Mysql) Query(sql string) ([]map[string]string, error)
- func (m *Mysql) Select(sql string) ([]map[string]string, error)
- func (m *Mysql) SetMaxIdleConn(number int)
- func (m *Mysql) SetMaxOpenConn(number int)
- func (m *Mysql) ToVarChar(data interface{}) string
- func (m *Mysql) ToXls(sql, outPath string)
- func (m *Mysql) Update(sql string) error
- type Page
- type TableDescribe
- type TableInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SqlShowTables = "SHOW TABLES" ErrTableNameNull = fmt.Errorf("err: table name is null.") ErrTableIsNull = fmt.Errorf("err: table is null.") )
View Source
var MysqlDB = &Mysql{}
View Source
var MysqlGorm map[string]*gorm.DB
Functions ¶
func NewMysqlDB ¶
NewMysqlDB 给mysql对象进行连接
Types ¶
type Mysql ¶
Mysql 客户端对象
func (*Mysql) Describe ¶
func (m *Mysql) Describe(table string) (*TableDescribe, error)
Describe 获取表结构
func (*Mysql) GetFieldList ¶
GetFieldList 获取表字段
func (*Mysql) InsertAtGd ¶
InsertAtGd 固定顺序map写入
func (*Mysql) InsertAtJson ¶
InsertAtJson json字符串存入数据库
func (*Mysql) NewTableGd ¶
NewTableGd 创建新的固定map顺序为字段的表
type Page ¶ added in v0.1.4
func (*Page) Pagination ¶ added in v0.1.4
Pagination 分页
type TableDescribe ¶
Click to show internal directories.
Click to hide internal directories.