internal

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log logs.FieldLogger = &logs.Logger{
	Out:   os.Stderr,
	Hooks: make(logs.LevelHooks),
	Formatter: &logs.TextFormatter{
		ForceColors:      true,
		FullTimestamp:    true,
		TimestampFormat:  "01-02 15:04:05.9999",
		QuoteEmptyFields: false,
		CallerPrettifier: nil,
		HideLevelText:    true,
	},
	ReportCaller: false,
	Level:        logs.DebugLevel,
}

Functions

func BuildDir

func BuildDir(absDir string) error

BuildDir 创建目录

func BuildRelativePath added in v0.4.0

func BuildRelativePath(prepath, routerPath string) string

func ByteCountSI added in v0.3.0

func ByteCountSI(b int64) string

ByteCountSI 字节数转带单位

func FileIsExist

func FileIsExist(filename string) bool

FileIsExist 检查目录是否存在

func FindTag

func FindTag(obj interface{}, field, tag string) string

FindTag find struct of tag string.查找struct 的tag信息

func FormatTime added in v0.3.0

func FormatTime(tm time.Time, forStr string) string

FormatTime 格式化时间

func GetCommentAfterPrefixRegex

func GetCommentAfterPrefixRegex(fullComment string, name string) (prefix string, comment string, b bool)

GetCommentAfterPrefixRegex 解析注释 分离前缀和注释内容

func GetCurrentDirectory added in v0.3.0

func GetCurrentDirectory() string

GetCurrentDirectory 获取exe所在目录

func GetDay0 added in v0.3.0

func GetDay0(timestamp int64) time.Time

GetDay0 获取给定日期的零点时间

func GetDayStr added in v0.3.0

func GetDayStr(tm time.Time) string

GetDayStr 获取日期字符串

func GetHour added in v0.3.0

func GetHour(timestamp int64) int

GetHour 当前时间向上取整点

func GetHour0 added in v0.3.0

func GetHour0(timestamp int64) time.Time

GetHour0 获取向上整时时间

func GetIntranetIp added in v0.3.0

func GetIntranetIp() string

func GetLastDayCurrentTime added in v0.3.0

func GetLastDayCurrentTime(timestamp int64, offset int) time.Time

GetLastDayCurrentTime 获取offset天的现在时间:注意时区

func GetLocalTime added in v0.3.0

func GetLocalTime(tm time.Time) time.Time

GetLocalTime 获取本地时间

func GetMod

func GetMod(fileName string) string

func GetMonth0 added in v0.3.0

func GetMonth0(timestamp int64) time.Time

GetMonth0 获取给定时间的当月1号零点时间

func GetPathDirs

func GetPathDirs(absDir string) (re []string)

GetPathDirs 获取目录所有文件夹

func GetSysTimeLayout added in v0.3.0

func GetSysTimeLayout() string

GetSysTimeLayout 获取系统时间的格式

func GetTimeStr added in v0.3.0

func GetTimeStr(tm time.Time) string

GetTimeStr 获取时间字符串

func GetTimeWeek

func GetTimeWeek(timestamp int64) int

GetTimeWeek 获取给定时间的星期

func GetUtcDay0 added in v0.3.0

func GetUtcDay0(tm time.Time) int64

GetUtcDay0 获取给定日期的零点时间

func GetUtcHour0 added in v0.3.0

func GetUtcHour0(tm time.Time) int64

GetUtcHour0 获取向上整时时间

func GetUtcTime added in v0.3.0

func GetUtcTime(tm time.Time) int64

GetUtcTime 获取本地时间戳

func GetUtcWeek0 added in v0.3.0

func GetUtcWeek0(timestamp int64) int64

GetUtcWeek0 获取最近上个星期天的零点日期

func GetWeek0 added in v0.3.0

func GetWeek0(timestamp int64) time.Time

GetWeek0 获取最近上个星期天的零点日期

func IsEnum added in v0.3.4

func IsEnum(t string) bool

func IsInternalType

func IsInternalType(t string) bool

IsInternalType 是否是内部类型

func MarshalToJson added in v0.3.0

func MarshalToJson(obj interface{}, isFormat bool) string

MarshalToJson obj to json string

func OpenBrowser

func OpenBrowser(uri string) error

OpenBrowser Open calls the OS default program for uri

func ReadFile

func ReadFile(fname string) []byte

ReadFile 读取文件

func StrToTime

func StrToTime(tStr, format string, timeZone *time.Location) time.Time

StrToTime 字符串转时间

func StringTimetoUnix added in v0.3.0

func StringTimetoUnix(timestr string) int64

StringTimetoUnix 给定字符串时间转换成本地时间戳

func TimerByHour added in v0.3.0

func TimerByHour(f func())

TimerByHour 整点执行操作

func UnixToTime added in v0.3.0

func UnixToTime(timestamp int64) time.Time

UnixToTime 时间戳转换为time

func WriteFile

func WriteFile(fname string, src []byte, isClear bool) bool

WriteFile 写入文件

Types

type Time

type Time struct {
	time.Time
}

Time json marsh 重写

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (Time) String

func (t Time) String() string

String ...

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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