util

package
v0.0.0-...-bac99df Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func DeserializeFromStringArray

func DeserializeFromStringArray(i interface{}, stringArray []string) (err error)

func DeserializeStructFromExcelRow

func DeserializeStructFromExcelRow(e interface{}, row *xlsx.Row) (err error)

func FormatFieldName

func FormatFieldName(raw string) (name string)

格式化字段名, 比如: xlsx表字段, mysql表字段

func GetDurationToNextHalfHour

func GetDurationToNextHalfHour() time.Duration

获取下个整点或半小时到当前的时差

func GetDurationToNextMinute

func GetDurationToNextMinute() time.Duration

获取当前和下一分钟的时差

func GetNextHalfHour

func GetNextHalfHour() time.Time

获取整点和半小时 例如: 当前是19:20, 则获取到的是19:30, 如果是19:40, 获取到的是20:00

func GetNextMinute

func GetNextMinute() time.Time

获取下一分钟时间戳

func GetProgramFileBaseName

func GetProgramFileBaseName() string

获取当前可执行文件名(不含扩展名)

func GetTheDayBeginTime

func GetTheDayBeginTime(src time.Time, days int) (desc time.Time)

获取距离某时刻n天的开始时刻

func GetThisMinute

func GetThisMinute() time.Time

获取这一分钟时间戳

func GetThisWeekMondayBeginTime

func GetThisWeekMondayBeginTime(src time.Time) (desc time.Time)

获取某周周一0点0分0秒时刻

func GetTypeName

func GetTypeName(i interface{}) string

获取接口中存放的实例的类型名

func IsDirOrFileExist

func IsDirOrFileExist(path string) error

如果目录不存在创建指定目录

func IsSameDayUnixTimeStamp

func IsSameDayUnixTimeStamp(t1 int64, t2 int64) bool

判断2个unix时间戳是不是同一天

func LowerFirst

func LowerFirst(str string) string

func MD5Sum

func MD5Sum(input []byte) (output []byte)

生成md串

func MD5Sumf

func MD5Sumf(format string, args ...interface{}) (output []byte)

生成md串

func MakeSignalChannel

func MakeSignalChannel(sig ...os.Signal) chan os.Signal

func MustMkdirIfNotExist

func MustMkdirIfNotExist(path string)

如果目录不存在创建指定目录

func ParseTimeString

func ParseTimeString(strTime string) (time.Time, error)

func ParseTimeStringByFormat

func ParseTimeStringByFormat(fmt string, strTime string) (time.Time, error)

解析时间字符串, 返回UTC时间

func ParseTimeStringInLocation

func ParseTimeStringInLocation(strTime string) (time.Time, error)

func ParseTimeStringInLocationByFormat

func ParseTimeStringInLocationByFormat(fmt string, strTime string) (time.Time, error)

解析时间字符串, 返回本地时间

func ReadLineFromConsole

func ReadLineFromConsole() (string, error)

func UpperFirst

func UpperFirst(str string) string

func WaitExitSignal

func WaitExitSignal() os.Signal

func Walk

func Walk(dir string, extend string, whiteList []string, blackList []string, fn func(path string, info os.FileInfo, name string, isInBlackList bool) bool) (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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