Documentation ¶
Index ¶
- Constants
- Variables
- func Add(a, b interface{}) (string, error)
- func AddStr(input ...interface{}) string
- func AesDecrypt(msg, key, iv string) ([]byte, error)
- func AesEncrypt(plantText []byte, key, iv string) (string, error)
- func AnyToStr(any interface{}) string
- func Base64Decode(input interface{}) []byte
- func Base64Encode(input interface{}) string
- func Bytes2Str(b []byte) string
- func CheckInt(c int, vs ...int) bool
- func CheckInt64(c int64, vs ...int64) bool
- func CheckLen(o interface{}, min, max int) bool
- func CheckRangeInt(c, min, max int) bool
- func CheckRangeInt64(c, min, max int64) bool
- func CheckStr(c string, vs ...string) bool
- func CheckStrLen(str string, min, max int) bool
- func ClientIP(req *http.Request) string
- func Cmp(a, b interface{}) int
- func CreateLocalSecretKey(arr ...int) string
- func DeepCopy(dst, src interface{}) error
- func Div(a, b interface{}, n int32) (string, error)
- func Error(input ...interface{}) error
- func Float64ToInt64(f float64) int64
- func FmtDiv(v string, d int64) string
- func FmtEL(msg string, values ...interface{}) (string, error)
- func FmtZero(r string) string
- func GetAesIV(iv string) []byte
- func GetAesKey(key string) []byte
- func GetAnyDayFirstAndLast(x int64) (int64, int64)
- func GetAnyMonthFirstAndLast(month int) (int64, int64)
- func GetBool(ptr uintptr) bool
- func GetBoolArr(ptr uintptr) []bool
- func GetDayFirstAndLast() (int64, int64)
- func GetFloat32(ptr uintptr) float32
- func GetFloat32Arr(ptr uintptr) []float32
- func GetFloat64(ptr uintptr) float64
- func GetFloat64Arr(ptr uintptr) []float64
- func GetFmtDate(t int64) int64
- func GetInDayFirstAndLast(x int64) (int64, int64)
- func GetInt(ptr uintptr) int
- func GetInt16(ptr uintptr) int16
- func GetInt16Arr(ptr uintptr) []int16
- func GetInt32(ptr uintptr) int32
- func GetInt32Arr(ptr uintptr) []int32
- func GetInt64(ptr uintptr) int64
- func GetInt64Arr(ptr uintptr) []int64
- func GetInt8(ptr uintptr) int8
- func GetInt8Arr(ptr uintptr) []int8
- func GetIntArr(ptr uintptr) []int
- func GetJsonBool(b []byte, k string) bool
- func GetJsonBytes(b []byte, k string) []byte
- func GetJsonFloat64(b []byte, k string) float64
- func GetJsonInt(b []byte, k string) int
- func GetJsonInt64(b []byte, k string) int64
- func GetJsonString(b []byte, k string) string
- func GetLocalIP() string
- func GetLocalSecretKey() string
- func GetLocalTokenSecretKey() string
- func GetMonthFirstAndLast() (int64, int64)
- func GetObjectID(ptr uintptr) primitive.ObjectID
- func GetPath() string
- func GetPtr(v interface{}, offset uintptr) uintptr
- func GetSnowflakeNode(n int64) *snowflake.Node
- func GetString(ptr uintptr) string
- func GetStringArr(ptr uintptr) []string
- func GetUUID(replace ...bool) string
- func GetUint(ptr uintptr) uint
- func GetUint16(ptr uintptr) uint16
- func GetUint16Arr(ptr uintptr) []uint16
- func GetUint32(ptr uintptr) uint32
- func GetUint32Arr(ptr uintptr) []uint32
- func GetUint64(ptr uintptr) uint64
- func GetUint64Arr(ptr uintptr) []uint64
- func GetUint8(ptr uintptr) uint8
- func GetUint8Arr(ptr uintptr) []uint8
- func GetUintArr(ptr uintptr) []uint
- func GetWeekFirstAndLast() (int64, int64)
- func HMAC_MD5(data, key string, useBase64 ...bool) string
- func HMAC_SHA1(data, key string, useBase64 ...bool) string
- func HMAC_SHA256(data, key string, useBase64 ...bool) string
- func HMAC_SHA512(data, key string, useBase64 ...bool) string
- func HasStr(s1 string, s2 string) bool
- func InArray(p interface{}) []interface{}
- func Int2Time(t int64) time.Time
- func IsAccount(s string) bool
- func IsEmail(s string) bool
- func IsFloat(s string) bool
- func IsIDNO(s string) bool
- func IsIPV4(s string) bool
- func IsInt(s string) bool
- func IsMobil(s string) bool
- func IsMoney(s string) bool
- func IsMoney2(s string) bool
- func IsMoney3(s string) bool
- func IsNumber(s string) bool
- func IsNumber2(s string) bool
- func IsPKNO(s interface{}) bool
- func IsPassword(s string) bool
- func IsURL(s string) bool
- func JsonMarshal(v interface{}) ([]byte, error)
- func JsonToAny(src interface{}, target interface{}) error
- func JsonUnmarshal(data []byte, v interface{}) error
- func JsonValid(b []byte) bool
- func JsonValidString(s string) bool
- func Len(o interface{}) int
- func LinuxOS() bool
- func LowerFirst(str string) string
- func MD5(s string, useBase64 ...bool) string
- func MacOS() bool
- func MatchFilterURL(requestPath string, matchPattern []string) bool
- func MathAbs(n int64) int64
- func ModRand(n int) int
- func Mul(a, b interface{}) (string, error)
- func NewFloat32(b []byte) (float32, error)
- func NewFloat64(b []byte) (float64, error)
- func NewInt(b []byte) (int, error)
- func NewInt16(b []byte) (int16, error)
- func NewInt32(b []byte) (int32, error)
- func NewInt64(b []byte) (int64, error)
- func NewInt8(b []byte) (int8, error)
- func NewString(b []byte) (string, error)
- func NewUint(b []byte) (uint, error)
- func NewUint16(b []byte) (uint16, error)
- func NewUint32(b []byte) (uint32, error)
- func NewUint64(b []byte) (uint64, error)
- func NewUint8(b []byte) (uint8, error)
- func NextIID() int64
- func NextSID() string
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(plantText []byte, blockSize int) []byte
- func ParseJsonBase64(input interface{}, ouput interface{}) error
- func PasswordHash(password, salt string) string
- func PasswordVerify(password, salt, target string) bool
- func RandInt(n int) string
- func RandNonce() string
- func RandStr(n int, b ...bool) string
- func ReadFile(path string) ([]byte, error)
- func ReadJsonConfig(conf []byte, result interface{}) error
- func ReadLocalJsonConfig(path string, result interface{}) error
- func Reverse(s string) string
- func ReverseBase64(s string) string
- func ReverseStr(s string, x ...int) string
- func SHA1(s string, useBase64 ...bool) string
- func SHA256(s string, useBase64 ...bool) string
- func SHA512(s string, useBase64 ...bool) string
- func SetBool(ptr uintptr, v bool)
- func SetBoolArr(ptr uintptr, v []bool)
- func SetFloat32(ptr uintptr, v float32)
- func SetFloat32Arr(ptr uintptr, v []float32)
- func SetFloat64(ptr uintptr, v float64)
- func SetFloat64Arr(ptr uintptr, v []float64)
- func SetInt(ptr uintptr, v int)
- func SetInt16(ptr uintptr, v int16)
- func SetInt16Arr(ptr uintptr, v []int16)
- func SetInt32(ptr uintptr, v int32)
- func SetInt32Arr(ptr uintptr, v []int32)
- func SetInt64(ptr uintptr, v int64)
- func SetInt64Arr(ptr uintptr, v []int64)
- func SetInt8(ptr uintptr, v int8)
- func SetInt8Arr(ptr uintptr, v []int8)
- func SetIntArr(ptr uintptr, v []int)
- func SetObjectID(ptr uintptr, v primitive.ObjectID)
- func SetString(ptr uintptr, v string)
- func SetStringArr(ptr uintptr, v []string)
- func SetUint(ptr uintptr, v uint)
- func SetUint16(ptr uintptr, v uint16)
- func SetUint16Arr(ptr uintptr, v []uint16)
- func SetUint32(ptr uintptr, v uint32)
- func SetUint32Arr(ptr uintptr, v []uint32)
- func SetUint64(ptr uintptr, v uint64)
- func SetUint64Arr(ptr uintptr, v []uint64)
- func SetUint8(ptr uintptr, v uint8)
- func SetUint8Arr(ptr uintptr, v []uint8)
- func SetUintArr(ptr uintptr, v []uint)
- func Shift(input interface{}, ln int, fz bool) string
- func ShiftN(a interface{}, n int32) (string, error)
- func StartWait(msg string)
- func Str2Bytes(s string) []byte
- func Str2Date(s string) (int64, error)
- func Str2Time(s string) (int64, error)
- func StrToBool(str string) (bool, error)
- func StrToFloat(str string) (float64, error)
- func StrToInt(str string) (int, error)
- func StrToInt16(str string) (int16, error)
- func StrToInt32(str string) (int32, error)
- func StrToInt64(str string) (int64, error)
- func StrToInt8(str string) (int8, error)
- func Sub(a, b interface{}) (string, error)
- func Substr(str string, start int, end int) string
- func Time2DateStr(t int64) string
- func Time2Str(t int64) string
- func ToJsonBase64(input interface{}) (string, error)
- func UnixMilli() int64
- func UnixNano() int64
- func UnixSecond() int64
- func UpperFirst(str string) string
- func ValidPattern(content, pattern string) bool
- func WindowsOS() bool
Constants ¶
View Source
const ( OneDay = 86400000 OneWeek = OneDay * 7 TwoWeek = OneDay * 14 OneMonth = OneDay * 30 )
View Source
const ( MOBILE = "^1[3456789]\\d{9}$" // 手机号码 INTEGER = "^[\\-]?[1-9]+[0-9]*$|^[0]$" // 包含+-的自然数 FLOAT = "^[\\-]?[1-9]+[\\.][0-9]+$|^[\\-]?[0][\\.][0-9]+$" // 包含+-的浮点数 IPV4 = "^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$" // IPV4地址 EMAIL = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$" // 邮箱地址 ACCOUNT = "^[a-zA-Z][a-zA-Z0-9_]{5,14}$" // 账号格式 PASSWORD = "^.{6,18}$" // 密码格式 URL = "http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?$" // URL格式 IDNO = "(^\\d{18}$)|(^\\d{15}$)" // 身份证格式 PKNO = "^1([3-9]{1})([0-9]{17})$" // 主键ID格式 NUMBER = "(^[1-9]([0-9]{0,29})$)|(^(0){1}$)" // 自然数 NUMBER2 = "^[0-9]+$" // 纯数字 MONEY = "(^[1-9]([0-9]{0,10})$)" // 自然数金额格式 MONEY2 = "(^[1-9]([0-9]{0,12})?(\\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\\.[0-9]([0-9])?$)" // 包含+-自然数金额格式 MONEY3 = "(^(-)?[1-9]([0-9]{0,12})?(\\.[0-9]{1,2})?$)|(^(0){1}$)|(^(-)?[0-9]\\.[0-9]([0-9])?$)" // 包含+-的浮点数金额格式 )
Variables ¶
View Source
var (
SPEL = regexp.MustCompile(`\$\{([^}]+)\}`)
)
Functions ¶
func AesDecrypt ¶
func CreateLocalSecretKey ¶
func GetJsonBool ¶ added in v1.0.2
func GetJsonBytes ¶ added in v1.0.102
func GetJsonFloat64 ¶ added in v1.0.102
func GetJsonInt ¶ added in v1.0.2
func GetJsonInt64 ¶ added in v1.0.104
func GetJsonString ¶ added in v1.0.2
func GetLocalSecretKey ¶
func GetLocalSecretKey() string
func GetLocalTokenSecretKey ¶
func GetLocalTokenSecretKey() string
func GetObjectID ¶ added in v1.0.29
get ObjectID value
func GetSnowflakeNode ¶ added in v1.0.5
func HMAC_SHA512 ¶ added in v1.0.93
func IsPassword ¶
func MatchFilterURL ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func ParseJsonBase64 ¶
func ParseJsonBase64(input interface{}, ouput interface{}) error
func PasswordHash ¶ added in v1.0.93
func PasswordVerify ¶ added in v1.0.93
func ReadLocalJsonConfig ¶
读取本地JSON配置文件
func ReverseBase64 ¶
func ReverseStr ¶
func SetObjectID ¶ added in v1.0.29
set ObjectID value
func ToJsonBase64 ¶
func ValidPattern ¶
Types ¶
This section is empty.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Multiprecision decimal numbers.
|
Multiprecision decimal numbers. |
Package snowflake provides a very simple Twitter snowflake generator and parser.
|
Package snowflake provides a very simple Twitter snowflake generator and parser. |
Click to show internal directories.
Click to hide internal directories.