tool

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 15 Imported by: 55

Documentation

Index

Constants

View Source
const (
	AuthHeader = "Authorization"
	Realm      = "Bearer "
)
View Source
const (
	RespCodeSuccess  = 200
	RespCodeNotFound = 404
	RespCodeError    = 500
)
View Source
const (
	RespMsgNotFount = "not found"
	RespMsgIdNum    = "id must be a int value"
)
View Source
const (
	DefaultTimeFormatter = "2006-01-02 15:04:05"
	DateFormatter        = "20060102"
	DatePlusFormatter    = "2006-01-02"
	TimeFormatter        = "150405"
	TimePlusFormatter    = "15:04:05"
)

Variables

This section is empty.

Functions

func BuildAuth added in v1.9.4

func BuildAuth(jwtStr string) (header string, value string)

func BytesToHex

func BytesToHex(data []byte, padding ...string) string

BytesToHex 字节转换Hex字符串 padding[0]: 左填充 padding[1]:右填充(最后一个字节不填充)

func FormatTime

func FormatTime(t time.Time) (s string)

func GetAuth added in v1.9.4

func GetAuth(ctx iris.Context) (auth string, ok bool)

func Int64ToBytes added in v1.11.15

func Int64ToBytes(n int64) (bs []byte)

Int64ToBytes int64-->8byte

func Join

func Join(delimiter string, s ...string) string

func NewInterval added in v1.10.11

func NewInterval(ctx context.Context, duration time.Duration, exitOnErr bool, task func() error)

func RandHexStr added in v1.11.15

func RandHexStr(n int) (s string)

RandHexStr 随机字符串,hex表示.

n:字节数,返回2n个hex字符

func RandStr added in v1.11.16

func RandStr(n int) (s string)

RandStr 随机字符串,返回n个字符

func ResponseJSON

func ResponseJSON(ctx iris.Context, j interface{})

func UUIDString added in v1.11.16

func UUIDString() (s string)

func Walk added in v1.11.17

func Walk(root string, depth int, fun func(path string, info os.FileInfo)) (err error)

Types

type Pk

type Pk struct {
	// ID
	Id int `orm:"pk;auto;column(id)"`
}

type TableChangeInfo

type TableChangeInfo struct {
	// 状态
	Status int `orm:"column(status)"`
	// 创建时间
	CreateTime time.Time `orm:"auto_now_add;type(datetime);column(ctime)"`
	// 修改时间
	UpdateTime time.Time `orm:"auto_now;type(datetime);column(mtime)"`
}

type TableInfo

type TableInfo struct {
	// 创建时间
	CreateTime time.Time `orm:"auto_now_add;type(datetime);column(ctime)"`
}

Jump to

Keyboard shortcuts

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