Documentation ¶
Index ¶
- func NewModelManager(url, dbname string)
- type Model
- type ModelManager
- func (this *ModelManager) C(name string) *mgo.Collection
- func (this *ModelManager) Count(cName string, selector bson.M) (count int, err error)
- func (this *ModelManager) DropCollection(cName string) (err error)
- func (this *ModelManager) FindAll(cName string, query bson.M, results interface{}) (err error)
- func (this *ModelManager) FindOne(cName string, query bson.M, result interface{}) (err error)
- func (this *ModelManager) GetMongoDB() *MongoDB
- func (this *ModelManager) Insert(cName string, model interface{}) (err error)
- func (this *ModelManager) Remove(cName string, selector bson.M) (err error)
- func (this *ModelManager) RemoveWithId(cName string, id bson.ObjectId) (err error)
- func (this *ModelManager) Session(callback func(s *mgo.Session))
- func (this *ModelManager) Update(cName string, selector bson.M, update interface{}) (err error)
- func (this *ModelManager) UpdateAll(cName string, selector bson.M, update interface{}) (info *mgo.ChangeInfo, err error)
- func (this *ModelManager) UpdateWithId(cName string, id bson.ObjectId, update interface{}) (err error)
- type MongoDB
- type MongoDBClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewModelManager ¶
func NewModelManager(url, dbname string)
Types ¶
type Model ¶
type Model struct { Id bson.ObjectId `json:"id" bson:"_id,omitempty"` AppID bson.ObjectId `json:"app_id" bson:"app_id,omitempty"` CreatedAt int64 `json:"created_at" bson:"created_at"` UpdatedAt int64 `json:"updated_at" bson:"updated_at"` Invalid bool `json:"invalid" bson:"invalid"` InvalidAt int64 `json:"invalid_at" bson:"invalid_at"` }
type ModelManager ¶
type ModelManager struct { }
func (*ModelManager) C ¶
func (this *ModelManager) C(name string) *mgo.Collection
func (*ModelManager) DropCollection ¶
func (this *ModelManager) DropCollection(cName string) (err error)
func (*ModelManager) FindAll ¶
func (this *ModelManager) FindAll(cName string, query bson.M, results interface{}) (err error)
func (*ModelManager) FindOne ¶
func (this *ModelManager) FindOne(cName string, query bson.M, result interface{}) (err error)
func (*ModelManager) GetMongoDB ¶
func (this *ModelManager) GetMongoDB() *MongoDB
func (*ModelManager) Insert ¶
func (this *ModelManager) Insert(cName string, model interface{}) (err error)
func (*ModelManager) Remove ¶
func (this *ModelManager) Remove(cName string, selector bson.M) (err error)
func (*ModelManager) RemoveWithId ¶
func (this *ModelManager) RemoveWithId(cName string, id bson.ObjectId) (err error)
func (*ModelManager) Session ¶
func (this *ModelManager) Session(callback func(s *mgo.Session))
func (*ModelManager) Update ¶
func (this *ModelManager) Update(cName string, selector bson.M, update interface{}) (err error)
func (*ModelManager) UpdateAll ¶
func (this *ModelManager) UpdateAll(cName string, selector bson.M, update interface{}) (info *mgo.ChangeInfo, err error)
func (*ModelManager) UpdateWithId ¶
func (this *ModelManager) UpdateWithId(cName string, id bson.ObjectId, update interface{}) (err error)
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
func NewMongoDB ¶
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/database[?options]]
func (*MongoDB) MainSession ¶
func (this *MongoDB) MainSession() *mgo.Session
type MongoDBClient ¶
type MongoDBClient struct {
// contains filtered or unexported fields
}
func (MongoDBClient) Close ¶
func (this MongoDBClient) Close()
Click to show internal directories.
Click to hide internal directories.