Documentation ¶
Index ¶
- Variables
- func AESCBCDecrypt(cipherData, key, iv []byte) ([]byte, error)
- func AESCBCEncrypt(rawData, key, iv []byte) ([]byte, error)
- func AESECBDecrypt(buf, key []byte) ([]byte, error)
- func AESECBEncrypt(data, key []byte) ([]byte, error)
- func AddFloat64(a float64, b float64) float64
- func AsyncFunc(fn func())
- func AsyncFuncGroup(fns ...func())
- func AsyncFuncGroupOneSuccess(fns ...func())
- func AsyncFuncGroupPanic(errFn func(err any), fns ...func())
- func AsyncFuncPanic(fn func(), errFn func(err any))
- func Base59Decoding(strByte []byte, key ...string) []byte
- func Base59Encoding(strByte []byte, key ...string) string
- func Base64Decode(str string) []byte
- func Base64Encode(buf []byte) string
- func BigIntAdd(num1 string, num2 string) string
- func BigIntCmp(num1 string, num2 string) int
- func BigIntDiv(num1 string, num2 string) string
- func BigIntMod(num1 string, num2 string) string
- func BigIntMul(num1 string, num2 string) string
- func BigIntReduce(num1 string, num2 string) string
- func Camel2Case(str string) string
- func CaptchaAudioGet(audioStr string) map[string]string
- func CaptchaChineseGet(width, height int, source string) map[string]string
- func CaptchaGet(width, height int) map[string]string
- func CaptchaMathGet(width, height int) map[string]string
- func CaptchaStringGet(width, height int) map[string]string
- func CaptchaVerify(id, code string) bool
- func Case2Camel(str string) string
- func CheckSign(secret string, linkSignTimeout int64, ts int64, sign string) bool
- func Code2Id(code string) (int64, error)
- func CurrentHourStartAndEnd() (int, int64, int64)
- func Date2Ts(date string) int64
- func DateTime(format string) string
- func DateTime2Ts(dateTime string) int64
- func DivFloat64(a float64, b float64) float64
- func GBK2UTF8(s string) string
- func GenId() int64
- func GenIdInit(adapter iGenId)
- func GenIdStr() string
- func GenValidateCode(width int) string
- func GetChinaTomorrowAMSeconds(isBeijing bool) int64
- func GetDateInterval(t1, t2 time.Time) int
- func GetFieldValue(config interface{}, fieldName string) (interface{}, error)
- func GetLocalTomorrowAMSeconds() int64
- func GetNowDateForLocation(isBeijing bool) string
- func GetTimeNow() time.Time
- func GetTodayZero() time.Time
- func GetZero(targetTime time.Time) time.Time
- func HMacMd5(buf, key []byte) string
- func HMacSha1(buf, key []byte) string
- func HMacSha256(buf, key []byte) string
- func HideEmail(email string) string
- func Id2Code(id int64) string
- func IfFloat32(isTrue bool, a, b float32) float32
- func IfFloat64(isTrue bool, a, b float64) float64
- func IfInt(isTrue bool, a, b int) int
- func IfNot[T any](isTrue bool, a, b T) T
- func IfString(isTrue bool, a, b string) string
- func InitCaptcha(captcha *gocaptcha.GoCaptcha)
- func IsEmail(email string) bool
- func IsInArray[T any](arr []T, target T) bool
- func IsSameDay(t1, t2 time.Time) bool
- func LastHourStartAndEnd(isBeijing bool) (int, int64, int64)
- func MD5(buf []byte) string
- func MaxInt(a, b int) int
- func MaxInt64(a, b int64) int64
- func Md5(buf []byte) string
- func MinInt(a, b int) int
- func MinInt64(a, b int64) int64
- func MulFloat64(a float64, b float64) float64
- func NewIdCode(key string) *idCode
- func NextDate(d int) string
- func NonceStr() string
- func NonceStr8() string
- func Now() string
- func PadStart(str, pad string, length int) string
- func ParseTime(timeStr string) (datetime time.Time)
- func ParseTimeString(timeStr string) (datetime time.Time)
- func PinYin(origin string) (string, error)
- func Recovery(errFn func(err any))
- func ReverseArray(arr []*interface{})
- func SHA1(buf []byte) string
- func SHA256(buf, key []byte) string
- func SHAWithRSA(key, data []byte) (string, error)
- func SessionId() string
- func SinceDays(dateString string) (int64, error)
- func Split(s string, rs ...rune) []string
- func SplitArray(arr []interface{}, size int) (list [][]interface{})
- func SplitInt64Array(arr []int64, size int) (list [][]int64)
- func SplitIntArray(arr []int, size int) (list [][]int)
- func SplitStringArray(arr []string, size int) (list [][]string)
- func SubFloat64(a float64, b float64) float64
- func TimeRangeDates(startDate string, endDate string) []string
- func TimeRangeDay(stTime int64, endTIme int64) int
- func ToDate(ts int64, isBeijing bool) string
- func ToDateTime(ts int64, isBeijing bool) string
- func Today() string
- func Ts2Date(ts int64) string
- func Ts2DateTime(ts int64) string
- func UTF82GBK(s string) string
- func ValidPassword(str string) (msg string, matched bool)
- func ValidPasswordV2(str string) (msg string, matched bool)
- type Byte
- type Mode
- type Params
- func (p *Params) Array() (ps []Params)
- func (p *Params) ArrayData() []interface{}
- func (p *Params) Bool() bool
- func (p *Params) Data() interface{}
- func (p *Params) Float32() float32
- func (p *Params) Float64() float64
- func (p *Params) Get(key string) *Params
- func (p *Params) Int() int
- func (p *Params) Int32() int32
- func (p *Params) Int64() int64
- func (p *Params) JSON() []byte
- func (p *Params) Map() (rst map[string]Params)
- func (p *Params) MapData() map[string]interface{}
- func (p *Params) Set(key string, val interface{}) *Params
- func (p *Params) String() string
- type SafeSlice
- type SnowFlakeId
- type StringMap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TimeLayout string = "2006-01-02 15:04:05" DateLayout = "20060102" TimeFormat = map[string]string{ "Y-m-d H:i:s": "2006-01-02 15:04:05", "Y-m-d": "2006-01-02", "Ymd": "20060102", "H:i:s": "15:04:05", "Y": "2006", "m": "01", "d": "02", } )
View Source
var (
ErrInitialize = errors.New("not yet initialized")
)
Functions ¶
func AESCBCDecrypt ¶
func AESCBCEncrypt ¶
func AESECBDecrypt ¶
func AESECBEncrypt ¶
func AddFloat64 ¶ added in v1.1.2
func AsyncFuncGroupOneSuccess ¶ added in v1.2.5
func AsyncFuncGroupOneSuccess(fns ...func())
异步并发执行(安全) 只要其中一个执行完成(不能嵌套使用),释放所有等待锁。目的是比执行速度
func AsyncFuncGroupPanic ¶ added in v1.1.7
func AsyncFuncGroupPanic(errFn func(err any), fns ...func())
异步并发执行(安全)errFn = nil 时自动Recovery 不会Panic
func AsyncFuncPanic ¶ added in v1.1.7
func AsyncFuncPanic(fn func(), errFn func(err any))
异步执行(安全)errFn = nil 时自动Recovery 不会Panic
func Base59Decoding ¶
func Base59Encoding ¶
如果遇到特殊字符,需要用 url.PathEscape(str) 解决
func Base64Decode ¶
func Base64Encode ¶
func CaptchaAudioGet ¶ added in v1.2.27
func CaptchaChineseGet ¶ added in v1.2.27
func CaptchaMathGet ¶ added in v1.2.27
func CaptchaStringGet ¶ added in v1.2.27
func CurrentHourStartAndEnd ¶ added in v1.0.14
func DateTime2Ts ¶
func DivFloat64 ¶ added in v1.1.2
func GenValidateCode ¶ added in v1.0.14
func GetChinaTomorrowAMSeconds ¶ added in v1.0.14
func GetDateInterval ¶ added in v1.0.14
func GetFieldValue ¶ added in v1.2.25
通过反射获取结构体字段的值
func GetLocalTomorrowAMSeconds ¶ added in v1.0.14
func GetLocalTomorrowAMSeconds() int64
func GetNowDateForLocation ¶ added in v1.0.14
func GetTimeNow ¶ added in v1.0.14
GetTimeNow 获取当前时间GetTimeNow(),用于测试时的时间修改
func GetTodayZero ¶ added in v1.0.14
func HMacSha256 ¶
func InitCaptcha ¶ added in v1.2.27
func LastHourStartAndEnd ¶ added in v1.0.14
LastHourStartAndEnd 上一个小时的开始和结束时间戳
func MulFloat64 ¶ added in v1.1.2
func ParseTimeString ¶ added in v1.0.14
func ReverseArray ¶ added in v1.0.14
func ReverseArray(arr []*interface{})
func SHAWithRSA ¶
func SplitArray ¶
func SplitArray(arr []interface{}, size int) (list [][]interface{})
func SplitInt64Array ¶
func SplitIntArray ¶
func SplitStringArray ¶
func SubFloat64 ¶ added in v1.1.2
func TimeRangeDates ¶ added in v1.0.14
func ToDateTime ¶ added in v1.0.14
func Ts2DateTime ¶
func ValidPassword ¶
func ValidPasswordV2 ¶
Types ¶
type SafeSlice ¶ added in v1.2.5
type SafeSlice[T comparable] struct { // contains filtered or unexported fields }
读写锁 + 顺序获取(循环)
如: s := []string{"s1", "s2", "s3"}, 无论并发怎么读取,顺序为:s1,s2,s3,s1,s2,s3,s1,s2,s...
func NewSafeSlice ¶ added in v1.2.5
func NewSafeSlice[T comparable]() *SafeSlice[T]
type SnowFlakeId ¶
type SnowFlakeId struct {
// contains filtered or unexported fields
}
雪花算法
func (*SnowFlakeId) GenId ¶
func (sf *SnowFlakeId) GenId() int64
Source Files ¶
Click to show internal directories.
Click to hide internal directories.