function

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeLayout    string = "2006-01-02 15:04:05"
	TimeLayoutYMD string = "2006-01-02"
	TimeLayoutHMS string = "15:04:05"
)

Functions

func AddSecondToTime added in v0.0.3

func AddSecondToTime(second int64) (timestamp int64, Time time.Time, timeStr string)

AddSecondToTime 在当前时间戳的基础上加上秒数,重新生成时间日期

func AesDecrypt added in v0.0.6

func AesDecrypt(encrypted []byte, key []byte) ([]byte, error)

AesDecrypt AES解密

func AesDecryptBase64 added in v0.0.6

func AesDecryptBase64(str, key string) (string, error)

AesDecryptBase64 对Base64格式的字符串解密

func AesEncrypt added in v0.0.6

func AesEncrypt(origData []byte, key []byte) ([]byte, error)

AesEncrypt AES加密

func AesEncryptBase64 added in v0.0.6

func AesEncryptBase64(str, key string) (string, error)

AesEncryptBase64 加密后为Base64格式的字符串

func AfterDayTime added in v0.1.3

func AfterDayTime(day int) (timestamp int64, Time time.Time, timeStr string)

AfterDayTime N天后的时间

func BeforeDayTime added in v0.0.17

func BeforeDayTime(day int) (timestamp int64, Time time.Time, timeStr string)

BeforeDayTime N天前的时间

func CheckEmailRule added in v0.0.2

func CheckEmailRule(email string) bool

CheckEmailRule 验证电子邮箱

func CheckIdNumRule added in v0.0.2

func CheckIdNumRule(idNum string) bool

CheckIdNumRule 验证身份证号码的合法性

func CheckIdNumRuleSimple added in v0.0.19

func CheckIdNumRuleSimple(idNum string) bool

CheckIdNumRuleSimple 简单校验身份证号码的位数+组成字符

func CheckMobileNumRule added in v0.0.2

func CheckMobileNumRule(mobile string) bool

CheckMobileNumRule 验证手机号码

func CheckStringLength added in v0.0.14

func CheckStringLength(str string, length int) bool

CheckStringLength 判断字符串长度是否在规定范围内

func CreateOrderNo added in v0.1.0

func CreateOrderNo() (sn string)

CreateOrderNo 生成平台32位订单号

func DiyTimeFmtStr added in v0.1.2

func DiyTimeFmtStr(format string, timestamps ...int64) string

DiyTimeFmtStr Diy时间格式

func DownInt added in v0.2.2

func DownInt(f float64) float64

DownInt 向下取整

func EarthDistance added in v0.3.2

func EarthDistance(lat1, lng1, lat2, lng2 float64) float64

EarthDistance 两点之间的距离,不分前后[单位:米]

func Float32ToString added in v0.0.2

func Float32ToString(f float64) string

Float32ToString float32转string

func Float64ToInt64 added in v0.2.9

func Float64ToInt64(f float64) int64

Float64ToInt64 float64转int64

func Float64ToString added in v0.0.2

func Float64ToString(f float64) string

Float64ToString float64转string

func FloatRound added in v0.2.2

func FloatRound(f float64, n int) (res float64, err error)

FloatRound 四舍五入 [n为保留的小数点位数] [不优先使用]

func GetDay added in v0.3.4

func GetDay() (string, string)

GetDay 获取当天的初始和结束日期

func GetMonthDay added in v0.3.3

func GetMonthDay() (string, string)

GetMonthDay 获得当前月的初始和结束日期

func GetQuarterDay added in v0.3.3

func GetQuarterDay() (string, string)

GetQuarterDay 获得当前季度的初始和结束日期

func GetWeekDay added in v0.3.3

func GetWeekDay() (string, string)

GetWeekDay 获得当前周的初始和结束日期

func GetYearDay added in v0.3.4

func GetYearDay() (string, string)

GetYearDay 获取当年的初始和结束日期

func InSlice added in v0.2.6

func InSlice(slice []string, target string) bool

InSlice 判断切片中是否存在某值

func Int64ToFloat64 added in v0.2.9

func Int64ToFloat64(i64 int64) float64

Int64ToFloat64 int64转float64

func Int64ToInt added in v0.0.2

func Int64ToInt(i64 int64) int

Int64ToInt int64转int

func Int64ToString added in v0.0.2

func Int64ToString(i64 int64) string

Int64ToString int64转string

func IntToInt64 added in v0.3.0

func IntToInt64(i int) int64

IntToInt64 int转int64

func InterceptDecimal added in v0.2.2

func InterceptDecimal(f float64, n int) float64

InterceptDecimal 不四舍五入截取小数点 [n为保留的小数点数]

func InterceptDecimalToString added in v0.2.5

func InterceptDecimalToString(f float64, n int) string

InterceptDecimalToString 不四舍五入截取小数点后为字符串格式 [n为保留的小数点数]

func Md5 added in v0.0.2

