common

package
v0.0.0-...-4e81ba4 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 19 Imported by: 48

Documentation

Index

Constants

View Source
const (
	NUmStr  = "0123456789"
	CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	SpecStr = "+=-@#~,.[]()!%^*$"
)

Variables

This section is empty.

Functions

func ByteConvertString

func ByteConvertString(in []byte) (str string)

ByteConvertString byte conver to string

func ByteConvertUint16

func ByteConvertUint16(in []byte) (n uint16)

ByteConvertUint16 .

func ByteConvertUint32

func ByteConvertUint32(in []byte) (n uint32)

ByteConvertUint32 .

func CallStack

func CallStack(pre string, skip int) string

CallStack .

func CreateDir

func CreateDir(dirPath string) (err error)

CreateDir create dir

func CreateDirv2

func CreateDirv2(dirPath string) (err error)

func CreateFile

func CreateFile(fp string, body []byte) (err error)

CreateFile create or update file

func DateStr2Ts

func DateStr2Ts(ds string) int64

DateStr2Ts .

func DebugByte

func DebugByte(in []byte) (str string)

DebugByte conver byte to string

func FileMd5

func FileMd5(fileName string) (sMd5 string, err error)

FileMd5 获取文件MD5值

func GetDate

func GetDate() (cur_date string)

GetDate format: 2014-07-26

func GetDateTime

func GetDateTime() (cur_datetime string)

GetDateTime format: 2006-01-02 15:04:05

func GetDateTimeByFormat

func GetDateTimeByFormat(format string) (cur_datetime string)

GetDateTimeByFormat return string datetime in format.

func GetDayMin

func GetDayMin() (min int)

GetDayMin .

func GetDaySec

func GetDaySec() (sec int)

GetDaySec .

func GetDays

func GetDays(year, month int64) (days int64)

GetDays .

func GetHMBYMin

func GetHMBYMin(sec int) (h, min int)

GetHMBYMin .

func GetHMBYSec

func GetHMBYSec(sec int) (h, min int)

GetHMBYSec .

func GetIID

func GetIID() uint64

GetIID Get incremental id.

func GetIPAddr

func GetIPAddr(n net.Addr) string

GetIPAddr .

func GetIPAddrByName

func GetIPAddrByName(dev string) (ips []string, err error)

GetIPAddrByName .

func GetPort

func GetPort(n net.Addr) (port string)

GetPort .

func GetPortInt32

func GetPortInt32(n net.Addr) (port int32)

GetPortInt32 .

func GetRandPasswd

func GetRandPasswd(length int, ct string) string

GetRandPasswd .

func GetRemoteIPPort

func GetRemoteIPPort(n net.Addr) (ip string, port int32)

GetRemoteIPPort .

func GetTimeMs

func GetTimeMs() int64

GetTimeMs .

func GetTimeNs

func GetTimeNs() int64

GetTimeNs .

func GetTimeSec

func GetTimeSec() int64

GetTimeSec .

func GetTimeUs

func GetTimeUs() int64

GetTimeUs .

func GetUTCDate

func GetUTCDate() (cur_date string)

GetUTCDate format,格式为: 2014-07-26

func GetUTCDateTime

func GetUTCDateTime() (cur_datetime string)

GetUTCDateTime format: 2006-01-02 15:04:05

func GetUTCTimeMs

func GetUTCTimeMs() int64

GetUTCTimeMs .

func GetUTCTimeNs

func GetUTCTimeNs() int64

GetUTCTimeNs .

func GetUTCTimeSec

func GetUTCTimeSec() int64

GetUTCTimeSec .

func GetUTCTimeUs

func GetUTCTimeUs() int64

GetUTCTimeUs .

func GetYear

func GetYear() int

GetYear get year

func IsDir

func IsDir(p string) bool

IsDir .

func IsFile

func IsFile(p string) bool

IsFile .

func LoadFileToByte

func LoadFileToByte(filePath string) (d []byte, err error)

LoadFileToByte .

func PathIsExist

func PathIsExist(p string) bool

PathIsExist check path

func RandRange

func RandRange(max int) int

RandRange rand range max value

func RemoveDuplicatesAndEmptyString

func RemoveDuplicatesAndEmptyString(in []string) (ret []string)

RemoveDuplicatesAndEmptyString .

func RemoveDuplicatesInt

func RemoveDuplicatesInt(in []int) (ret []int)

RemoveDuplicatesInt .

func Round

func Round(val float64, places int) float64

Round .

func Sleep

func Sleep(Sec int)

Sleep second

func SleepMs

func SleepMs(ms int64)

SleepMs .

func SleepUs

func SleepUs(us int64)

SleepUs .

func TimeStamp2DateStr

func TimeStamp2DateStr(tsSec int64) string

TimeStamp2DateStr .

func TimerFunc

func TimerFunc(seconds int, callFunc func()) *time.Timer

TimerFunc timer func

func Ts2Date

func Ts2Date(tsSec int64) (date uint32)

Ts2Date .

func Ts2Ymd

func Ts2Ymd(tsSec int64) (year, month, days int)

Ts2Ymd .

func Uint16ConvertByte

func Uint16ConvertByte(v uint16) (out []byte)

Uint16ConvertByte .

func Uint32ConvertByte

func Uint32ConvertByte(v uint32) (out []byte)

Uint32ConvertByte .

func ValueIsExist

func ValueIsExist(array interface{}, lv interface{}) bool

ValueIsExist .

func WaitCtrlC

func WaitCtrlC()

WaitCtrlC .

Types

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

func (*Timer) Reset

func (tf *Timer) Reset(sec int, callFunc func())

func (*Timer) Set

func (tf *Timer) Set(sec int, callFunc func())

func (*Timer) Stop

func (tf *Timer) Stop() bool

Jump to

Keyboard shortcuts

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