Documentation ¶
Index ¶
- Variables
- func SetEsClient(_es *elastic.Client)
- func SetLevelDB(ldb *leveldb1.LevelDB)
- func SetMongo(_m *mongo.Client)
- func SetMysql(e *gorm.DB)
- func SetRedis(_rd *redis.Client)
- type MongoClient
- func (mc *MongoClient) BatchInsertCollection(db string, collection string, data []interface{}) (res *mongo.InsertManyResult, err error)
- func (mc *MongoClient) CountCollection(db string, collection string, filter map[string]interface{}) (int64, int64, error)
- func (mc *MongoClient) DeleteOneRecord(db string, collection string, filter map[string]interface{}) (res *mongo.DeleteResult, err error)
- func (mc *MongoClient) InitLevelDb(path string) *leveldb1.LevelDB
- func (mc *MongoClient) InsertCollection(db string, collection string, data interface{}) (res *mongo.InsertOneResult, err error)
- func (mc *MongoClient) UpdateOneRecord(db string, collection string, id string, data bson.D) (res *mongo.UpdateResult, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Db *gorm.DB Rd *redis.Client Ldb *leveldb1.LevelDB )
View Source
var (
Es *elastic.Client
)
Functions ¶
func SetEsClient ¶
func SetLevelDB ¶
Types ¶
type MongoClient ¶
type MongoClient struct{}
func (*MongoClient) BatchInsertCollection ¶
func (mc *MongoClient) BatchInsertCollection(db string, collection string, data []interface{}) ( res *mongo.InsertManyResult, err error)
BatchInsertCollection 批量写入
func (*MongoClient) CountCollection ¶
func (mc *MongoClient) CountCollection(db string, collection string, filter map[string]interface{}) (int64, int64, error)
CountCollection 统计
func (*MongoClient) DeleteOneRecord ¶
func (mc *MongoClient) DeleteOneRecord(db string, collection string, filter map[string]interface{}) ( res *mongo.DeleteResult, err error)
DeleteOneRecord 删除单条记录
func (*MongoClient) InitLevelDb ¶
func (mc *MongoClient) InitLevelDb(path string) *leveldb1.LevelDB
InitLevelDb init level db
func (*MongoClient) InsertCollection ¶
func (mc *MongoClient) InsertCollection(db string, collection string, data interface{}) ( res *mongo.InsertOneResult, err error)
InsertCollection 写入 db 写入的数据库 collection 写入的文档(表) data 写入的数据
func (*MongoClient) UpdateOneRecord ¶
func (mc *MongoClient) UpdateOneRecord(db string, collection string, id string, data bson.D) ( res *mongo.UpdateResult, err error)
UpdateOneRecord 修改单条记录
Click to show internal directories.
Click to hide internal directories.