Documentation ¶
Index ¶
- Constants
- func ArrayIntersection[T any](arrs1, arrs2 []T) []T
- func ArrayKeys(items map[interface{}]interface{}) interface{}
- func ArrayToString(array []interface{}) string
- func Base64Decode(encodeStr string) string
- func Base64Encode(data string) string
- func CamelString(s string) string
- func Contains[t any](targets []t, target t) bool
- func CopyFile(srcName, dstName string) (written int64, err error)
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func GenSn(prefix string) string
- func GenTree(items []map[string]interface{}, addEmptyChild bool, option ...string) []map[string]interface{}
- func GetFuncName(i interface{}) string
- func GetIP() (net.IP, error)
- func HmacSha256(message string, secret string) string
- func InArray(item interface{}, items interface{}) bool
- func IsDir(path string) bool
- func IsEmpty(data interface{}) bool
- func IsFile(path string) bool
- func IsNumeric(item interface{}) bool
- func JsonDecode(jsonStr string) interface{}
- func JsonDecodeTo(jsonStr string, dst interface{}) error
- func JsonEncode(data interface{}) string
- func KRand(size int, kind int) string
- func MD5V(str string) string
- func MaheHump(s string) string
- func Md5(data string, binary ...bool) string
- func NewObjectPtr(i interface{}) interface{}
- func ObjectName(i interface{}) string
- func PasswordEncrypt(salt, password string) string
- func Pointer[T any](in T) (out *T)
- func RandomInt(min, max int) int
- func RandomString(n int) string
- func RemoveElements[t any](arr []t, targets []t) []t
- func RsaDecrypt(data, privateKey string) (string, error)
- func RsaEncrypt(data, publicKey string) (string, error)
- func RsaGenKey(bits int) (privateKey, publicKey []byte, err error)
- func RsaSign(data, privateKey string, hash crypto.Hash) (string, error)
- func RsaVerifySign(data, sig, publicKey string, hash crypto.Hash) error
- func Sha1(data string) string
- func SnakeString(s string) string
- func StructToMap(obj interface{}) map[string]interface{}
- func ToInt(arg interface{}) int64
- func ToString(args ...interface{}) string
- func ValidatorCheck(r *http.Request, req interface{}) error
- func VarDump(args ...interface{})
- func VerifyChineseName(name string) bool
- func VerifyIDCard(idCard string) bool
- func VerifyTelNum(name string) bool
- type ListReq
- type MAP
Constants ¶
View Source
const ( KC_RAND_KIND_NUM = 0 // 纯数字 KC_RAND_KIND_LOWER = 1 // 小写字母 KC_RAND_KIND_UPPER = 2 // 大写字母 KC_RAND_KIND_ALL = 3 // 数字、大小写字母 )
Variables ¶
This section is empty.
Functions ¶
func ArrayKeys ¶
func ArrayKeys(items map[interface{}]interface{}) interface{}
ArrayKeys 获取map里面所有键名
func ArrayToString ¶
func ArrayToString(array []interface{}) string
func FirstLower ¶
func FirstUpper ¶
func GenTree ¶
func GenTree(items []map[string]interface{}, addEmptyChild bool, option ...string) []map[string]interface{}
GenTree 将数组map生成tree items 将要排序的数组 addEmptyChild child为空时是否返回空数组,默认true option[0] id别名,默认id option[1] pid别名,默认pid option[2] child别名,默认返回child example:
items := []map[string]interface{}{ {"id": "1", "name": "1"}, {"id": "2", "pid": "1", "name": "2"}, {"id": "3", "pid": "1", "name": "3"}, {"id": "4", "pid": "2", "name": "3"}, }
JsonEncode(GenTree(items, true))
func InArray ¶
func InArray(item interface{}, items interface{}) bool
InArray 判断元素是否在数组中 支持string,int,int8,int16,int32,int64,float32,float64,bool类型
func JsonDecode ¶
func JsonDecode(jsonStr string) interface{}
JsonDecode json解码操作 成功返回interface, 失败返回nil
func JsonDecodeTo ¶
JsonDecodeTo json解码操作 失败返回错误,成功返回nil
func PasswordEncrypt ¶
func RemoveElements ¶
func RemoveElements[t any](arr []t, targets []t) []t
func RsaVerifySign ¶
RsaVerifySign 公钥验签
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
func ValidatorCheck ¶
func VerifyChineseName ¶
func VerifyIDCard ¶
func VerifyTelNum ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.