func Md5(str string) string

Md5 md5加密

func NowDateTime added in v0.2.0

func NowDateTime() time.Time

NowDateTime 当前时间戳

func NowDateTimeFmtStr added in v0.2.0

func NowDateTimeFmtStr() string

NowDateTimeFmtStr 当前时间格式

func NowDateTimeStr added in v0.2.0

func NowDateTimeStr() string

NowDateTimeStr 当前时间字符串

func NowTime added in v0.0.4

func NowTime() (timestamp int64, Time time.Time, timeStr string)

NowTime 当前时间

func NowTimeSplit added in v0.0.11

func NowTimeSplit() (ymd, hms string)

NowTimeSplit 当前时间格式拆分

func PKCS7Padding added in v0.0.6

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding PKCS7 填充模式

func PKCS7UnPadding added in v0.0.6

func PKCS7UnPadding(origData []byte) ([]byte, error)

PKCS7UnPadding 填充的反向操作,删除填充字符串

func RandString added in v0.0.7

func RandString() string

RandString 32位随机字符串

func RemoveInvalid0 added in v0.2.9

func RemoveInvalid0(f float64) float64

RemoveInvalid0 去掉无效的0

func RemoveInvalid0ToString added in v0.2.9

func RemoveInvalid0ToString(f float64) string

RemoveInvalid0ToString 去掉无效的0并转为字符串格式

func Ripemd160 added in v0.2.8

func Ripemd160(str string) string

Ripemd160 RIPEMD-160加密[40位16进制数字]

func RoundFloat added in v0.2.2

func RoundFloat(f float64, n int) (res float64, err error)

RoundFloat 四舍五入 [n为保留的小数点位数] [优先使用]

func RoundToString added in v0.2.5

func RoundToString(f float64, n int) string

RoundToString 四舍五入后为字符串格式 [n为保留的小数点位数]

func Sha1 added in v0.0.2

func Sha1(str string) string

Sha1 sha1加密

func Sha256 added in v0.2.8

func Sha256(str string) string

Sha256 sha256加密[64位16进制数字]

func Sha512 added in v0.2.8

func Sha512(str string) string

Sha512 sha512加密[128位16进制数字]

func SpellReadNum added in v0.0.18

func SpellReadNum(str string) (slice []string, err error)

SpellReadNum 拼读数

func StrLengthCutAndSplitJoint added in v0.0.13

func StrLengthCutAndSplitJoint(str string, cutLength int, splitJointStr ...string) string

StrLengthCutAndSplitJoint 字符串长度截取并拼接处理

func StringToFloat64 added in v0.2.7

func StringToFloat64(s string) (float64, error)

StringToFloat64 string转float64

func StringToInt64 added in v0.2.9

func StringToInt64(str string) (int64, error)

StringToInt64 string转int64

func SubDays added in v0.3.0

func SubDays(t1, t2 time.Time) (day int)

SubDays 两个时间相隔多少天 [t1 - t2]

func SubMonth added in v0.3.1

func SubMonth(t1, t2 time.Time) (month int)

SubMonth 两个时间相隔多少个月 [t1 - t2]

func SubMonths added in v0.3.0

func SubMonths(t1, t2 time.Time) (month int)

SubMonths 两个时间相隔多少个月 [t1 - t2]

func TimeSplit added in v0.0.11

func TimeSplit(t time.Time) (ymd, hms string)

TimeSplit 时间格式拆分

func TimeStrToTime added in v0.0.2

func TimeStrToTime(str string) (timestamp int64, Time time.Time)

TimeStrToTime 将时间字符串转为时间戳和time.Time(例如:2021-08-08 08:08:08)

func TimestampToTime added in v0.0.4

func TimestampToTime(timestamp int64) (Time time.Time, timeStr string)

TimestampToTime 时间戳转日期格式

func ToBigCamelCase added in v0.2.4

func ToBigCamelCase(str string, signs ...string) (res string)

ToBigCamelCase 字符串转大驼峰格式

func ToSmallCamelCase added in v0.2.4

func ToSmallCamelCase(str string, signs ...string) (res string)

ToSmallCamelCase 字符串转小驼峰格式

func TodayDateTimeEnd added in v0.2.0

func TodayDateTimeEnd() (timestamp int64, Time time.Time, timeStr string)

TodayDateTimeEnd 今日23:59:59时间

func TodayDateTimeStart added in v0.2.0

func TodayDateTimeStart() (timestamp int64, Time time.Time, timeStr string)

TodayDateTimeStart 今日00:00:00时间

func UpInt added in v0.2.2

func UpInt(f float64) float64

UpInt 向上取整

func UrlDecode added in v0.0.2

func UrlDecode(str string) (url string)

UrlDecode url_decode

func UrlEncode added in v0.0.2

func UrlEncode(url string) string

UrlEncode url_encode

Types

This section is empty.

Jump to

Keyboard shortcuts

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