Documentation ¶
Index ¶
- Constants
- func AddDate(date string, add time.Duration, format ...string) time.Time
- func AddDateForInt(date string, years, months, days int, format ...string) time.Time
- func CopyFile(src, dst string, isFirstDel ...bool) (err error)
- func Datetime2TimeObj(target string, format ...string) time.Time
- func Datetime2Timestamp(date string, format ...string) int64
- func DatetimeBetween(target, startDatetime, endDatetime string) bool
- func DatetimeIsExpire(date string, expire ...time.Duration) bool
- func DistinctIds(ids []string) []string
- func DistinctIdsStr(s string, split string) string
- func DistinctInt32Ids(ids []int32) (res []int32)
- func FormatBusinessDate(date string) (finalStr string)
- func GetAgeForBirthday(birthday string, format ...string) (age int)
- func GetDateBetween(startDate, endDate string, args ...int32) []string
- func GetInputStr2ShortStr(input string, size ...int) string
- func GetJsonPrintStr(v interface{}) string
- func GetPapeSliceIndex(page, size int32, l int) (startIndex, endIndex int32)
- func GetPlaceholderStrForNum(size int, num int64, placeholder ...byte) string
- func GetProjectDir(projectName string) string
- func GetShortStrForRand(size int, kind ...int) string
- func GetSysPathSplitSymbol() (splitSymbol string)
- func GetTargeMonthDur(target time.Time) (startDatetime, endDatetime string)
- func GetTargetDateDur(target time.Time) (startDatetime, endDatetime string)
- func InInt32Array(target int32, in ...int32) bool
- func InUint8Array(target uint8, in ...uint8) bool
- func IsExported(fieldName string) bool
- func MurmurHash2Uint64(data []byte) (hash uint64)
- func NewCjLogger() *defaultLogger
- func ParseFileFormat(fileName string) string
- func PriceNum2Str(value int32) string
- func PriceStr2Str(value string) (ans string)
- func RemoveTypePtr(t reflect.Type) reflect.Type
- func RemoveValuePtr(t reflect.Value) reflect.Value
- func Second2Hour(s int) (hour, min, sec int)
- func SetLogger(logger Logger)
- func SubDate(date, sub string, format ...string) time.Duration
- func SubNow2Year(year string) string
- func Timestamp2Datetime(timestamp int64, format ...string) string
- type Logger
- type WeekInfo
Constants ¶
const ( DayInt int = 24 * 3600 DayDur time.Duration = 24 * time.Hour DateFmt string = "2006-01-02" DatetimeFmt string = "2006-01-02 15:04:05" StartTimeSuffix string = " 00:00:00" EndTimeSuffix string = " 23:59:59" GetDateBetweenForDate int32 = 1 // 按日处理 GetDateBetweenForMonth int32 = 2 // 按月处理 GetDateBetweenForYear int32 = 3 // 按年处理 )
const ( KCRandKindNum = 0 // 纯数字 KCRandKindLower = 1 // 小写字母 KCRandKindUpper = 2 // 大写字母 KCRandKindAll = 3 // 数字、大小写字母 )
用于获取随机字符串
Variables ¶
This section is empty.
Functions ¶
func AddDateForInt ¶
AddDateForInt 增加时间
func Datetime2TimeObj ¶
Datetime2TimeObj
func Datetime2Timestamp ¶
Datetime2Timestamp 将时间字符串转为时间戳
func DatetimeBetween ¶
DatetimeBetween 判断目标时间是否在开始时间和结束时间之间
func DatetimeIsExpire ¶
DatetimeIsExpire 判断输入时间是否过期
func DistinctIdsStr ¶
DistinctIdsStr 将输入拼接 id 参数按照指定字符进行去重, 如: DistinctIdsStr("12345,123,20,123,20,15", ",") => 12345,123,20,15
func FormatBusinessDate ¶
FormatBusinessDate 将输入的时间转为业务需要时间, 规则如下: 1. 1分钟内发布的: 刚刚 2. 1小时内发布的: X分钟前 3. 超过1小时, 仍在当天: xx:xx 4. 跨天,但少于24小时: 昨天 xx:xx 5. 跨天, 超过24小时: xxxx-xx-xx xx:xx
func GetAgeForBirthday ¶
GetAgeForBirthday 根据出生日期获取年龄
func GetDateBetween ¶
GetDateBetween 获取开始时间和结束时间中的日期 args[0] 为操作类型, 默认为 GetDateBetweenForDate args[1] 为了防止死循环设置的最大循环次数, 默认 365(1年)
func GetInputStr2ShortStr ¶
size 建议不要传入, 这样会提高重复率
func GetPapeSliceIndex ¶
GetPapeSliceIndex 根据page, size对切片进行分页, l 为目标切片的长度
func GetPlaceholderStrForNum ¶
GetPlaceholderStrForNum 获取指定位数占位符的字符串
func GetShortStrForRand ¶
随机字符串, 默认按照: 数字、大小写字母进行处理
func GetSysPathSplitSymbol ¶
func GetSysPathSplitSymbol() (splitSymbol string)
GetSysPathSplitSymbol 根据系统获取路径分隔符
func GetTargeMonthDur ¶
GetCurMonthDur 获取指定月的开始和结束时间
func GetTargetDateDur ¶
GetAddDateDur 获取指定时间的当天开始时间和结束时间
func MurmurHash2Uint64 ¶
通过 Murmur 获取 hash uint64 的哈希值
func NewCjLogger ¶
func NewCjLogger() *defaultLogger
func Timestamp2Datetime ¶
Timestamp2Datetime 将时间戳转为时间字符串
Types ¶
type Logger ¶
type Logger interface { Info(v ...interface{}) Infof(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Warning(v ...interface{}) Warningf(format string, v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) }
Logger