Documentation
¶
Index ¶
- func Demo()
- type Data
- type Entity
- type Map
- type MongoClient
- func (my *MongoClient) CleanCondition()
- func (my *MongoClient) Close() error
- func (my *MongoClient) DeleteMany() *mongo.DeleteResult
- func (my *MongoClient) DeleteOne() *mongo.DeleteResult
- func (my *MongoClient) FindMany(results *[]Map, ...) *MongoClient
- func (my *MongoClient) FindOne(result *Map, ...) *MongoClient
- func (my *MongoClient) GetClient() *mongo.Client
- func (my *MongoClient) InsertMany(data []any) *mongo.InsertManyResult
- func (my *MongoClient) InsertOne(data Data) *mongo.InsertOneResult
- func (my *MongoClient) Ping()
- func (my *MongoClient) SetCollection(collection string, opts ...*options.CollectionOptions) *MongoClient
- func (my *MongoClient) SetDatabase(database string, opts ...*options.DatabaseOptions) *MongoClient
- func (my *MongoClient) Where(condition Map) *MongoClient
- type MongoClientPool
- func (*MongoClientPool) AppendClient(key string, mongoClient *MongoClient) (*MongoClientPool, error)
- func (*MongoClientPool) Clean() *MongoClientPool
- func (*MongoClientPool) GetClient(key string) *MongoClient
- func (*MongoClientPool) HasClient(key string) bool
- func (*MongoClientPool) Remove(key string) (*MongoClientPool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MongoClient ¶
type MongoClient struct { Err error // contains filtered or unexported fields }
func NewMongoClient ¶
func NewMongoClient(url string) (*MongoClient, error)
NewMongoClient 实例化:mongo客户端
func (*MongoClient) CleanCondition ¶ added in v1.6.5
func (my *MongoClient) CleanCondition()
CleanCondition 清理查询条件
func (*MongoClient) DeleteMany ¶ added in v1.6.3
func (my *MongoClient) DeleteMany() *mongo.DeleteResult
DeleteMany 删除多条数据
func (*MongoClient) DeleteOne ¶ added in v1.6.3
func (my *MongoClient) DeleteOne() *mongo.DeleteResult
DeleteOne 删除单条数据
func (*MongoClient) FindMany ¶ added in v1.6.3
func (my *MongoClient) FindMany(results *[]Map, findOptionFn func(opt *options.FindOptions) *options.FindOptions) *MongoClient
FindMany 查询多条数据
func (*MongoClient) FindOne ¶ added in v1.6.3
func (my *MongoClient) FindOne(result *Map, findOneOptionFn func(opt *options.FindOneOptions) *options.FindOneOptions) *MongoClient
FindOne 查询一条数据
func (*MongoClient) InsertMany ¶ added in v1.6.3
func (my *MongoClient) InsertMany(data []any) *mongo.InsertManyResult
InsertMany 插入多条数据
func (*MongoClient) InsertOne ¶ added in v1.6.3
func (my *MongoClient) InsertOne(data Data) *mongo.InsertOneResult
InsertOne 插入一条数据
func (*MongoClient) SetCollection ¶ added in v1.6.3
func (my *MongoClient) SetCollection(collection string, opts ...*options.CollectionOptions) *MongoClient
SetCollection 设置文档
func (*MongoClient) SetDatabase ¶ added in v1.6.3
func (my *MongoClient) SetDatabase(database string, opts ...*options.DatabaseOptions) *MongoClient
SetDatabase 设置数据库
func (*MongoClient) Where ¶ added in v1.6.3
func (my *MongoClient) Where(condition Map) *MongoClient
Where 设置查询条件
type MongoClientPool ¶
type MongoClientPool struct {
// contains filtered or unexported fields
}
func (*MongoClientPool) AppendClient ¶ added in v1.6.5
func (*MongoClientPool) AppendClient(key string, mongoClient *MongoClient) (*MongoClientPool, error)
AppendClient 增加客户端
func (*MongoClientPool) GetClient ¶ added in v1.6.3
func (*MongoClientPool) GetClient(key string) *MongoClient
GetClient 获取客户端
func (*MongoClientPool) HasClient ¶ added in v1.6.3
func (*MongoClientPool) HasClient(key string) bool
HasClient 检查客户端是否存在
func (*MongoClientPool) Remove ¶
func (*MongoClientPool) Remove(key string) (*MongoClientPool, error)
清除客户端
Click to show internal directories.
Click to hide internal directories.