Documentation ¶
Index ¶
- Variables
- func AfterDayTime(days ...int) time.Time
- func AfterDayTimePlus(days int, ts ...time.Time) time.Time
- func AfterMonthTime(months ...int) time.Time
- func AfterSecondTime(seconds ...int64) time.Time
- func AfterYearTime(years ...int) time.Time
- func Base58Decode(str string) string
- func Base58Encode(str string) string
- func Base64Decode(str string) string
- func Base64Encode(str string) string
- func BeforeDayTime(days ...int) time.Time
- func BeforeMonthTime(months ...int) time.Time
- func BeforeSecondTime(seconds ...int64) time.Time
- func BeforeYearTime(years ...int) time.Time
- func Ceil(f64 float64, n ...int) float64
- func CheckCompanyCodeRule(companyCode string) bool
- func CheckEmailRule(email string) bool
- func CheckIdCardFrontAndBackInfoIsFit(address, organization string, seps ...string) bool
- func CheckIdNumRule(idNum string) bool
- func CheckIdNumRuleSimple(idNum string) bool
- func CheckMobileNumRule(mobile string) bool
- func CheckStringLength(str string, length int) bool
- func CheckUrlRule(url string) bool
- func CheckWeChatOpenId(openId string) bool
- func CheckWeChatUnionId(unionId string) bool
- func ChineseToUnicode(str string) string
- func CleanTime()
- func CreateFraction(f64 float64, n int) float64
- func CreateOrderNo() (sn string)
- func DayStartAndEndTime(ts ...time.Time) (startTime, endTime time.Time)
- func DayToTime(day int8, hour, minute, second int8, ts ...time.Time) (t time.Time, err error)
- func DownInteger(f float64) float64
- func DownIntegerToInt64(f float64) int64
- func EarthDistance(lat1, lng1, lat2, lng2 float64, units ...string) float64
- func FebruaryIsLeapYear(year int) bool
- func FenToYuanToString(f int64) string
- func FileExists(path string) bool
- func FileGetContents(filename string) (str string, err error)
- func FilePutContentToAppend(filename string, data string) (err error)
- func FilePutContents(filename string, data string) error
- func Float32ToString(f float64) string
- func Float64MulFloat64(f1, f2 float64) (res float64, exact bool)
- func Float64MulInt64(f float64, i int64) (res float64, exact bool)
- func Float64ToInt64(f float64) int64
- func Float64ToString(f float64) string
- func FloatRound(f float64, n int) (res float64, err error)
- func GenerateOrderNo() string
- func GetBetweenDays(startDate, endDate string, layouts ...string) (d []string)
- func GetBetweenMonths(startDate, endDate string, layouts ...string) (d []string)
- func GetFirstAndEndString(str string) (string, string)
- func GetStringPointer(str string) *string
- func GetStringPointerValue(str *string) string
- func HashFile(path string) (string, error)
- func HashFileToMd5(path string) (string, error)
- func HashHmac(algo, msg, key string) string
- func IdCardBirthHandle(birth string, layouts ...string) (time.Time, error)
- func IdCardDeadlineHandle(date string, layouts ...string) (starTime, endTime time.Time, err error)
- func Idx(str string) string
- func InSlice(slice []string, target string) bool
- func Int64LengthPadding(i64 int64, length int) string
- func Int64ToFloat64(i64 int64) float64
- func Int64ToInt(i64 int64) int
- func Int64ToString(i64 int64) string
- func IntToInt64(i int) int64
- func InterceptDecimal(f float64, n int) float64
- func InterceptDecimalToString(f float64, n int) string
- func IsCCBCardNo(cardNo string) bool
- func IsChinese(str string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func JsonEncode(v interface{}) (string, error)
- func LcFirst(str string) string
- func LcWords(str string) (res string)
- func MapMerge(m1, m2 map[string]string, trimEmpties ...bool) (m map[string]string)
- func Md5(str string) string
- func Md516(str string) string
- func MonthDays(ts ...time.Time) int8
- func MonthStartAndEndTime(ts ...time.Time) (startTime, endTime time.Time)
- func MoreFloat64Mul(fn ...float64) (res float64, exact bool)
- func NewTime(timeStr string, layouts ...string) (err error)
- func NowMonthStartAndEndTime() (startTime, endTime time.Time)
- func NowQuarterStartAndEndTime() (startTime, endTime time.Time)
- func NowWeekStartAndEndTime() (startTime, endTime time.Time)
- func NowYearStartAndEndTime() (startTime, endTime time.Time)
- func OneYearCycleMonthRange(start int) (list []int)
- func OrderNoStrDecode(str string) string
- func OrderNoStrEncode(str string) string
- func QuarterStartAndEndTime(ts ...time.Time) (startTime, endTime time.Time)
- func RandFixedString(i int) string
- func RandNum(length int) (str string)
- func RandShortStringByDate() (str string)
- func RandString() string
- func RandStringToOrderNoPrefix() string
- func RemoveInvalid0(f float64) float64
- func RemoveInvalid0ToString(f float64) string
- func Ripemd160(str string) string
- func RoundFloat(f float64, n int) (res float64, err error)
- func RoundToString(f float64, n int) string
- func RsaDecrypt(str, privateKey string) (string, error)
- func RsaDecryptByte(cipherByte []byte, privateKey string) (decryptOAEP []byte, err error)
- func RsaEncrypt(str, publicKey string) (string, error)
- func RsaEncryptByte(plain []byte, publicKey string) (cipherByte []byte, err error)
- func Sha1(str string) string
- func Sha256(str string) string
- func Sha512(str string) string
- func SliceShuffle(slice *[]string)
- func SliceSort(arr []int64) []int64
- func SliceUnique(slice []string) []string
- func SpellReadNum(str string, formats ...SpellDigitalFormat) (slice []string, err error)
- func StringLength(str string) int
- func StringLengthCutAndSplitJoint(str string, cutLength int, splitJointStr ...string) string
- func StringLengthPadding(str string, length int) string
- func StringToFloat64(s string) (float64, error)
- func StringToInt64(str string) (int64, error)
- func StringToTime(str string, layouts ...string) (time.Time, error)
- func StringYuanToInt64Fen(yuan string) (fen int64, err error)
- func StructToMap(s interface{}) (m map[string]string, err error)
- func SubDays(t1, t2 time.Time) (day int)
- func SubMonths(t1, t2 time.Time) (month int)
- func TimeByDay(day int8, hour, minute, second int8) (t time.Time, err error)
- func TimeNow() time.Time
- func TimeNowUnix() int64
- func TimestampToTime(timestamp int64) time.Time
- func ToBigCamelCase(str string, signs ...string) (res string)
- func ToSmallCamelCase(str string, signs ...string) (res string)
- func TodayStartAndEndTime() (startTime, endTime time.Time)
- func UcFirst(str string) string
- func UcWords(str string) (res string)
- func UnicodeToChinese(s string) (string, error)
- func UniqueId(v ...interface{}) string
- func UpInteger(f float64) float64
- func UpIntegerToInt64(f float64) int64
- func UrlDecode(str string) string
- func UrlEncode(str string) string
- func VerifyECDSASign(signData *ECDSASignData, publicKey *ecdsa.PublicKey) bool
- func WeekStartAndEndTime(ts ...time.Time) (startTime, endTime time.Time)
- func YearStartAndEndTime(ts ...time.Time) (startTime, endTime time.Time)
- func YuanToInt64Fen(yuan float64) (fen int64, err error)
- type ECDSASignData
- type SpellDigitalFormat
Constants ¶
This section is empty.
Variables ¶
var ( TimeLayoutYMDHIS string = "20060102150405" TimeLayout string = "2006-01-02 15:04:05" TimeLayoutYMD string = "2006-01-02" TimeLayoutYM string = "2006-01" )
var TimeVariable int64
TimeVariable 时间变量[有可能是正负数]
Functions ¶
func AfterDayTimePlus ¶ added in v1.3.6
AfterDayTimePlus N天后的当前时间
func AfterMonthTime ¶ added in v0.5.0
AfterMonthTime N月后的当前时间
func AfterSecondTime ¶ added in v0.7.0
AfterSecondTime N秒后的时间
func AfterYearTime ¶ added in v0.7.0
AfterYearTime N年后的当前时间
func BeforeDayTime ¶ added in v0.0.17
BeforeDayTime N天前的当前时间
func BeforeMonthTime ¶ added in v0.5.0
BeforeMonthTime N月前的当前时间
func BeforeSecondTime ¶ added in v0.7.0
BeforeSecondTime N秒前的时间
func BeforeYearTime ¶ added in v0.7.0
BeforeYearTime N年前的当前时间
func CheckCompanyCodeRule ¶ added in v1.2.7
CheckCompanyCodeRule 校验统一社会信用代码
func CheckIdCardFrontAndBackInfoIsFit ¶ added in v0.11.2
CheckIdCardFrontAndBackInfoIsFit 判断身份证住址和签发机关是否一致
func CheckIdNumRule ¶ added in v0.0.2
CheckIdNumRule 验证身份证号码的合法性
func CheckIdNumRuleSimple ¶ added in v0.0.19
CheckIdNumRuleSimple 简单校验身份证号码的位数+组成字符
func CheckMobileNumRule ¶ added in v0.0.2
CheckMobileNumRule 验证手机号码
func CheckStringLength ¶ added in v0.0.14
CheckStringLength 判断字符串长度是否在规定范围内
func CheckWeChatOpenId ¶ added in v0.12.4
CheckWeChatOpenId 验证微信公众号和小程序的OpenID
func CheckWeChatUnionId ¶ added in v1.2.3
CheckWeChatUnionId 验证微信公众号和小程序的UnionID
func ChineseToUnicode ¶ added in v0.12.5
ChineseToUnicode 中文转Unicode
func CreateFraction ¶ added in v1.1.2
CreateFraction 创建分数[n为保留的小数点位数]
func CreateOrderNo ¶ added in v0.1.0
func CreateOrderNo() (sn string)
CreateOrderNo 生成平台32位订单号 [不推荐使用]
func DayStartAndEndTime ¶ added in v0.7.3
DayStartAndEndTime 该天00:00:00时间和该天23:59:59时间
func DownIntegerToInt64 ¶ added in v0.4.4
DownIntegerToInt64 向下取整返回int64
func EarthDistance ¶ added in v0.3.2
EarthDistance 两点之间的距离,不分前后[默认单位:米]
func FebruaryIsLeapYear ¶ added in v1.1.13
FebruaryIsLeapYear 二月是否是闰年
func FenToYuanToString ¶ added in v1.3.5
FenToYuanToString 人民币分转元字符串类型
func FileGetContents ¶ added in v0.5.3
FileGetContents 把整个文件读入一个字符串中
func FilePutContentToAppend ¶ added in v0.5.6
FilePutContentToAppend 把一个字符串写入文件中[追加至原文件]
func FilePutContents ¶ added in v0.5.3
FilePutContents 把一个字符串写入文件中[覆盖原文件内容]
func Float32ToString ¶ added in v0.0.2
Float32ToString float32转string
func Float64MulFloat64 ¶ added in v1.1.5
Float64MulFloat64 float64 * float64
func Float64MulInt64 ¶ added in v1.1.5
Float64MulInt64 float64 * int64
func Float64ToInt64 ¶ added in v0.2.9
Float64ToInt64 float64转int64
func Float64ToString ¶ added in v0.0.2
Float64ToString float64转string
func FloatRound ¶ added in v0.2.2
FloatRound 四舍五入 [n为保留的小数点位数] [不优先使用]
func GenerateOrderNo ¶ added in v0.4.0
func GenerateOrderNo() string
GenerateOrderNo 生成24位订单号 [前面17位代表时间精确到毫秒,中间3位代表进程id,最后4位代表序号]
func GetBetweenDays ¶ added in v0.7.0
GetBetweenDays 根据开始日期和结束日期计算出时间段内所有日期[两个日期内所有天数]
func GetBetweenMonths ¶ added in v0.4.5
GetBetweenMonths 根据开始日期和结束日期计算出时间段内所有月份
func GetFirstAndEndString ¶ added in v0.11.8
GetFirstAndEndString 获取第一个和最后一个字符串[不区分中英文]
func GetStringPointer ¶ added in v0.13.2
GetStringPointer 返回字符串类型的指针
func GetStringPointerValue ¶ added in v0.13.2
GetStringPointerValue 返回字符串指针类型的值
func HashFileToMd5 ¶ added in v0.10.0
HashFileToMd5 文件哈希[MD5]
func IdCardBirthHandle ¶ added in v0.6.2
IdCardBirthHandle 身份证出生日期处理,统一格式:[2020年1月1日]
func IdCardDeadlineHandle ¶ added in v0.6.5
IdCardDeadlineHandle 身份证有效期处理,统一格式:[2018.08.01-2028.08.01]
func Int64LengthPadding ¶ added in v0.11.4
Int64LengthPadding 数字长度不够左侧填补0并返回字符串
func Int64ToFloat64 ¶ added in v0.2.9
Int64ToFloat64 int64转float64
func Int64ToString ¶ added in v0.0.2
Int64ToString int64转string
func InterceptDecimal ¶ added in v0.2.2
InterceptDecimal 不四舍五入截取小数点 [n为保留的小数点数位数]
func InterceptDecimalToString ¶ added in v0.2.5
InterceptDecimalToString 不四舍五入截取小数点后为字符串格式 [n为保留的小数点数位数]
func IsCCBCardNo ¶ added in v0.9.12
IsCCBCardNo 是否为建设银行卡号 [2020.09.30新增62153403][2019.11.28新增621673][普通高中学生资助卡:623094]
func JsonEncode ¶ added in v0.9.1
JsonEncode json_encode
func MonthStartAndEndTime ¶ added in v0.7.3
MonthStartAndEndTime 该月1号00:00:00时间和该月末23:59:59时间
func MoreFloat64Mul ¶ added in v1.1.6
MoreFloat64Mul 多个Float64相乘
func NowMonthStartAndEndTime ¶ added in v0.7.0
NowMonthStartAndEndTime 本月1号00:00:00时间和本月末23:59:59时间
func NowQuarterStartAndEndTime ¶ added in v0.7.0
NowQuarterStartAndEndTime 本季度1号00:00:00时间和本季度末23:59:59时间
func NowWeekStartAndEndTime ¶ added in v0.7.0
NowWeekStartAndEndTime 本周一00:00:00时间和本周日23:59:59时间
func NowYearStartAndEndTime ¶ added in v0.7.0
NowYearStartAndEndTime 本年1月1号00:00:00时间和本年12月31号23:59:59时间
func OneYearCycleMonthRange ¶ added in v1.3.8
OneYearCycleMonthRange 一年周期月范围
func OrderNoStrDecode ¶ added in v1.2.4
func OrderNoStrEncode ¶ added in v1.2.4
func QuarterStartAndEndTime ¶ added in v0.7.3
QuarterStartAndEndTime 该季度1号00:00:00时间和该季度末23:59:59时间
func RandFixedString ¶ added in v0.11.5
RandFixedString 根据[0-9]数字生成一位随机固定字符串[没有大小写oO]
func RandShortStringByDate ¶ added in v0.11.5
func RandShortStringByDate() (str string)
RandShortStringByDate 根据当前日期生成6位短字符串[以秒为单位不重复]
func RandStringToOrderNoPrefix ¶ added in v1.2.5
func RandStringToOrderNoPrefix() string
func RemoveInvalid0ToString ¶ added in v0.2.9
RemoveInvalid0ToString 去掉无效的0并转为字符串格式
func RoundFloat ¶ added in v0.2.2
RoundFloat 四舍五入 [n为保留的小数点位数] [优先使用]
func RoundToString ¶ added in v0.2.5
RoundToString 四舍五入后为字符串格式 [n为保留的小数点位数]
func RsaDecrypt ¶ added in v0.7.2
RsaDecrypt 使用私钥解密公钥加密的数据
func RsaDecryptByte ¶ added in v0.7.2
RsaDecryptByte 使用私钥解密公钥加密的数据
func RsaEncrypt ¶ added in v0.7.2
RsaEncrypt 使用公钥加密数据[只有私钥才能解开]
func RsaEncryptByte ¶ added in v0.7.2
RsaEncryptByte 使用公钥加密数据[只有私钥才能解开]
func SpellReadNum ¶ added in v0.0.18
func SpellReadNum(str string, formats ...SpellDigitalFormat) (slice []string, err error)
SpellReadNum 拼读数
func StringLength ¶ added in v0.11.6
StringLength 获取字符串长度[包含中文字符串,一个中文字符串的长度为1]
func StringLengthCutAndSplitJoint ¶ added in v0.11.7
StringLengthCutAndSplitJoint 字符串长度截取并拼接处理
func StringLengthPadding ¶ added in v0.11.4
StringLengthPadding 字符串长度不够左侧填补0
func StringToFloat64 ¶ added in v0.2.7
StringToFloat64 string转float64
func StringToInt64 ¶ added in v0.2.9
StringToInt64 string转int64
func StringToTime ¶ added in v0.7.0
StringToTime 将字符串转为时间[2021-08-08 08:08:08]
func StringYuanToInt64Fen ¶ added in v1.3.4
StringYuanToInt64Fen 字符串元转int64分
func StructToMap ¶ added in v0.9.0
StructToMap struct转map
func TimestampToTime ¶ added in v0.0.4
TimestampToTime 时间戳转时间
func ToBigCamelCase ¶ added in v0.2.4
ToBigCamelCase 字符串转大驼峰格式
func ToSmallCamelCase ¶ added in v0.2.4
ToSmallCamelCase 字符串转小驼峰格式
func TodayStartAndEndTime ¶ added in v0.7.0
TodayStartAndEndTime 今天00:00:00时间和今天23:59:59时间
func UnicodeToChinese ¶ added in v0.12.5
UnicodeToChinese Unicode转中文
func UpIntegerToInt64 ¶ added in v0.4.4
UpIntegerToInt64 向上取整返回int64
func VerifyECDSASign ¶ added in v0.7.2
func VerifyECDSASign(signData *ECDSASignData, publicKey *ecdsa.PublicKey) bool
VerifyECDSASign 校验数字签名
func WeekStartAndEndTime ¶ added in v0.7.3
WeekStartAndEndTime 该周一00:00:00时间和该周日23:59:59时间
func YearStartAndEndTime ¶ added in v0.7.3
YearStartAndEndTime 该年1月1号00:00:00时间和该年12月31号23:59:59时间
func YuanToInt64Fen ¶ added in v1.3.4
YuanToInt64Fen 元转分
Types ¶
type ECDSASignData ¶ added in v0.7.2
type ECDSASignData struct {
// contains filtered or unexported fields
}
ECDSASignData 用于保存签名的数据
func ECDSASign ¶ added in v0.7.2
func ECDSASign(message string, privateKey *ecdsa.PrivateKey) (signData *ECDSASignData, err error)
ECDSASign 使用私钥签名一段数据
type SpellDigitalFormat ¶ added in v0.4.3
SpellDigitalFormat 拼读格式
var RmbSpellDigitalFormat SpellDigitalFormat = map[string]string{
"0": "零",
"1": "壹",
"2": "贰",
"3": "叁",
"4": "肆",
"5": "伍",
"6": "陆",
"7": "柒",
"8": "捌",
"9": "玖",
"s": "拾",
"b": "佰",
"q": "仟",
"w": "万",
"y": "亿",
".": "点",
}
RmbSpellDigitalFormat 人民币大写拼读格式