Documentation ¶
Overview ¶
辅助工具层
Index ¶
- Constants
- Variables
- func AesDecryptCBC(encrypted []byte, key []byte) (decrypted []byte)
- func AesEncryptCBC(origData []byte, key []byte) (encrypted []byte)
- func Bytes2str(b []byte) string
- func BytesToStr(b []byte) string
- func CreateAnyTypeSlice(slice interface{}) ([]interface{}, bool)
- func CtxClientIP(ctx *fasthttp.RequestCtx) string
- func FilterMysqlNilErr(err error) bool
- func FilterRedisNilErr(err error) bool
- func GbkToUtf8(gbkData []byte) []byte
- func GetCurrentDirectory() string
- func GetParentDirectory(dirctory string) string
- func GetToken(ctx *Ctx) (token string)
- func GetUUid() string
- func GzipCompress(data string) ([]byte, error)
- func GzipCompressByte(data []byte) ([]byte, error)
- func GzipUnCompress(data []byte) (string, error)
- func GzipUnCompressByte(data []byte) ([]byte, error)
- func HMACSHA1Hash(src, key []byte) []byte
- func HMACSHA1HexHash(src, key []byte) string
- func Hash(ht crypto.Hash, b []byte) []byte
- func HashHex(ht crypto.Hash, b []byte) string
- func HmacSha256(data string, secret string) string
- func InArr(array []int, column int) bool
- func InMap(maps map[string]int, column string) (ok bool)
- func InstrArr(array []string, column string) bool
- func IsGBK(data []byte) bool
- func IsJson(str string) bool
- func IsMysqlRepeatError(err error) bool
- func IsSameDay(oldDay, anotherDay int64) bool
- func IsUtf8(data []byte) bool
- func JoinInt(s []int, sp string) string
- func LoadJSONConfig(filename string, v interface{}) error
- func MD5Hash(b []byte) []byte
- func MD5HexHash(b []byte) string
- func Model2Map(m interface{}, needZeroByInt, needZeroByString bool) (res map[string]interface{})
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func OpenWinBrowser(uri string) error
- func PostJSON(URL string, v interface{}) ([]byte, error)
- func PwdDecode(pwd string, key string) (string, error)
- func PwdEncode(pwd string, key string) string
- func RemoveRepeatedElement(arr []string) (newArr []interface{})
- func SHA1HexHash(b []byte) string
- func SHA256HexHash(b []byte) string
- func SplitInt(s, sep string) ([]int, error)
- func Str2Time(formatTimeStr, timeFormat string) time.Time
- func Str2bytes(s string) (b []byte)
- func StrToBytes(s string) []byte
- func WriteJSON(ctx *fasthttp.RequestCtx, v interface{}) error
- type Set
- type Tutil
Constants ¶
const ( TimeFormat = "2006-01-02 15:04:05" TimeFormatDay = "20060102" TimeFormatDay2 = "2006-01-02" TimeFormatDay3 = "2006/01/02" TimeFormatDay4 = "2006.01.02_15" )
Variables ¶
var TokenBucket sync.Map
Functions ¶
func AesDecryptCBC ¶
func AesEncryptCBC ¶
=================== CBC ======================
func Bytes2str ¶
b2s converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
Note it may break if string and/or slice header will change in the future go versions.
func BytesToStr ¶
func CreateAnyTypeSlice ¶
func CreateAnyTypeSlice(slice interface{}) ([]interface{}, bool)
interface{}转为 []interface{}
func CtxClientIP ¶
func CtxClientIP(ctx *fasthttp.RequestCtx) string
获取真实的IP 1.1.1.1, 2.2.2.2, 3.3.3.3
func FilterMysqlNilErr ¶
func FilterRedisNilErr ¶
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
func GetParentDirectory ¶
func GzipCompress ¶
func GzipCompressByte ¶
func GzipUnCompress ¶
func GzipUnCompressByte ¶
func HMACSHA1HexHash ¶
HMACSHA1HexHash hmac-sha1 and encode to string
func HmacSha256 ¶
func IsMysqlRepeatError ¶
func LoadJSONConfig ¶
LoadJSONConfig 读取配置文件 json格式
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given Block.
func OpenWinBrowser ¶
func RemoveRepeatedElement ¶
func RemoveRepeatedElement(arr []string) (newArr []interface{})
func Str2bytes ¶
s2b converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions.