Documentation ¶
Index ¶
- Variables
- type CacheDB
- func (c *CacheDB) CreateCacheKey(structPtr Cacheable, fields ...string) (CacheKey, error)
- func (c *CacheDB) CreateCacheKeyByFields(fields []string, values []interface{}) (string, error)
- func (c *CacheDB) CreateGetQuery(values []interface{}, whereConds ...string) bson.M
- func (c *CacheDB) GetCache(destStructPtr Cacheable, fields ...string) error
- func (c *CacheDB) WitchCollection(s func(*mgo.Collection) error) error
- type CacheKey
- type Cacheable
- type Config
- type DB
- type PreDB
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = mgo.ErrNotFound NewObjectId = bson.NewObjectId )
View Source
var ErrCacheIsNil = errors.New("*DB.Cache (redis) is nil")
ErrCacheIsNil db cache(redis) is nil
Functions ¶
This section is empty.
Types ¶
type CacheDB ¶
type CacheDB struct { *DB // contains filtered or unexported fields }
CacheDB cache DB handle
func (*CacheDB) CreateCacheKey ¶
CreateCacheKey
func (*CacheDB) CreateCacheKeyByFields ¶
CreateCacheKeyByFields
func (*CacheDB) CreateGetQuery ¶
CreateGetQuery
func (*CacheDB) WitchCollection ¶
func (c *CacheDB) WitchCollection(s func(*mgo.Collection) error) error
WitchCollection
type CacheKey ¶
type CacheKey struct { Key string Values []interface{} // contains filtered or unexported fields }
CacheKey cache key info
type Config ¶
type Config struct { // Addrs host Addrs []string `yaml:"addr"` // Timeout Timeout time.Duration `yaml:"timeout"` // Database mgo db name Database string `yaml:"database"` // Username Username string `yaml:"username"` // Password Password string `yaml:"passward"` // PoolLimit PoolLimit int `yaml:"pool_limit"` // CloseCache default open cache CloseCache bool `yaml:"close_cache"` }
Config mongodb config
type PreDB ¶
type PreDB struct { *DB // contains filtered or unexported fields }
PreDB preset *DB
func (*PreDB) InitByCache ¶
InitByCache
Click to show internal directories.
Click to hide internal directories.