client

package
v0.0.0-...-2946602 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PRE_TAG  = "<hl>"
	POST_TAG = "</hl>"
)
View Source
const MaxMessageBytes = 4 * 1024 * 1024

Variables

View Source
var (
	RedisClient    *redis.Client
	ESClient       *elastic.Client
	MysqlClient    *gorm.DB
	MinioClient    *minio.Client
	InfluxDBClient *influxdb2.Client
	MongoDBClient  *qmgo.Client

	KafkaClient *sarama.Client
)

Functions

func AddBookMap

func AddBookMap(key string, bn BookName) bool

func CloseKafka

func CloseKafka()

func CreateIndex

func CreateIndex(model _interface.EsTabler) error

func DeleteBookMap

func DeleteBookMap(key string)

func DeleteFromIndex

func DeleteFromIndex(tabler _interface.EsTabler, recID *int, ctx context.Context) error

DeleteFromIndex 删除数据

func DeleteIndex

func DeleteIndex(tabler _interface.EsTabler) bool

DeleteIndex 删除索引!!! 谨慎使用

func FindBookNameByGorm deprecated

func FindBookNameByGorm(db *gorm.DB) (id, name string)

FindBookNameByGorm

Deprecated: 已弃用

func GetBookNameInstance

func GetBookNameInstance() *bookNameMap

func GetFromIndex

func GetFromIndex(tabler _interface.EsTabler, query elastic.Query, from, size int) (list []interface{}, count int64, err error)

GetFromIndex 获取数据, 所有字段均带高亮(指定字段失败)

func InitBookMap

func InitBookMap(configs []config.BookConfig) error

func InitElasticsearch

func InitElasticsearch(config cfg.ESConfig) (*elastic.Client, error)

InitElasticsearch ...

func InitInflux

func InitInflux(config cfg.InfluxConfig) (*influxdb2.Client, error)

func InitKafka

func InitKafka(config cfg.KafkaConfig) (*sarama.Client, error)

func InitMinio

func InitMinio(config config.MinioConfig) (*minio.Client, error)

func InitMongoClient

func InitMongoClient(config cfg.MongoDBConfig) (*qmgo.Client, error)

func InitMongoDB

func InitMongoDB(config cfg.MongoDBConfig) (*qmgo.Database, error)

InitMongoDB ...

func InitMysqlGormV2

func InitMysqlGormV2(config config2.MysqlConfig) (*gorm.DB, error)

InitMysqlGormV2 GormV2 returns a MySQL DB engine from configs

func InitRedis

func InitRedis(config cfg.RedisConfig) (*redis.Client, error)

InitRedis ...

func InitRedisCluster

func InitRedisCluster(config cfg.RedisConfig) (*redis.ClusterClient, error)

InitRedisCluster 初始化Redis集群的连接

func InitSystemStorage

func InitSystemStorage(config config.StorageConfig)

InitSystemStorage 初始化系统配置

func MysqlPaginateSql

func MysqlPaginateSql(ctx *gin.Context) string

MysqlPaginateSql 生成分页sql语句

func MysqlScopePaginate

func MysqlScopePaginate(ctx *gin.Context) func(db *gorm.DB) *gorm.DB

MysqlScopePaginate 分页函数 纯 gorm 时在 scope 里调用

func Paginate

func Paginate(ctx *gin.Context) (int, int)

func PushInterfaceToKafka

func PushInterfaceToKafka(topic string, data []interface{}) error

PushInterfaceToKafka 无限定格式推送kafka

func PutIntoIndex

func PutIntoIndex(tabler _interface.EsTabler) error

PutIntoIndex 添加数据

func UpdateIntoIndex

func UpdateIntoIndex(tabler _interface.EsTabler, recID *int, ctx context.Context, script *elastic.Script) error

UpdateIntoIndex 更新内容

Types

type BookName

type BookName struct {
	BookName      string
	StorageName   string
	MysqlClient   *gorm.DB
	MongoDBClient *qmgo.Database
	MinioClient   *minio.Client
}

BookName 账套

func GetAllBookMap

func GetAllBookMap() []BookName

func ReadBookMap

func ReadBookMap(key string) (value BookName, ok bool)

Jump to

Keyboard shortcuts

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