comm

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MIN = 0.000001

Variables

This section is empty.

Functions

func AppendSlice

func AppendSlice(slice []interface{}, args ...interface{}) []interface{}

func DateTime2Date

func DateTime2Date(DateTime interface{}, formats ...interface{}) (strDate string)

将时间转日期(支持输入'2810-10-28 23:32:00'或 int32/64类型的时间戳) format 可输入字符串"/"或"-",不输入默认使用"-"格式化日期

func DateTimeStr

func DateTimeStr() string

DateTimeStr 生成当前时间字符串

func DateTimeStr2Unix

func DateTimeStr2Unix(strDateTime string, timeFmt ...interface{}) (unixTime int64)

DateTimeStr2Unix 时间字符串转时间戳(时间字符串格式:"2017-01-02 03:04:05") strFmt 明确指出时间字符串格式,"/"表示 "2017/01/06 03:04:05" 默认不传参数为"2017-01-02 03:04:05"格式

func DateTimeUnix

func DateTimeUnix() int64

DateTimeUnix 生成当前时间Unix时间戳

func DateTimeUnix2Str

func DateTimeUnix2Str(Timestamp interface{}, timeFmt ...interface{}) string

DateTimeUnix2Str Unix时间戳转时间字符串(格式:"2017-01-02 03:04:05") Timestamp 时间戳可以是int64或string类型 strFmt 明确指出时间字符串格式,"/"表示 "2017/01/06 03:04:05" 默认不传参数为"2017-01-02 03:04:05"格式

func DateTimeUnix2Time

func DateTimeUnix2Time(Timestamp interface{}) (t time.Time)

将时间戳转为time.Time类型(Timestamp参数支持string和int64类型)

func Decimal2Str

func Decimal2Str(in interface{}) (out string)

数值类型转字符串

func ExcelTime2DateTime

func ExcelTime2DateTime(v interface{}) (strDateTime string)

Excel存储的数值时间转为正常的时间字符串 支持参数类型: string、float32、float64、int、int32、int64

func ExcelTime2Unix

func ExcelTime2Unix(v interface{}) (nUnixTime int64)

func FloatIsEqual

func FloatIsEqual(f1, f2 float64) bool

MIN 为用户自定义的比较精度

func GenRandStrMD5

func GenRandStrMD5(length int) string

func RegexpSubStr

func RegexpSubStr(strIn, strRegExp string) []string

通过正则表达式提取符合规则的子串

func Round

func Round(f float64, n int) float64

截取浮点数 add by dragon

func Str2Float

func Str2Float(in string) (out float64)

字符串转float

func Str2Int

func Str2Int(in string) (out int)

func Str2Int64

func Str2Int64(in string) (out int64)

字符串转int

func StrIndexUtf8

func StrIndexUtf8(strIn, strSub string) (RuneIdx int)

UTF-8字符串查找(按UTF-8字符算一个位置)

func Utf8StrGetFront

func Utf8StrGetFront(strIn, strSub string, bInclude bool) (bFound bool, strOut string)

UTF-8字符串截取子串前面的字符串(bInclude true 表示包括子串,false 表示不包括)

func Utf8StrGetTail

func Utf8StrGetTail(strIn, strSub string, bInclude bool) (bFound bool, strOut string)

UTF-8字符串截取子串后字符串(bInclude true 表示包括子串,false 表示不包括)

Types

type Config

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

func NewConfig

func NewConfig() *Config

func (*Config) GetBool

func (this *Config) GetBool(key string) (value bool)

GetBool returns the value associated with the key as a boolean.

func (*Config) GetInt

func (this *Config) GetInt(key string) (value int)

GetInt returns the value associated with the key as an integer.

func (*Config) GetString

func (this *Config) GetString(key string) (value string)

func (*Config) Open

func (this *Config) Open(strFileName string)

Support JSON YAML TOML HCL

func (*Config) SetDefault

func (this *Config) SetDefault(key string, value interface{})

type SyncStack

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

func NewSyncStack

func NewSyncStack() (ss *SyncStack)

func (*SyncStack) Init

func (this *SyncStack) Init()

func (*SyncStack) Pop

func (this *SyncStack) Pop() (v interface{})

将元素弹出栈,如果元素数为0则等待Push信号

func (*SyncStack) Push

func (this *SyncStack) Push(v interface{})

将元素压入栈中并释放信号

func (*SyncStack) Size

func (this *SyncStack) Size() int

Directories

Path Synopsis
dir

Jump to

Keyboard shortcuts

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