toolkit

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtLayoutStr = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func ApiSign

func ApiSign(req string, key string) string

func ArrayCheckIn

func ArrayCheckIn(target string, strArray []string) bool

func ConvertToString

func ConvertToString(value interface{}) string

func DecimalAdd

func DecimalAdd(d1 decimal.Decimal, d2 decimal.Decimal) decimal.Decimal

加法

func DecimalAddMore

func DecimalAddMore(ds ...decimal.Decimal) decimal.Decimal

连续加法

func DecimalDiv

func DecimalDiv(d1 decimal.Decimal, d2 decimal.Decimal) decimal.Decimal

除法

func DecimalDivMore

func DecimalDivMore(ds ...decimal.Decimal) decimal.Decimal

连续除法

func DecimalGreaterThan

func DecimalGreaterThan(d1 decimal.Decimal, d2 decimal.Decimal) bool

大于

func DecimalGreaterThanOrEqual

func DecimalGreaterThanOrEqual(d1 decimal.Decimal, d2 decimal.Decimal) bool

大于等于

func DecimalLessThan

func DecimalLessThan(d1 decimal.Decimal, d2 decimal.Decimal) bool

小于

func DecimalLessThanOrEqual

func DecimalLessThanOrEqual(d1 decimal.Decimal, d2 decimal.Decimal) bool

小于等于

func DecimalMul

func DecimalMul(d1 decimal.Decimal, d2 decimal.Decimal) decimal.Decimal

乘法

func DecimalMulMore

func DecimalMulMore(ds ...decimal.Decimal) decimal.Decimal

连续乘法

func DecimalSub

func DecimalSub(d1 decimal.Decimal, d2 decimal.Decimal) decimal.Decimal

减法

func DecimalSubMore

func DecimalSubMore(ds ...decimal.Decimal) decimal.Decimal

连续减法

func DecimalToFloat64

func DecimalToFloat64(d decimal.Decimal) float64

float

func DecimalToInt64

func DecimalToInt64(d decimal.Decimal) int64

int

func DecimalToString

func DecimalToString(d decimal.Decimal) string

func DeepCopy

func DeepCopy(value interface{}) interface{}

func EqualSliceElem

func EqualSliceElem(obj, target interface{}) bool

func ExternalIP

func ExternalIP() (string, error)

func GetActivityBeginTime

func GetActivityBeginTime(beginTimeEv string) (int64, error)

func GetCurrTimeStr

func GetCurrTimeStr() string

func GetCurrentDay

func GetCurrentDay(d time.Time, hour, min int) time.Time

func GetCurrentDayStr

func GetCurrentDayStr(d time.Time) string

func GetCurrentTime

func GetCurrentTime() time.Time

func GetCurrentTimeAdd

func GetCurrentTimeAdd(add int) time.Time

获取时间,自定义时区

func GetDateDifferDay

func GetDateDifferDay(d time.Time, days int) time.Time

获取相差时间

func GetDayPoint

func GetDayPoint(bTime, eTime int64) (point []string)

获取时间段内的每天日期

func GetDayPoint2

func GetDayPoint2(st, et int64) (points []string)

func GetExpireTimeDay

func GetExpireTimeDay(expireUnixT, nowUnix int64) int32

func GetExportExcelFileName

func GetExportExcelFileName(prefix string, flags ...string) string

func GetFileSize

func GetFileSize(path string) int64

不存在返回0

func GetFirstDateOfMonth

func GetFirstDateOfMonth(d time.Time) time.Time

获取当月开始时间

func GetFirstDateOfWeek

func GetFirstDateOfWeek(d time.Time) time.Time

获取当周开始时间

func GetHostName

func GetHostName() string

func GetLastDateOfMonth

func GetLastDateOfMonth(d time.Time) time.Time

获取当月结束时间

func GetLastDateOfWeek

func GetLastDateOfWeek(d time.Time) time.Time

获取当周结束时间

func GetLocalIp

func GetLocalIp() (net.IP, error)

func GetMSTimeStamp

func GetMSTimeStamp() int64

func GetMonthPoint

func GetMonthPoint(bTime, eTime int64) (point []string)

获取时间段内的每月日期

func GetMonthPoint2

func GetMonthPoint2(st, et int64) (points []string)

func GetNDayPoint

func GetNDayPoint(n int, eTime int64) (startT, endT int64, m map[string]StartAndStopTime)

获取7天日期

func GetNMonthPoint

func GetNMonthPoint(n int, eTime int64) (startT, endT int64, m map[string]StartAndStopTime)

获取7月日期

func GetNWeekPoint

func GetNWeekPoint(n int, eTime int64) (startT, endT int64, m map[string]StartAndStopTime)

