Documentation ¶
Index ¶
- type MongoClient
- func (mc *MongoClient) Close(ctx context.Context) error
- func (mc *MongoClient) CollectionInfo(ctx context.Context, collection string) (resp core_interface.CollectionInfoResponse, err error)
- func (mc *MongoClient) CreateCollection(ctx context.Context, collectionName string) (err error)
- func (mc *MongoClient) CreateIndex(ctx context.Context, collectionName string, indexName, column string) (createdIndexName string, err error)
- func (mc *MongoClient) Delete(ctx context.Context, collectionName string, id string) (int64, error)
- func (mc *MongoClient) DropIndex(ctx context.Context, collectionName string, indexName string) (err error)
- func (mc *MongoClient) Insert(ctx context.Context, collectionName string, val bson.M) (string, error)
- func (mc *MongoClient) Select(ctx context.Context, collectionName string, filter bson.M, sort bson.M, ...) (response core_interface.SelectResponse, err error)
- func (mc *MongoClient) SelectById(ctx context.Context, collectionName string, id string) (response core_interface.SelectResponse, err error)
- func (mc *MongoClient) Update(ctx context.Context, collectionName string, filter, update bson.M, ...) (count int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoClient ¶
type MongoClient struct {
// contains filtered or unexported fields
}
func (*MongoClient) Close ¶
func (mc *MongoClient) Close(ctx context.Context) error
func (m *MongoCollection)CreateAccount()error
func (*MongoClient) CollectionInfo ¶
func (mc *MongoClient) CollectionInfo(ctx context.Context, collection string) (resp core_interface.CollectionInfoResponse, err error)
返回数据库大小、索引大小、文档个数、索引个数
func (*MongoClient) CreateCollection ¶
func (mc *MongoClient) CreateCollection(ctx context.Context, collectionName string) (err error)
func (*MongoClient) CreateIndex ¶
func (mc *MongoClient) CreateIndex(ctx context.Context, collectionName string, indexName, column string) (createdIndexName string, err error)
创建单个索引
func (*MongoClient) DropIndex ¶
func (mc *MongoClient) DropIndex(ctx context.Context, collectionName string, indexName string) (err error)
index名字
func (*MongoClient) Insert ¶
func (mc *MongoClient) Insert(ctx context.Context, collectionName string, val bson.M) (string, error)
插入一个文档
func (*MongoClient) Select ¶
func (mc *MongoClient) Select(ctx context.Context, collectionName string, filter bson.M, sort bson.M, limit int64, skip int64) (response core_interface.SelectResponse, err error)
根据fileter查询文档
func (*MongoClient) SelectById ¶
func (mc *MongoClient) SelectById(ctx context.Context, collectionName string, id string) (response core_interface.SelectResponse, err error)
根据主键查数据
Click to show internal directories.
Click to hide internal directories.