Documentation ¶
Index ¶
- Constants
- Variables
- func AESDecrypt(src, key string) string
- func AESEncrypt(src, key string) string
- func AesDecrypt(crypted, key []byte) ([]byte, error)
- func AesEncrypt(origData, key []byte) ([]byte, error)
- func AppendFloatToCsv(filename string, row []float64)
- func AppendFloatsToCsv(filename string, rows [][]float64)
- func AppendToCsv(filename string, row []string)
- func AppendsToCsv(filename string, rows [][]string)
- func ArrayContains(arr []string, s string) bool
- func Clone(src interface{}) interface{}
- func CompareInter(a, b interface{})
- func CompareInterface(key string, a, b interface{}) (bool, interface{}, interface{})
- func DESDecrypt(src, key string) string
- func DESEncrypt(src, key string) string
- func DecryptDES(src []byte, key []byte) []byte
- func DeepClone(src interface{}) (error, interface{})
- func EncryptDES(src []byte, key []byte) []byte
- func ExternalIP() (net.IP, error)
- func Float32ToString(input_num float32) string
- func Float64ToStr(input_num float64, prec int) string
- func Float64ToString(input_num float64) string
- func Float64sToStrings(input_nums []float64) []string
- func GenerateRSAKey(bits int)
- func Get(url string) (response string)
- func GetTag(u interface{}, key string) string
- func GetYYYYMMDD() string
- func GetYYYYMMDDHHMMSS() string
- func If(condition bool, trueValue, falseValue interface{}) interface{}
- func Int64ToStr(num int64) string
- func JsonBytesToStruct(jsonByte []byte, result interface{})
- func JsonToMap(jsonStr string, mapResult map[string]interface{})
- func JsonToStruct(jsonStr string, result interface{})
- func MapToJson(instance interface{}) string
- func MapToStruct(m interface{}, s interface{}) error
- func MapToStruct2(m interface{}, s interface{}) error
- func Md5(s string) string
- func NewFixedDelayJob(d time.Duration, f func())
- func NewInterface(typ reflect.Type, data []byte) (error, interface{})
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func Post(url string, data interface{}, contentType string) (content string)
- func RSADecrypt(text string, rsaPrivateKey string) string
- func RSAEncrypt(text string, rsaPublicKey string) string
- func Random(start float64, end float64) float64
- func RandomPassword(passwordLength int, charset string) string
- func ReadFileLast(filename string, readChannel chan string)
- func ReadFromCsv(filename string) [][]string
- func SaveToCsv(filename string, rows [][]string)
- func SaveToFile(filename string, context string)
- func Sha256(s string) string
- func SortArrMap(maps []map[string]interface{}, by func(a, b map[string]interface{}) bool)
- func SortBodyByCreateTime(arr []interface{})
- func SortInterface(arr []interface{}, by func(p, q *interface{}) bool)
- func StrArr2ToFloat(arr *[][]interface{})
- func StrArr2ToFloatArr2(arr [][]string) [][]float64
- func StrToBool(inputValue string) bool
- func StrToBoolDef(inputValue string, defValue bool) bool
- func StrToFloat64(input_num string) float64
- func StrToFloat64Def(input_num string, defValue float64) float64
- func StrToInt(input_num string) int
- func StrToInt64(input_num string) int64
- func StrToInt64Def(inputValue string, defValue int64) int64
- func StrToIntDef(input_num string, defValue int) int
- func StrToUint64(input_num string) uint64
- func StrToUint64Def(inputValue string, defValue uint64) uint64
- func StructToJson(result interface{}) string
- func StructToMap(s interface{}, m interface{}) error
- func SubstrAfter(s, substr string) string
- func SubstrBefore(s, substr string) string
- func SubstrBetween(s, afterStr, beforeStr string) string
- func Substring(source string, start int, end int) string
- func TimeToStr(t time.Time) string
- func Uint64ToStr(num uint64) string
- func UtcToTime(utcDate string) time.Time
Constants ¶
View Source
const ( NUmStr = "0123456789" CharStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" SpecStr = "+=-@#~,.[]()!%^*$" )
Variables ¶
View Source
var ArrType = reflect.TypeOf([]interface{}{})
View Source
var MapType = reflect.TypeOf(map[string]interface{}{})
Functions ¶
func AESDecrypt ¶
* key :either 16, 24, or 32 bytes to select
func AESEncrypt ¶
* key :either 16, 24, or 32 bytes to select
func AesDecrypt ¶
* key :either 16, 24, or 32 bytes to select
func AesEncrypt ¶
* key :either 16, 24, or 32 bytes to select
func AppendFloatToCsv ¶
func AppendFloatsToCsv ¶
func AppendToCsv ¶
func AppendsToCsv ¶
func ArrayContains ¶
func Clone ¶ added in v0.1.6
func Clone(src interface{}) interface{}
浅克隆,可以克隆任意数据类型,对指针类型子元素无法克隆 获取类型:如果类型是指针类型,需要使用Elem()获取对象实际类型 获取实际值:如果值是指针类型,需要使用Elem()获取实际数据 说白了,Elem()就是获取反射数据的实际类型和实际值
func CompareInter ¶
func CompareInter(a, b interface{})
func CompareInterface ¶
func DecryptDES ¶
func DeepClone ¶ added in v0.1.6
func DeepClone(src interface{}) (error, interface{})
深度克隆,可以克隆任意数据类型
func EncryptDES ¶
func ExternalIP ¶
func Float64ToStr ¶
func Float64ToString ¶
func Float64sToStrings ¶
func GetYYYYMMDD ¶
func GetYYYYMMDD() string
func GetYYYYMMDDHHMMSS ¶
func GetYYYYMMDDHHMMSS() string
func MapToStruct2 ¶
func MapToStruct2(m interface{}, s interface{}) error
func NewFixedDelayJob ¶
func NewInterface ¶ added in v0.1.6
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func RSADecrypt ¶
RSADecrypt RSA解密 cipherText 需要解密的byte数据 rsaPrivateKey 私钥
func RSAEncrypt ¶
RSAEncrypt RSA加密 plainText 要加密的数据 path 公钥
func RandomPassword ¶
RandomPassword 随机生成密码 参数说明:
length: 生成密码的长度 charset: num:只使用数字[0-9], char:只使用英文字母[a-zA-Z], mix:使用数字和字母, advance:使用数字、字母以及特殊字符
如:RandomPassword(16, "mix")
-> bJZSD6YpSAvDM6DY
func ReadFileLast ¶
func ReadFromCsv ¶
func SaveToFile ¶
func SortArrMap ¶ added in v0.1.6
func SortBodyByCreateTime ¶ added in v0.1.6
func SortBodyByCreateTime(arr []interface{})
按照createtime排序,需要注意是否有createtime
func SortInterface ¶ added in v0.1.6
func SortInterface(arr []interface{}, by func(p, q *interface{}) bool)
自定义排序字段,参考SortBodyByCreateTime中的传入函数
func StrArr2ToFloat ¶
func StrArr2ToFloat(arr *[][]interface{})
func StrArr2ToFloatArr2 ¶
func StrToBoolDef ¶
func StrToFloat64 ¶
func StrToFloat64Def ¶
func StrToInt64Def ¶
func StrToIntDef ¶
func StrToUint64Def ¶
func StructToJson ¶
func StructToJson(result interface{}) string
func SubstrAfter ¶
func SubstrBefore ¶
func SubstrBetween ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.