Documentation ¶
Index ¶
- Constants
- func ErrorIsNoDocuments(err error) bool
- func GetClient() (*mongoData, error)
- func ReleaseClient(c *mongoData)
- type ClientPool
- type ConfigItem
- type Mongo
- func (m *Mongo) Aggregate(ctx context.Context, db *mongoData, data interface{}) []bson.M
- func (m *Mongo) Count(ctx context.Context, db *mongoData, data interface{})
- func (m *Mongo) Find(ctx context.Context, db *mongoData, data interface{})
- func (m *Mongo) FindOne(ctx context.Context, db *mongoData, data interface{}, ...)
- func (m *Mongo) Group(group ...string) *Mongo
- func (m *Mongo) InsertMany(ctx context.Context, db *mongoData, data []interface{}) (*mongo.InsertManyResult, error)
- func (m *Mongo) InsertOne(ctx context.Context, db *mongoData, data interface{}) (*mongo.InsertOneResult, error)
- func (m *Mongo) Limit(limit int) *Mongo
- func (m *Mongo) Select(fields ...string) *Mongo
- func (m *Mongo) SetCollectionName(name string) *Mongo
- func (m *Mongo) SetDatabase(name string) *Mongo
- func (m *Mongo) Skip(skip int) *Mongo
- func (m *Mongo) Where(where bson.D) *Mongo
Constants ¶
View Source
const ( MaxConnection = 10 InitialConnection = 1 )
Variables ¶
This section is empty.
Functions ¶
func ErrorIsNoDocuments ¶
func ReleaseClient ¶
func ReleaseClient(c *mongoData)
Types ¶
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
type ConfigItem ¶
type ConfigItem struct { Host string `json:"host"` Port string `json:"port"` User string `json:"user"` Password string `json:"password"` }
func GetMongoConfig ¶
func GetMongoConfig() *ConfigItem
type Mongo ¶
type Mongo struct {
// contains filtered or unexported fields
}
func (*Mongo) FindOne ¶
func (m *Mongo) FindOne(ctx context.Context, db *mongoData, data interface{}, options ...*options.FindOneOptions)
func (*Mongo) InsertMany ¶
func (*Mongo) SetCollectionName ¶
func (*Mongo) SetDatabase ¶
Click to show internal directories.
Click to hide internal directories.