util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_SECNDS_OF_ONE_DAY    = 86400
	TIME_FORMAT_YMDHIS_LAYOUT = "2006-01-02 15:04:05"
	TIME_FORMAT_YMD_LAYOUT    = "2006-01-02"
	TIME_FORMAT_GMT_LAYOUT    = "Mon, 02 Jan 2006 15:04:05 GMT"
)

Variables

This section is empty.

Functions

func Bytes2String

func Bytes2String(b []byte) string

func GetDeployRootPath

func GetDeployRootPath(evalSymlinks bool) string

GetDeployRootPath得到部署的根目录 evalSymlinks参数是是否需要软链,一般情况传入true

func GetGmtDate added in v1.1.0

func GetGmtDate() string

func Stack

func Stack(skip int) []byte

Stack返回格式化的调用栈,skip参数用来设置忽略调用栈中的栈帧数量

func StackNoNewLine

func StackNoNewLine(skip int) string

StackNoNewLine返回当前调用栈的信息,不含有换行符。 日志中输出调用栈信息可以用此方法,用于某些日志采集程序不支持多行的情况

func StrToTimestamp added in v1.1.0

func StrToTimestamp(str string, layout string) (int64, error)

年月日时分秒转时间戳

func String2Bytes

func String2Bytes(s string) []byte

func TimestampToStr added in v1.1.0

func TimestampToStr(timestamp int64, layout string) string

时间戳转年月日时分秒

Types

This section is empty.

Jump to

Keyboard shortcuts

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