util

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const NanoGap = 1000 * 1000

NanoGap export

Variables

This section is empty.

Functions

func AbsInt64

func AbsInt64(n int64) int64

AbsInt64 for int64

func BeginningOfMonth

func BeginningOfMonth(t time.Time) time.Time

BeginningOfMonth export

func CalcCurrentTimeGap

func CalcCurrentTimeGap(d string) (time.Time, error)

CalcCurrentTimeGap d = duration string

func CheckFileExist

func CheckFileExist(filePath string) (exist bool)

CheckFileExist for file

func CheckPathExist

func CheckPathExist(path string) bool

CheckPathExist check path exist

func ConcatBytes

func ConcatBytes(arr ...[]byte) []byte

ConcatBytes TL;DR

func ConcatStrings

func ConcatStrings(arr ...[]string) []string

ConcatStrings from string array

func CreateDirPath

func CreateDirPath(dirPath string) error

CreateDirPath make -p

func CreateFilePath

func CreateFilePath(filePath string) error

CreateFilePath make dir by file

func CurrentMilliseconds

func CurrentMilliseconds() int64

CurrentMilliseconds TL;DR

func CurrentTime

func CurrentTime() string

CurrentTime export

func Decrypt

func Decrypt(raw string, hashPassword string) int

Decrypt check hash string with salt return 0 equal, < less, > great

func Encrypt

func Encrypt(key string) string

Encrypt key with random salt return [salt]$[hash]

func EncryptWithSalt

func EncryptWithSalt(key string, salt string) string

EncryptWithSalt key with salt return [salt]$[hash]

func EndOfMonth

func EndOfMonth(t time.Time) time.Time

EndOfMonth export

func GBK2UTF8

func GBK2UTF8(s []byte) (string, error)

GBK2UTF8 : transform GBK byte array into UTF8 string

func GenUUID

func GenUUID() string

GenUUID in md5 hash

func GetEnvInt

func GetEnvInt(key string) int

GetEnvInt TL;DR

func GetEnvString

func GetEnvString(key string) string

GetEnvString TL;DR

func GetInternalIPAddress

func GetInternalIPAddress() (string, error)

GetInternalIPAddress TL;DR

func IndexOfInt32

func IndexOfInt32(s []int32, d int32) int

IndexOfInt32 export

func IndexOfString

func IndexOfString(s []string, substr string) int

IndexOfString for slice string find substr

func InitLog

func InitLog(debug bool, logFile string) *zap.Logger

InitLog in global

func InitRotateLog

func InitRotateLog(debug bool, logFile string) *zap.Logger

InitRotateLog export

func MD5

func MD5(s string) string

MD5 sting

func MD5Byte

func MD5Byte(b []byte) string

MD5Byte bytes

func Max

func Max(x, y int64) int64

Max for int64

func MaxInt

func MaxInt(x, y int) int

MaxInt for int

func MaxInt32

func MaxInt32(x, y int32) int32

MaxInt32 for int32

func Min

func Min(x, y int64) int64

Min for int64

func MinInt

func MinInt(x, y int) int

MinInt for int

func MinInt32

func MinInt32(x, y int32) int32

MinInt32 for int32

func RandString

func RandString(n int) string

RandString to get random length string code

func ToDateTimeString

func ToDateTimeString(i interface{}, s string) string

ToDateTimeString TL;DR

func UTF82GBK

func UTF82GBK(s string) ([]byte, error)

UTF82GBK : transform UTF8 rune into GBK byte array

Types

This section is empty.

Jump to

Keyboard shortcuts

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