Documentation ¶
Index ¶
- Constants
- Variables
- func CamelCase(str string) string
- func CreateOrmModels(dbmaster, dbslaver, gdir string)
- func CutPath(href string) string
- func DT2UnixTimeStamp(sdt, format string) int64
- func FileExists(path string) bool
- func GetMCache() cache.Cacher
- func IdStr2Slice(idstr, seg, omit string) []string
- func LoadDbConfig(confPtr interface{})
- func NewEngine(skey string) *sqlx.DB
- func NewMysql() *mysqlSt
- func RemoteIp(req *http.Request) string
- func SetDBCache(c cache.Cacher)
- func SliceSqlMap2Struct(ptrSt interface{}, data []SqlMap) error
- func SnakeCase(str string) string
- func SqlMap2Struct(ptrSt interface{}, data SqlMap) error
- func SqlMapDeleteItems(a SqlMap, keys ...string)
- type DHandler
- type DbConfig
- type ModelSt
- func (self *ModelSt) CacheKey(ckey string) string
- func (self *ModelSt) DBTables() []string
- func (self *ModelSt) Delete(id interface{}) int64
- func (self *ModelSt) EqMod(idx, oidx int64) bool
- func (self *ModelSt) GetAsMap(offset, limit int64, cHandler WHandler, fields string) SqlMap
- func (self *ModelSt) GetAsSQL(sql string, offset, limit int64) []SqlMap
- func (self *ModelSt) GetCacheVer() string
- func (self *ModelSt) GetColumn(offset, limit int64, cHandler WHandler, fields string, args ...string) []string
- func (self *ModelSt) GetHash(args ...interface{}) string
- func (self *ModelSt) GetItem(cHandler WHandler, fields string, args ...string) SqlMap
- func (self *ModelSt) GetList(offset, limit int64, cHandler WHandler, fields string, args ...string) []SqlMap
- func (self *ModelSt) GetNameMap(offset, limit int64, cHandler WHandler, fields string, key string) map[string]SqlMap
- func (self *ModelSt) GetOne(id interface{}) SqlMap
- func (self *ModelSt) GetSlot() int
- func (self *ModelSt) GetTable() string
- func (self *ModelSt) GetTotal(cHandler WHandler, fields string) SqlString
- func (self *ModelSt) IdClearCache(id interface{}) *ModelSt
- func (self *ModelSt) Init(dbPool *XDBPoolSt, data map[string]interface{}, fields map[string]reflect.Kind)
- func (self *ModelSt) IsExists(cHandler WHandler) SqlString
- func (self *ModelSt) MultiDelete(whandler WHandler) int64
- func (self *ModelSt) MultiUpdate(whandler WHandler, vhandler VHandler) int64
- func (self *ModelSt) NewOne(fields SqlMap, dupfields SqlMap) int64
- func (self *ModelSt) NewOneFromHandler(vhandler VHandler, dhandler DHandler) int64
- func (self *ModelSt) Query() *QuerySt
- func (self *ModelSt) ResetTable() *ModelSt
- func (self *ModelSt) Save(id interface{}, fields SqlMap) int64
- func (self *ModelSt) SaveFromHandler(id interface{}, vhandler VHandler) int64
- func (self *ModelSt) SetCache(cacheSt cache.Cacher) *ModelSt
- func (self *ModelSt) SetCacheVer()
- func (self *ModelSt) SetDevTable(idx int64) *ModelSt
- func (self *ModelSt) SetModTable(idx int64) *ModelSt
- func (self *ModelSt) SetTable(table string) *ModelSt
- func (self *ModelSt) SetYmTable(format string) *ModelSt
- type QuerySt
- func (q QuerySt) AsSql(mode string) string
- func (q QuerySt) Clear(parts ...string) *mysqlSt
- func (q *QuerySt) CloseDB()
- func (q *QuerySt) Delete() int64
- func (q QuerySt) Duplicate(field string, value interface{}, args ...string) *mysqlSt
- func (q *QuerySt) Exec(query string) sql.Result
- func (q QuerySt) Field(fields string) *mysqlSt
- func (q *QuerySt) GetAsSql(query string, isFirst bool, offset, limit int64) []SqlMap
- func (q *QuerySt) GetColumn(query string, offset, limit int64) []string
- func (q *QuerySt) GetDb() *sqlx.DB
- func (q *QuerySt) GetList(query string, offset, limit int64) []SqlMap
- func (q *QuerySt) GetMap(query string, offset, limit int64) SqlMap
- func (q *QuerySt) GetRow() SqlMap
- func (q *QuerySt) GetValue() SqlString
- func (q QuerySt) GetWheres() string
- func (q QuerySt) GroupBy(fields ...string) *mysqlSt
- func (q QuerySt) Having(having string) *mysqlSt
- func (q *QuerySt) Insert(fields SqlMap, isReplace bool) int64
- func (q *QuerySt) NameMap(query, key string, offset, limit int64) map[string]SqlMap
- func (q QuerySt) OrderBy(field, dir string) *mysqlSt
- func (q QuerySt) Reset() *mysqlSt
- func (q *QuerySt) SetDb(db *sqlx.DB) *QuerySt
- func (q QuerySt) SetIsReplace(isReplace bool) *mysqlSt
- func (q QuerySt) Table(table ...string) *mysqlSt
- func (q *QuerySt) Update(fields SqlMap) int64
- func (q QuerySt) Value(field string, value interface{}, args ...string) *mysqlSt
- func (q QuerySt) Where(field string, value interface{}, args ...string) *mysqlSt
- type SqlMap
- type SqlString
- type VHandler
- type WHandler
- type XDBPoolSt
Constants ¶
View Source
const ( DT_SQL = "sql" DT_AUTO = "auto" OP_AS = "AS" OP_MAX = "MAX" OP_MIN = "MIN" OP_SUM = "SUM" OP_AVG = "AVG" OP_COUNT = "COUNT" OP_EQ = "=" OP_NE = "<>" OP_GT = ">" OP_LT = "<" OP_GE = ">=" OP_LE = "<=" OP_BETWEEN = "BETWEEN" OP_NOTBETWEEN = "NOT BETWEEN" OP_LIKE = "LIKE" OP_NOTLIKE = "NOT LIKE" OP_REGEXP = "REGEXP" OP_ISNULL = "IS NULL" OP_ISNOTNULL = "IS NOT NULL" OP_IN = "IN" OP_NOTIN = "NOT IN" OP_AND = "AND" OP_OR = "OR" OP_NOT = "NOT" OP_SQL = "SQL" ASC = "ASC" DESC = "DESC" )
View Source
const (
DBVERCKEY = "dbver"
)
Variables ¶
View Source
var ( IsShowSql = true GdbPoolSt = make(XDBPoolSt) GdbConfig = make(map[string]*DbConfig) )
View Source
var GdbCache cache.Cacher = nil
View Source
var GmCache cache.Cacher = nil
View Source
var Gmodelstpl = `` /* 517-byte string literal not displayed */
Functions ¶
func DT2UnixTimeStamp ¶ added in v1.0.5
根据时间格式获取unix时间的记录
func IdStr2Slice ¶ added in v1.0.5
根据逗号分割的id转slice
func LoadDbConfig ¶
func LoadDbConfig(confPtr interface{})
*
- 数据库的配置 通过配置导入,配置必须传结构体指针 示例
- @confPtr *Config 配置对象的指针变量
type Config struct { ... Redis cache.RedisConfig `yaml:"redis"` DbMaster DbConfig `yaml:"dbmaster"` DbSlaver DbConfig `yaml:"dbslaver"` }
func SliceSqlMap2Struct ¶
提供SqlMap转义成struct结构类型 只支持常用类型的
func SqlMap2Struct ¶
提供SqlMap转义成struct结构类型 只支持常用类型的
Types ¶
type ModelSt ¶
type ModelSt struct {
// contains filtered or unexported fields
}
定义数据模型的基础结构
func (*ModelSt) GetColumn ¶
func (self *ModelSt) GetColumn(offset, limit int64, cHandler WHandler, fields string, args ...string) []string
只获取数据信息列表
func (*ModelSt) GetList ¶
func (self *ModelSt) GetList(offset, limit int64, cHandler WHandler, fields string, args ...string) []SqlMap
只获取数据信息列表
func (*ModelSt) GetNameMap ¶
func (self *ModelSt) GetNameMap(offset, limit int64, cHandler WHandler, fields string, key string) map[string]SqlMap
获取命名map,key必须属于fields当中的字段
func (*ModelSt) IdClearCache ¶
根据ID删除缓存策略
func (*ModelSt) Init ¶
func (self *ModelSt) Init(dbPool *XDBPoolSt, data map[string]interface{}, fields map[string]reflect.Kind)
初始化模型 业务参数设定
func (*ModelSt) MultiDelete ¶
删除多条记录 单数缓存数据可能还是存在 通过id获取数据的情况
func (*ModelSt) MultiUpdate ¶
通过执行匿名函数实现数据更新关系绑定
func (*ModelSt) NewOneFromHandler ¶
通过执行匿名函数实现数据更新关系绑定
func (*ModelSt) ResetTable ¶
func (*ModelSt) SaveFromHandler ¶
通过执行匿名函数实现数据更新关系绑定
func (*ModelSt) SetDevTable ¶
func (*ModelSt) SetModTable ¶
func (*ModelSt) SetYmTable ¶
这个时间格式填写golang诞辰 2006-01-02 15:04:05 等
type QuerySt ¶
type QuerySt struct {
// contains filtered or unexported fields
}
func (QuerySt) SetIsReplace ¶
func (q QuerySt) SetIsReplace(isReplace bool) *mysqlSt
设定插入的时候执行replace into
Directories ¶
Path | Synopsis |
---|---|
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure.
|
Package mapstructure exposes functionality to convert one arbitrary Go type into another, typically to convert a map[string]interface{} into a native Go structure. |
Click to show internal directories.
Click to hide internal directories.