Documentation ¶
Index ¶
- Variables
- func OrmReflect(i interface{}, addr string)
- type Db
- func (dbm *Db) Exist(bean interface{}) (bool, error)
- func (dbm *Db) FindBySql(sql string, out interface{}) error
- func (dbm *Db) Get(query interface{}, out interface{}) error
- func (dbm *Db) GetById(id int, out interface{}) error
- func (dbm *Db) Insert(bean interface{}) error
- func (dbm *Db) Update(bean interface{}, condiBeans ...interface{}) (int64, error)
- func (dbm *Db) UpdateById(id int, bean interface{}) error
- type DbBase
- type DbDriverName
- type DbDriverType
- type DbEngineName
- type DbEngineType
- type DbMongodb
- func (dbm *DbMongodb) Close()
- func (dbm *DbMongodb) Find(clname string, query interface{}) *mgo.Query
- func (dbm *DbMongodb) Insert(clname string, docs ...interface{}) error
- func (dbm *DbMongodb) Update(clname string, selector interface{}, update interface{}) error
- func (dbm *DbMongodb) Upsert(clname string, selector interface{}, update interface{}) (interface{}, error)
- type DbMysql
- type DbRedis
- func (m *DbRedis) BRPop(queueName string, timeout int) (data string, err error)
- func (m *DbRedis) Close() (err error)
- func (m *DbRedis) Decr(setname string) (err error)
- func (m *DbRedis) Del(key string) (err error)
- func (m *DbRedis) Get(key string) (reply string, err error)
- func (m *DbRedis) GetBit(key string, offset uint64) (reply int, err error)
- func (m *DbRedis) HDel(key string, field string) (reply string, err error)
- func (m *DbRedis) HExists(key string, field string) (reply bool, err error)
- func (m *DbRedis) HGet(key string, field string) (reply string, err error)
- func (m *DbRedis) HGetAll(key string) (reply map[string]string, err error)
- func (m *DbRedis) HIncr(key string, field string, num int) (reply bool, err error)
- func (m *DbRedis) HSet(key string, field string, val string) (err error)
- func (m *DbRedis) Incr(setname string) (err error)
- func (m *DbRedis) IncrBy(setname string, member int) (err error)
- func (m *DbRedis) LPush(queueName string, key string) (err error)
- func (m *DbRedis) LPushBatch(queueName string, keys []string) (err error)
- func (m *DbRedis) LRange(key string, startIndex, endIndex int) ([]string, error)
- func (m *DbRedis) LRem(key string, count int, value string) (int, error)
- func (m *DbRedis) SAdd(setname string, key interface{}) (err error)
- func (m *DbRedis) SCARD(setname string) (res int, err error)
- func (m *DbRedis) SPOP(setname string, num int) (data []string, err error)
- func (m *DbRedis) Set(key string, val string) (err error)
- func (m *DbRedis) SetBit(key string, offset uint64, val string) (err error)
- func (m *DbRedis) Unlink(key string) (err error)
- func (m *DbRedis) ZAdd(setname string, value int64, key interface{}) (err error)
- func (m *DbRedis) ZCARD(setname string) (res int, err error)
- func (m *DbRedis) ZDel(setname string, key string) (err error)
- func (m *DbRedis) ZDelBatch(setname string, keys []string) (err error)
- func (m *DbRedis) ZIncr(setname string, member string) (err error)
- func (m *DbRedis) ZRangeAsc(setname string) (userMap []interface{}, err error)
- func (m *DbRedis) ZRangeDesc(setname string) (userMap []interface{}, err error)
- func (m *DbRedis) ZRevrange(setname string, start int, stop int) (userMap map[string]string, err error)
- func (m *DbRedis) ZremRangeByscore(setname string, min int64, max int64) (err error)
- type Engine
- type EngineGorm
- type EngineMgo
- type EngineXorm
Constants ¶
This section is empty.
Variables ¶
View Source
var Mongodb = map[string]interface{}{
"mgo": createMgo,
}
View Source
var Mysql = map[string]interface{}{
"gorm": createGorm,
"xorm": createXorm,
}
Functions ¶
Types ¶
type DbDriverName ¶
type DbDriverName string
type DbDriverType ¶
type DbDriverType int
type DbEngineName ¶
type DbEngineName string
const ( DbMysqlEngineNameXorm DbEngineName = "xorm" DbMysqlEngineNameGorm DbEngineName = "gorm" DbMongoEngineNameMgo DbEngineName = "mgo" )
type DbEngineType ¶
type DbEngineType int8
orm库
const ( DbMysqlEngineTypeXorm DbEngineType = iota DbMysqlEngineTypeGorm DbMongoEngineTypeMgo )
type DbMongodb ¶
type DbMongodb struct { Db // contains filtered or unexported fields }
func GetMongodbConnByAddr ¶
func GetMongodbConnByAddr(cf *config.Config, engine DbEngineName, addr string) *DbMongodb
通过addr链接
func GetMongodbConnByDb ¶
func GetMongodbConnByDb(cf *config.Config, engine DbEngineName, dbname string) *DbMongodb
直接操作db
func NewDbMongo ¶
func NewDbMongo(cf *config.Config, engine ...DbEngineName) *DbMongodb
type DbMysql ¶
type DbMysql struct {
Db
}
func GetMysqlConnByAddr ¶
func GetMysqlConnByAddr(cf *config.Config, engine DbEngineName, addr string) *DbMysql
通过addr链接
func GetMysqlConnByDb ¶
func GetMysqlConnByDb(cf *config.Config, engine DbEngineName, dbname string) *DbMysql
直接操作db
func NewDbMysql ¶
func NewDbMysql(cf *config.Config, engine ...DbEngineName) *DbMysql
type DbRedis ¶ added in v1.0.2
func (*DbRedis) LPushBatch ¶ added in v1.1.0
list 操作
func (*DbRedis) ZRangeDesc ¶ added in v1.1.0
type Engine ¶
type Engine struct { Xorm *EngineXorm Gorm *EngineGorm Mgo *EngineMgo }
type EngineGorm ¶ added in v1.0.5
type EngineXorm ¶ added in v1.0.5
Source Files ¶
Click to show internal directories.
Click to hide internal directories.