helper

package
v0.0.0-...-5105834 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrRedisTooManyProcessing 处理请求太多时的出错
	ErrRedisTooManyProcessing = &hes.Error{
		Message:    "too many processing",
		StatusCode: http.StatusInternalServerError,
		Category:   "redis",
	}
)

Functions

func EntGetClient

func EntGetClient() *ent.Client

EntGetClient get ent client

func EntGetStats

func EntGetStats() map[string]interface{}

EntGetStats get ent stats

func EntInitSchema

func EntInitSchema() error

EntInitSchema 初始化schema

func EntPing

func EntPing() error

EntPing ent driver ping

func RedisGetClient

func RedisGetClient() redis.UniversalClient

RedisGetClient 获取redis client

func RedisIsNilError

func RedisIsNilError(err error) bool

RedisIsNilError 判断是否redis的nil error

func RedisPing

func RedisPing() error

RedisPing ping操作

func RedisStats

func RedisStats() map[string]interface{}

RedisStats 获取redis的性能统计

func SnappyDecode

func SnappyDecode(buf []byte) ([]byte, error)

func SnappyEncode

func SnappyEncode(data []byte) []byte

Types

type ContextKey

type ContextKey struct{}

type EntListParams

type EntListParams struct {
	// 查询limit限制
	// required: true
	Limit int `json:"limit" validate:"required,xLimit"`

	// 查询的offset偏移
	Offset int `json:"offset" validate:"omitempty,xOffset"`

	// 查询筛选的字段,如果多个字段以,分隔
	Fields string `json:"fields" validate:"omitempty,xFields"`

	// 查询的排序字段,如果以-前缀表示降序,如果多个字段以,分隔
	Order string `json:"order" validate:"omitempty,xOrder"`

	// 忽略计算总数,如果此字段不为空则表示不查询总数
	IgnoreCount string `json:"ignoreCount"`
}

EntEntListParams 公共的列表查询参数

func (*EntListParams) GetFields

func (params *EntListParams) GetFields() []string

GetFields 获取选择的字段

func (*EntListParams) GetLimit

func (params *EntListParams) GetLimit() int

GetLimit 获取limit的值

func (*EntListParams) GetOffset

func (params *EntListParams) GetOffset() int

GetOffset 获取offset的值

func (*EntListParams) GetOrders

func (params *EntListParams) GetOrders() []ent.OrderFunc

GetOrders 获取排序的函数列表

func (*EntListParams) ShouldCount

func (params *EntListParams) ShouldCount() bool

ShouldCount 判断是否需要计算总数

type InfluxDB

type InfluxDB struct {
	// contains filtered or unexported fields
}

func GetInfluxDB

func GetInfluxDB() *InfluxDB

GetInfluxDB 获取默认的influxdb服务

func (*InfluxDB) Close

func (db *InfluxDB) Close()

Close 关闭当前client

func (*InfluxDB) GetAndResetWriteCount

func (db *InfluxDB) GetAndResetWriteCount() int64

func (*InfluxDB) GetBucket

func (db *InfluxDB) GetBucket() string

GetBucket 获取bucket

func (*InfluxDB) GetWritingCount

func (db *InfluxDB) GetWritingCount() int32

func (*InfluxDB) Health

func (db *InfluxDB) Health() error

Health check influxdb health

func (*InfluxDB) Query

func (db *InfluxDB) Query(ctx context.Context, query string) ([]map[string]interface{}, error)

func (*InfluxDB) Write

func (db *InfluxDB) Write(measurement string, tags map[string]string, fields map[string]interface{}, ts ...time.Time)

Write 写入数据

Jump to

Keyboard shortcuts

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