core

package
v0.0.0-...-3b8fdc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

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 SetEsClient(_es *elastic.Client)

func SetLevelDB

func SetLevelDB(ldb *leveldb1.LevelDB)

func SetMongo

func SetMongo(_m *mongo.Client)

func SetMysql

func SetMysql(e *gorm.DB)

func SetRedis

func SetRedis(_rd *redis.Client)

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 修改单条记录

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL