Documentation
¶
Index ¶
- Constants
- Variables
- func CloneBsonObject(obj interface{}) interface{}
- func DatabaseClose()
- func DatabaseOpen()
- func IsDup(err error) bool
- func IsNotFound(err error) bool
- type A
- type D
- type Data
- type Database
- func (self *Database) Close()
- func (self *Database) CreateCappedCollection(coll string, size int) error
- func (self *Database) CreateIndex(coll string, name string, keys []string, unique bool) error
- func (self *Database) CreateTTLIndex(coll string, name string, key string, sec int32) error
- func (self *Database) Drop(coll string) error
- func (self *Database) Execute(f func(*mongo.Database))
- func (self *Database) FindAndUpdate(coll string, cond interface{}, doc interface{}, proj interface{}, ...) error
- func (self *Database) GetAllObjects(coll string, obj interface{}) error
- func (self *Database) GetAllObjectsByCond(coll string, cond interface{}, obj interface{}) error
- func (self *Database) GetAllProjectionsByCond(coll string, cond interface{}, proj interface{}, obj interface{}) error
- func (self *Database) GetCount(coll string, cond interface{}) (int64, error)
- func (self *Database) GetObject(coll string, id interface{}, obj interface{}) error
- func (self *Database) GetObjectByCond(coll string, cond interface{}, obj interface{}) error
- func (self *Database) GetProjection(coll string, id interface{}, proj interface{}, obj interface{}) error
- func (self *Database) GetProjectionByCond(coll string, cond interface{}, proj interface{}, obj interface{}) error
- func (self *Database) HasCollection(name string) bool
- func (self *Database) HasDB() bool
- func (self *Database) HasIndex(coll string, name string) bool
- func (self *Database) Insert(coll string, doc interface{}) error
- func (self *Database) InsertMany(coll string, docs ...interface{}) error
- func (self *Database) Remove(coll string, id interface{}) error
- func (self *Database) RemoveAll(coll string, cond interface{}) error
- func (self *Database) RemoveByCond(coll string, cond interface{}) error
- func (self *Database) Run(cmd bson.D, obj interface{}) error
- func (self *Database) Update(coll string, id interface{}, doc interface{}) error
- func (self *Database) UpdateAll(coll string, cond interface{}, doc interface{}) error
- func (self *Database) UpdateByCond(coll string, cond interface{}, doc interface{}) error
- func (self *Database) Upsert(coll string, id interface{}, doc interface{}) error
- func (self *Database) UpsertByCond(coll string, cond interface{}, doc interface{}) error
- type Db_mongo
- func (obj *Db_mongo) Close()
- func (obj *Db_mongo) Delete(table string, id interface{}) error
- func (obj *Db_mongo) Find(collectionName string, query, res []interface{})
- func (obj *Db_mongo) Foreach(table string, query interface{}, sort string, doc interface{}, ...)
- func (obj *Db_mongo) Index(collectionName string, keys ...string)
- func (object *Db_mongo) MapReduce(collectionName string, query, job, res interface{}) error
- func (object *Db_mongo) Open(collectString, DBName string)
- func (obj *Db_mongo) UseSession(ctx context.Context, fun func(mongo.SessionContext) error) error
- func (obj *Db_mongo) Write(table string, id, update interface{}) error
- type E
- type HandlerData
- type Inter
- type M
- type MyMongo
Constants ¶
View Source
const C_save_itv = 6 // in seconds
Variables ¶
View Source
var (
HandlerDatabase = make(map[string]*MyMongo)
)
Functions ¶
func CloneBsonObject ¶ added in v1.1.0
func CloneBsonObject(obj interface{}) interface{}
============================================================================
func DatabaseClose ¶ added in v1.0.8
func DatabaseClose()
func DatabaseOpen ¶ added in v1.0.8
func DatabaseOpen()
func IsNotFound ¶ added in v1.0.6
Types ¶
type Data ¶ added in v1.0.6
type Data struct { ConfigServer.Basic ID interface{} Save interface{} }
type Database ¶ added in v1.0.6
type Database struct {
// contains filtered or unexported fields
}
func (*Database) CreateCappedCollection ¶ added in v1.0.6
func (*Database) CreateIndex ¶ added in v1.0.6
func (*Database) CreateTTLIndex ¶ added in v1.0.6
func (*Database) FindAndUpdate ¶ added in v1.0.6
func (*Database) GetAllObjects ¶ added in v1.0.6
func (*Database) GetAllObjectsByCond ¶ added in v1.0.6
func (*Database) GetAllProjectionsByCond ¶ added in v1.0.6
func (*Database) GetObjectByCond ¶ added in v1.0.6
func (*Database) GetProjection ¶ added in v1.0.6
func (*Database) GetProjectionByCond ¶ added in v1.0.6
func (*Database) HasCollection ¶ added in v1.0.6
func (*Database) InsertMany ¶ added in v1.0.6
func (*Database) RemoveByCond ¶ added in v1.0.6
func (*Database) UpdateByCond ¶ added in v1.0.6
func (*Database) UpsertByCond ¶ added in v1.0.6
type Db_mongo ¶
type Db_mongo struct { Tables map[string]*mongo.Collection // contains filtered or unexported fields }
func (*Db_mongo) Foreach ¶
func (obj *Db_mongo) Foreach(table string, query interface{}, sort string, doc interface{}, callback func(error, bool, interface{}))
获取迭代器
func (*Db_mongo) UseSession ¶
UseSession 使用事务
type HandlerData ¶ added in v1.0.6
type HandlerData struct { Database *Database Data map[interface{}]*Data // contains filtered or unexported fields }
func (*HandlerData) Drop ¶ added in v1.1.1
func (self *HandlerData) Drop()
func (*HandlerData) Isdirty ¶ added in v1.0.6
func (self *HandlerData) Isdirty(id interface{}, Save interface{})
func (*HandlerData) Save ¶ added in v1.0.6
func (self *HandlerData) Save()
Click to show internal directories.
Click to hide internal directories.