Documentation ¶
Index ¶
- Variables
- type GormUtil
- type SqlFactory
- func (sf SqlFactory) Exec(sql string, params ...interface{}) (tx *gorm.DB)
- func (sf SqlFactory) GetDB() *gorm.DB
- func (sf SqlFactory) GetDbName(name string) string
- func (sf SqlFactory) GetVariable(name string) string
- func (sf SqlFactory) Raw(sql string, params ...interface{}) (tx *gorm.DB)
- func (sf SqlFactory) ReplaceVariable(sqlstr string) string
- func (sf SqlFactory) ScanRows2map(rows *sql.Rows) []map[string]string
- func (sf SqlFactory) ScanRows2mapI(rows *sql.Rows) []map[string]interface{}
Constants ¶
This section is empty.
Variables ¶
View Source
var (
GormDB *gorm.DB //数据库操作对象
)
Functions ¶
This section is empty.
Types ¶
type SqlFactory ¶
type SqlFactory struct{}
func (SqlFactory) Exec ¶
func (sf SqlFactory) Exec(sql string, params ...interface{}) (tx *gorm.DB)
调用数据更新
func (SqlFactory) Raw ¶
func (sf SqlFactory) Raw(sql string, params ...interface{}) (tx *gorm.DB)
调用数据查询
func (SqlFactory) ReplaceVariable ¶
func (sf SqlFactory) ReplaceVariable(sqlstr string) string
替换字符串中的所有全局变量
func (SqlFactory) ScanRows2map ¶
func (sf SqlFactory) ScanRows2map(rows *sql.Rows) []map[string]string
将查询结果转换成map数组,常用于原生sql查询
func (SqlFactory) ScanRows2mapI ¶
func (sf SqlFactory) ScanRows2mapI(rows *sql.Rows) []map[string]interface{}
将查询结果转换成map数组,常用于原生sql查询
Click to show internal directories.
Click to hide internal directories.