Documentation
¶
Index ¶
- Variables
- func Abs(a int) (ret int)
- func AesCBCDecrypt(dst, key, iv []byte) []byte
- func AesCBCDncrypt(encryptData, key, iv []byte) ([]byte, error)
- func AesCBCEncrypt(src, key, iv []byte) []byte
- func AesDecrypt(crypted, key, iv []byte) ([]byte, error)
- func AesECBDecrypt(dst, key []byte) []byte
- func AesECBEncrypt(src, key []byte) []byte
- func Array_Diff(Arr1 []int, Arr2 []int) []int
- func Array_Diff_String(Arr1 []string, Arr2 []string) []string
- func Array_Mixed(Arr1 []int, Arr2 []int) []int
- func Array_Mixed_String(Arr1 []string, Arr2 []string) []string
- func Array_Rand(num int) []int
- func Array_column(Arr []map[string]string, Str string) []string
- func Array_column_index(Arr []map[string]string, Str string, Index string) map[string]string
- func Array_merge(arr ...[]string) []string
- func Array_merge_int(arr ...[]int) []int
- func Array_unique(Arr []string) []string
- func Base64Decode(json string) ([]byte, error)
- func Base64Encode(json string) string
- func BytesToInt(b []byte) int32
- func CheckIdCard(card string) bool
- func CheckMobile(phone string) bool
- func ConvertToString(src string, srcCode string, tagCode string) string
- func Crontab(f func())
- func CrontabMicro(f func())
- func Date(timestamp int64, format string) string
- func DateTimeGet() int64
- func Die(v interface{})
- func Err(str string) error
- func Explode(str string, sep string) []string
- func FailOnError(err error, msg string)
- func FileExist(filename string) bool
- func Fprintf(w http.ResponseWriter, str string)
- func Get(url string, para map[string]string) (string, error)
- func GetDiffDays(t1, t2 time.Time) int
- func GetDiffDaysBySecond(t1, t2 int64) int
- func GetDiffDaysBySecondOffset(t1, t2, offset int64) int
- func HexDecode(s string) []byte
- func HexEncode(s string) []byte
- func Http_build_query(para map[string]string) string
- func Implode(arr []string, sep string) string
- func InArray(Arr interface{}, str string) bool
- func Int64ToInt(num int64) (int, error)
- func IntToBytes(x int32) []byte
- func IntToStr(a interface{}) string
- func IntsToStrs(intArr []int) []string
- func JsonDecode(str []byte, jsonArr interface{}) error
- func JsonEncode(arr interface{}) ([]byte, error)
- func Keys(Arr map[string]string) []string
- func Krand(size int, kind int) []byte
- func Log(Path string)
- func LogSave(Path string)
- func Marshal(ProtoId int32, pbStruct proto.Message) ([]byte, error)
- func Max(Para ...int) int
- func Md5(str string) string
- func Min(Para ...int) int
- func PKCS7UnPadding(plantText []byte) []byte
- func Post(url string, paraInterface interface{}) (string, error)
- func PostJson(url string, paraInterface interface{}) (string, error)
- func Printf(format string, a ...interface{})
- func Println(str ...interface{})
- func Rand(Min int, Max int) int
- func Rate(num int) bool
- func ReadFile(str string) ([]byte, error)
- func RsaDecrypt(ciphertext []byte, Privatekey []byte) ([]byte, error)
- func RsaEncrypt(origData []byte, Privatekey []byte) ([]byte, error)
- func RsaVeri(origData []byte, PublicKey []byte, Sign string) error
- func SHA1(str string) string
- func SocketListenUdp(Ip string, f func())
- func Str2Lower(Str string) string
- func Str2Title(Str string) string
- func Str2Upper(Str string) string
- func StrToInt(str string) int
- func StrToInt32(str string) int32
- func StrToInt64(str string) int64
- func StrToTime(format string, input string) int64
- func StrToTimeByDate(format string, input string) int64
- func StrsToInts(StrArr []string) []int
- func Substr(str string, start int, end int) string
- func Time(str string) int64
- func TimeStr(str string) string
- func UnHttp_build_query(Str string) map[string]string
- func Unmarshal(data []byte, pbStruct proto.Message) error
- func Unset(arr []string, str string) []string
- func UrlDeCode(str string) string
- func UrlEnCode(str string) string
- func VeriPara(Req map[string]string, Para []string) bool
- func Week() int
- func Wordwrap(Str string, width int, breakStr string) string
- type ByAge
- type CacheRedis
- func (cr *CacheRedis) Connect() error
- func (cr *CacheRedis) Del(key ...string) error
- func (cr *CacheRedis) Exists(key string) (bool, error)
- func (cr *CacheRedis) Expire(key string, second int) (bool, error)
- func (cr *CacheRedis) FlushAll() error
- func (cr *CacheRedis) Get(key string) (string, error)
- func (cr *CacheRedis) HGet(key string, subKey string) (interface{}, error)
- func (cr *CacheRedis) HGetAll(key string) (map[string]string, error)
- func (cr *CacheRedis) HMset(key string, arr interface{}) (interface{}, error)
- func (cr *CacheRedis) Keys(key string) ([]string, error)
- func (cr *CacheRedis) SAdd(Key string, Val string) (int, error)
- func (cr *CacheRedis) SCard(Key string) (interface{}, error)
- func (cr *CacheRedis) SIsMembers(Key string, Val string) (int, error)
- func (cr *CacheRedis) SMembers(Key string, Val string) (interface{}, error)
- func (cr *CacheRedis) SRem(Key string, Val ...string) (interface{}, error)
- func (cr *CacheRedis) Set(key string, value string) error
- func (cr *CacheRedis) SetEx(key string, expire int, value string) (string, error)
- func (cr *CacheRedis) SetNx(key string, value string) (int, error)
- func (cr *CacheRedis) Ttl(key string) (interface{}, error)
- func (cr *CacheRedis) ZAdd(Key string, Score int64, Name string) (interface{}, error)
- func (cr *CacheRedis) ZCard(Key string) (int, error)
- func (cr *CacheRedis) ZCount(Key string, Min int32, Max int32) (int, error)
- func (cr *CacheRedis) ZRange(Key string, Start int32, End int32) ([][2]int64, error)
- func (cr *CacheRedis) ZRank(Key string, Name string) (int, error)
- func (cr *CacheRedis) ZRem(Key string, Name string) (interface{}, error)
- func (cr *CacheRedis) ZRevRange(Key string, Start int32, End int32) ([][2]int64, error)
- func (cr *CacheRedis) ZRevRank(Key string, Name string) (int, error)
- type CurlModel
- func (c *CurlModel) ExecGet() ([]byte, error)
- func (c *CurlModel) ExecPost() ([]byte, error)
- func (c *CurlModel) SetBody(Body []byte) *CurlModel
- func (c *CurlModel) SetCert(certFile string, keyFile string) *CurlModel
- func (c *CurlModel) SetHeader(Header map[string]string) *CurlModel
- func (c *CurlModel) SetIsDebug(IsDebug bool) *CurlModel
- func (c *CurlModel) SetIsHttps(IsHttps bool) *CurlModel
- func (c *CurlModel) SetIsJson(IsJson bool) *CurlModel
- func (c *CurlModel) SetMethod(Method string) *CurlModel
- func (c *CurlModel) SetPara(Para map[string]string) *CurlModel
- func (c *CurlModel) SetUrl(Url string) *CurlModel
- type Person
- type RSASecurity
- func (rsas *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
- func (rsas *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
- func (rsas *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
- func (rsas *RSASecurity) SetPrivateKey(priStr string) (err error)
- func (rsas *RSASecurity) SetPublicKey(pubStr string) (err error)
- type RandWeiht
- type RandWeihtArr
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ( ErrDataToLarge = errors.New("message too long for RSA public key size") ErrDataLen = errors.New("data length error") ErrDataBroken = errors.New("data broken, first byte is not zero") ErrKeyPairDismatch = errors.New("data is not encrypted by the private key") ErrDecryption = errors.New("decryption error") ErrPublicKey = errors.New("get public key error") ErrPrivateKey = errors.New("get private key error") )
var RSA = &RSASecurity{}
var UdpConn *net.UDPConn
Functions ¶
func AesCBCDecrypt ¶
func AesCBCDncrypt ¶
微信小程序解密 (获取电话号码等)
func AesCBCEncrypt ¶
func AesECBDecrypt ¶
func AesECBEncrypt ¶
func Array_Diff ¶
func Array_Diff_String ¶
func Array_Mixed ¶
func Array_Mixed_String ¶
func Array_Rand ¶
func Array_column_index ¶
func Array_merge ¶
func Array_merge_int ¶
func Array_unique ¶
func Base64Decode ¶
func Base64Encode ¶
func BytesToInt ¶
func CheckIdCard ¶
func CheckMobile ¶
func ConvertToString ¶
转码 ConvertToString( string, "gbk", "utf-8")
func CrontabMicro ¶
func CrontabMicro(f func())
func Date ¶
-- format : "2006-01-02 03:04:05 PM" --
@timestamp 传0 ,即现在时间
月份 1,01,Jan,January 日 2,02,_2 时 3,03,15,PM,pm,AM,am 分 4,04 秒 5,05 年 06,2006 周几 Mon,Monday 时区时差表示 -07,-0700,Z0700,Z07:00,-07:00,MST 时区字母缩写 MST
func DateTimeGet ¶
func DateTimeGet() int64
func FailOnError ¶
func Fprintf ¶
func Fprintf(w http.ResponseWriter, str string)
func GetDiffDaysBySecond ¶
获取t1和t2的相差天数,单位:秒,0表同一天,正数表t1>t2,负数表t1<t2
func GetDiffDaysBySecondOffset ¶
获取t1和t2的相差天数,单位:秒,0表同一天,正数表t1>t2,负数表t1<t2(带偏移) 使用场景:比如以每天5点为天数计算分界点(同一天4点和6点,算2天)
func Http_build_query ¶
* para := map[string]string{"sex":"boy", "age":"18", "name":"老钱"}
func Int64ToInt ¶
func IntToBytes ¶
func IntsToStrs ¶
func JsonDecode ¶
func JsonEncode ¶
func PKCS7UnPadding ¶
func SocketListenUdp ¶
func SocketListenUdp(Ip string, f func())
func StrToInt32 ¶
func StrToInt64 ¶
func StrToTimeByDate ¶
-- "01/02/2006", "02/08/2015" --
func StrsToInts ¶
func UnHttp_build_query ¶
Types ¶
type ByAge ¶
type ByAge []Person
ByAge implements sort.Interface for []Person based on the Age field.
type CacheRedis ¶
func (*CacheRedis) Del ¶
func (cr *CacheRedis) Del(key ...string) error
func (*CacheRedis) FlushAll ¶
func (cr *CacheRedis) FlushAll() error
func (*CacheRedis) HGet ¶
func (cr *CacheRedis) HGet(key string, subKey string) (interface{}, error)
func (*CacheRedis) HMset ¶
func (cr *CacheRedis) HMset(key string, arr interface{}) (interface{}, error)
func (*CacheRedis) SCard ¶
func (cr *CacheRedis) SCard(Key string) (interface{}, error)
func (*CacheRedis) SIsMembers ¶
func (cr *CacheRedis) SIsMembers(Key string, Val string) (int, error)
func (*CacheRedis) SMembers ¶
func (cr *CacheRedis) SMembers(Key string, Val string) (interface{}, error)
func (*CacheRedis) SRem ¶
func (cr *CacheRedis) SRem(Key string, Val ...string) (interface{}, error)
func (*CacheRedis) Ttl ¶
func (cr *CacheRedis) Ttl(key string) (interface{}, error)
func (*CacheRedis) ZAdd ¶
func (cr *CacheRedis) ZAdd(Key string, Score int64, Name string) (interface{}, error)
type CurlModel ¶
type CurlModel struct { Url string Para map[string]string Method string IsHttps bool Header map[string]string IsJson bool IsDebug bool Body []byte IsCert bool //是否验证证书 CertFile string KeyFile string }
func (*CurlModel) SetIsDebug ¶
func (*CurlModel) SetIsHttps ¶
type RSASecurity ¶
type RSASecurity struct {
// contains filtered or unexported fields
}
func (*RSASecurity) GetPrivatekey ¶
func (rsas *RSASecurity) GetPrivatekey() (*rsa.PrivateKey, error)
*rsa.PublicKey
func (*RSASecurity) GetPublickey ¶
func (rsas *RSASecurity) GetPublickey() (*rsa.PublicKey, error)
*rsa.PrivateKey
func (*RSASecurity) PriKeyDECRYPT ¶
func (rsas *RSASecurity) PriKeyDECRYPT(input []byte) ([]byte, error)
私钥解密
func (*RSASecurity) PriKeyENCTYPT ¶
func (rsas *RSASecurity) PriKeyENCTYPT(input []byte) ([]byte, error)
私钥加密
func (*RSASecurity) PubKeyDECRYPT ¶
func (rsas *RSASecurity) PubKeyDECRYPT(input []byte) ([]byte, error)
公钥解密
func (*RSASecurity) PubKeyENCTYPT ¶
func (rsas *RSASecurity) PubKeyENCTYPT(input []byte) ([]byte, error)
公钥加密
func (*RSASecurity) SetPrivateKey ¶
func (rsas *RSASecurity) SetPrivateKey(priStr string) (err error)
设置私钥
func (*RSASecurity) SetPublicKey ¶
func (rsas *RSASecurity) SetPublicKey(pubStr string) (err error)
设置公钥
type RandWeihtArr ¶
type RandWeihtArr []RandWeiht
func (*RandWeihtArr) RandWeight ¶
func (arr *RandWeihtArr) RandWeight() string
* RandWeihtArr := &lib.RandWeihtArr{{"user1",8}, {"user2",1},{"user3",1}} * who := RandWeihtArr.RandWeight()