Documentation ¶
Index ¶
- func ArrayChunkInt32(array []int32, num int) [][]int32
- func ArrayChunkStr(array []string, num int) [][]string
- func CallFunc(body CallBody) (result []interface{}, err error)
- func CheckEsMapExist(ctx context.Context, client *elastic.Client, index string) bool
- func CombineFieldFloat32(old interface{}, ne interface{}) (float32, error)
- func CombineFieldInt32(old interface{}, ne interface{}) (int32, error)
- func CopyEsIndex(ctx context.Context, client *elastic.Client, src string, target string) (success bool, err error)
- func DivideInt32(dividend int32, divisor int32, mul ...int32) (float64, error)
- func GetCurrPath() string
- func GetCurrentSliceESIndex(indexName string, timer ...time.Time) (index string)
- func GetESMapping(ctx context.Context, client *elastic.Client, index ...string) (result map[string]interface{}, err error)
- func GetEarliestDate() time.Time
- func GetEsIndex(indexName string, params map[string]interface{}) []string
- func GetSliceESIndexByDateRange(indexName string, startDate string, endDate string) (indexArr []string, err error)
- func GetSliceESIndexByTimeRange(indexName string, startTime time.Time, endTime time.Time) (indexArr []string, err error)
- func GetStructStringField(input interface{}, key string) (value string, err error)
- func HTTPGet(requestURI string, params map[string]string, header map[string]string) ([]byte, error)
- func HTTPPost(requestURI string, params map[string]string, header map[string]string) ([]byte, error)
- func InterfaceToResult(resultList []interface{}, returnItems ...interface{}) error
- func PrintJson(tag string, data interface{}, format ...bool)
- func SetLogger(logger Logger)
- func Split(str string, step string) []string
- func StructByReflect(beforeMap map[string]interface{}, inStructPtr interface{}) error
- func TimeFormatInt32(tt int32, format ...string) (string, error)
- type CallBody
- type CallTask
- type KT
- type Logger
- type ResponseBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckEsMapExist ¶ added in v0.0.18
func CombineFieldFloat32 ¶
func CombineFieldInt32 ¶
func CopyEsIndex ¶ added in v0.0.18
func CopyEsIndex(ctx context.Context, client *elastic.Client, src string, target string) (success bool, err error)
CopyEsIndex 复制 es 索引
func GetCurrentSliceESIndex ¶ added in v0.0.18
GetCurrentSliceESIndex 分片基础函数
func GetESMapping ¶ added in v0.0.18
func GetESMapping(ctx context.Context, client *elastic.Client, index ...string) (result map[string]interface{}, err error)
GetESMapping 获取指定索引的 mapping
func GetEsIndex ¶ added in v0.0.18
GetEsIndex 默认获取批量索引的方法
func GetSliceESIndexByDateRange ¶ added in v0.0.18
func GetSliceESIndexByDateRange(indexName string, startDate string, endDate string) (indexArr []string, err error)
GetSliceESIndexByDateRange 根据时间格式过滤索引 可传递的格式有 2006-01-02 2006-1-02 2006-1-2 20060102
func GetSliceESIndexByTimeRange ¶ added in v0.0.18
func GetSliceESIndexByTimeRange(indexName string, startTime time.Time, endTime time.Time) (indexArr []string, err error)
GetSliceESIndexByTimeRange 根据时间格式过滤索引
func GetStructStringField ¶
GetStructStringField 获取struct中指定key的string值
func InterfaceToResult ¶
func InterfaceToResult(resultList []interface{}, returnItems ...interface{}) error
InterfaceToResult 将interface 里面的字段赋值给后面各种变量
func StructByReflect ¶
StructByReflect 遍历struct并且自动进行赋值
Types ¶
type CallBody ¶
type CallBody struct { FuncName interface{} // 要执行的函数本体 Params []interface{} // 要传的函数参数, 需要类型和数量都保持一致 }
CallBody 单个函数的请求体
type KT ¶
func GetStructKeyType ¶
GetStructKeyType 获取struct的kv结构
type ResponseBody ¶
type ResponseBody struct { Result []interface{} // 函数返回的所有结果(包括常用 error), 包括业务返回的错误 Index int // 传入时的顺序 Err error // 函数在 callBack 里调用时的错误 }
func BatchExec ¶
func BatchExec(task CallTask) (resultList []ResponseBody, err error)
BatchExec 并发执行, 需限制总的并发数量
func SyncBatchExec ¶
func SyncBatchExec(task CallTask) (resultList []ResponseBody, err error)
SyncBatchExec 同步执行, 用于不方便并发执行的业务
func (*ResponseBody) GetResult ¶
func (resp *ResponseBody) GetResult(returnItems ...interface{}) error
GetResult 将返回结果以反射的方式赋值给传入参数
Source Files ¶
Click to show internal directories.
Click to hide internal directories.