tutils

package
v1.0.0-pre5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncCost

func FuncCost(start time.Time, printer Printer)

FuncCost 获取函数的运行时间

func GetDateAgo

func GetDateAgo(ago int64, format ...string) string

GetDateAgo 获取n天前的时间

func GetTimeFromTimestamp

func GetTimeFromTimestamp(tm int64, format ...string) string

GetTimeFromTimestamp 根据时间戳打印对应的日期

func LogModule

func LogModule(module string, fields ...map[string]interface{}) *logrus.Entry

func LogWithCtx

func LogWithCtx(ctx context.Context, module string, fields ...map[string]interface{}) *logrus.Entry

func RunPeriod

func RunPeriod(interval time.Duration, handler func(), closeCh ...chan struct{})

RunPeriod 周期运行函数

Types

type EUnit

type EUnit[K any] struct {
	Raw   K
	Field []byte
}

func SortFieldsWithGbk

func SortFieldsWithGbk[K any](units []EUnit[K], offset int, limit int, desc bool) ([]EUnit[K], error)

SortFieldsWithGbk 按照中文排序

type Printer

type Printer func(time.Duration)

Jump to

Keyboard shortcuts

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