获取7周日期

func GetNanoTimeStamp

func GetNanoTimeStamp() int64

func GetNextDaySecond

func GetNextDaySecond() time.Duration

获取到第二天0点的秒数

func GetNicIPs

func GetNicIPs(ifname string) ([]net.IP, error)

func GetSecTimeStamp

func GetSecTimeStamp() int64

func GetTimeStamp

func GetTimeStamp() int64

func GetUniqId

func GetUniqId(apiName string) (string, string, error)

func GetWeekPoint

func GetWeekPoint(bTime, eTime int64) (point []string)

获取时间段内的每周日期

func GetWeekPoint2

func GetWeekPoint2(st, et int64) (points []string)

func GetYesterDayBeginAndEndTimestamp

func GetYesterDayBeginAndEndTimestamp() (int64, int64)

func GetZeroTimeOfDay

func GetZeroTimeOfDay(d time.Time) time.Time

获取当天的0点时间

func HiddenPhone

func HiddenPhone(phone string) string

func Interface2IntSlice

func Interface2IntSlice(sList []interface{}) ([]int, error)

func IpIntToStringBig

func IpIntToStringBig(ipInt int) string

func Md5Digest

func Md5Digest(data string) string

func Md5Sum

func Md5Sum(str string) string

func ParseTimeOfCustom

func ParseTimeOfCustom(unixT int64, layStr string) string

func ParseTimeOfStr

func ParseTimeOfStr(unixT int64) string

func PathExists

func PathExists(path string) bool

func RandomHexadecimal

func RandomHexadecimal() string

16进制字符串

func RandomInt

func RandomInt(min int, max int) int

func RandomLowerLetterString

func RandomLowerLetterString(l int) string

func RandomString

func RandomString(l int) string

func SliceInt2String

func SliceInt2String(iList []int) []string

func SliceString2int

func SliceString2int(sList []string) []int

func StrAtoi

func StrAtoi(value string) int

func StrAtoi64

func StrAtoi64(value string) int64

func StrAtoiCheckFloat

func StrAtoiCheckFloat(value string) int

func StrIsAllNum

func StrIsAllNum(s string) bool

func StrToTime

func StrToTime(t string) (time.Time, error)

字符串转时间(带时区)

func Time2MSTimeStamp

func Time2MSTimeStamp(t *time.Time) int64

func Uniq

func Uniq(data sort.Interface) (size int)

func UpdateImportTaskDescFile

func UpdateImportTaskDescFile(descFile, desc string, reload bool, rTime int) error

descFile 文件名 desc 描述 reload 是否自动刷新 rTime 刷新时间(默认3000)

Types

type CustomTime

type CustomTime struct {
	time.Time
}

func (*CustomTime) GetCurrTimeStr

func (ct *CustomTime) GetCurrTimeStr() string

func (*CustomTime) IsSet

func (ct *CustomTime) IsSet() bool

func (*CustomTime) MarshalJSON

func (ct *CustomTime) MarshalJSON() ([]byte, error)

func (*CustomTime) UnmarshalJSON

func (ct *CustomTime) UnmarshalJSON(b []byte) (err error)

type GoPool

type GoPool struct {
	//对外接收Task的入口
	EntryChannel chan *GoTask
	// contains filtered or unexported fields
}
有关协程池的定义及操作

定义池类型

func NewGoPool

func NewGoPool(cap int) *GoPool

创建一个协程池

func (*GoPool) Run

func (p *GoPool) Run()

让协程池Pool开始工作

type GoTask

type GoTask struct {
	// contains filtered or unexported fields
}
有关Task任务相关定义及操作

定义任务Task类型,每一个任务Task都可以抽象成一个函数

func NewGoTask

func NewGoTask(f func() error) *GoTask

通过NewGoTask来创建一个GoTask

func (*GoTask) Execute

func (t *GoTask) Execute()

执行Task任务的方法

type Int64Arr

type Int64Arr []int64

func (Int64Arr) Len

func (a Int64Arr) Len() int

func (Int64Arr) Less

func (a Int64Arr) Less(i, j int) bool

func (Int64Arr) Swap

func (a Int64Arr) Swap(i, j int)

type NetIfs

type NetIfs map[string]net.Interface

func GetNetIfs

func GetNetIfs() (NetIfs, error)

type StartAndStopTime

type StartAndStopTime struct {
	StartTime int64
	StopTime  int64
}

type UInt64Slice

type UInt64Slice []uint64

func (UInt64Slice) Len

func (a UInt64Slice) Len() int

func (UInt64Slice) Less

func (a UInt64Slice) Less(i, j int) bool

func (UInt64Slice) Swap

func (a UInt64Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

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