Documentation
¶
Index ¶
- Variables
- func Base64Encode(str string) string
- func CamelToCase(name string) string
- func ConvertStr(value interface{}) string
- func CosDeleteFile(conf config.CosConfig, key string) error
- func CosGetCredential(conf config.CosConfig, folder string, action []string) (*sts.CredentialResult, error)
- func CosGetUploadCredential(conf config.CosConfig, folder string) (*sts.CredentialResult, error)
- func CosNewClient(conf config.CosConfig, action []string) (*cos.Client, error)
- func CosUploadFile(conf config.CosConfig, key string, file string) error
- func CosUploadRemoteFile(conf config.CosConfig, key string, remoteUrl string) error
- func CosUploadStreamFile(conf config.CosConfig, key string, stream io.Reader) error
- func CurrentDateTime() (microDate int64, microTime int64)
- func DiscountText(val float32, dft ...string) string
- func FenToYuan(val int, thousandth ...bool) string
- func Float32ToString(val float32) string
- func Float64ToString(val float64) string
- func FormatMicroDateTimeShortString(value int64, format string, sep string) (text string)
- func FormatMicroTime(value int64, format ...string) string
- func FormatMicroTimeShortString(value int64) (text string)
- func FormatSecondTime(value int64, format ...string) string
- func GetFirstDateOfWeek() (weekMonday string)
- func GetPost(c *gin.Context, key string) *queryFormData
- func GetPostArray(c *gin.Context, key string) *queryFormDataArray
- func GetQuery(c *gin.Context, key string) *queryFormData
- func GetQueryArray(c *gin.Context, key string) *queryFormDataArray
- func GetTodayStartMircoTime() int64
- func GetTodayStartSecondTime() int64
- func Hex16ToFloat64(bys []byte) float64
- func Hex16ToInt(bys []byte) int
- func Hex16ToInt64(bys []byte) int64
- func Hex16ToUint64(bys []byte) uint64
- func HexIEEE754ToFloat(bys []byte) float64
- func HttpBuildQuery(data map[string]interface{}) string
- func HttpGet(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
- func HttpPostFile(url string, filename string) ([]byte, *exception.Error)
- func HttpPostForm(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
- func HttpPostString(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
- func HttpPostString1(url string, data string) ([]byte, *exception.Error)
- func InArrayByFloat64(val float64, arr []float64) bool
- func InArrayByInt(val int, arr []int) bool
- func InArrayByInt64(val int64, arr []int64) bool
- func InArrayByStr(val string, arr []string) bool
- func InetAtoN(ip string) int64
- func InetNtoA(ip int64) string
- func Int64ArrayDiff(array1 []int64, othersParams ...[]int64) []int64
- func Int64ArrayIntersect(array1 []int64, othersParams ...[]int64) []int64
- func Int64ToFloat32(val int64) float32
- func Int64ToFloat64(val int64) float64
- func Int64ToString(val int64) string
- func IntAConvStrA(data []int) (result []string)
- func IntArrayDiff(array1 []int, othersParams ...[]int) []int
- func IntArrayIntersect(array1 []int, othersParams ...[]int) []int
- func IntToFloat32(val int) float32
- func IntToFloat64(val int) float64
- func IntToHex16(num interface{}) []byte
- func IntToHex36(num int) string
- func IntToString(val int) string
- func Is32BitCode(val string) (match bool)
- func IsEmpty(val interface{}) bool
- func IsLetter(val string) (match bool)
- func IsLetterAndNumber(val string) (match bool)
- func IsNumber(val string) (match bool)
- func IsNumeric(val string) (match bool)
- func IsTextKey(val string) (match bool)
- func JsonToMap(str string) (map[string]interface{}, error)
- func JsonToString(val interface{}) string
- func KSort(data map[string]interface{}) map[string]interface{}
- func MD5(str string) string
- func MD5RAW(str string) string
- func MD5Sign(dict map[string]interface{}, secret string) (sign string)
- func MD5withKEY(str string, key string) string
- func MicroTime() int64
- func MicroTimeDate() int64
- func MicroTimeHour() int64
- func MicroTimeMinute() int64
- func PKCS7UnPadding(plantText []byte) []byte
- func Paginate(c *gin.Context, defaultSize ...int) (int, int)
- func PrintJSON(val interface{})
- func RandomInt64(nums int) int64
- func RandomString(nums int) string
- func RemoteIp(c *gin.Context) string
- func RemoveDuplicatesAndEmpty(data []string) (ret []string)
- func SHA1(str string) string
- func SHA1HMAC(key string, str string) string
- func SHA256(str string) string
- func SecondTime() int64
- func StrAConvIntA(data []string) (result []int)
- func StringArrayDiff(array1 []string, othersParams ...[]string) []string
- func StringArrayIntersect(array1 []string, othersParams ...[]string) []string
- func StringToFloat64(val string) float64
- func StringToInt(val string) int
- func StringToInt64(val string) int64
- func StringToJson(val string, target interface{})
- func StringToTime(str string) int64
- func StringToXml(val string, target interface{})
- func Thousandth(val interface{}) string
- func ThousandthDecimals(val interface{}, decimals int) string
- func WxCodeToSession(code string, conf config.WeiXinMcpConfig) ([]byte, *exception.Error)
- func WxCreateMpMenu(menu string, accessToken string) *exception.Error
- func WxCreateQrcodeUnlimited(sceneId string, page string, width int, accessToken string) ([]byte, *exception.Error)
- func WxGetAccessToken(redis *redis.Client, conf config.WeiXinMcpConfig, force bool) (string, *exception.Error)
- func WxSendMpContent(openId string, accessToken string, msgtype string, data string) *exception.Error
- func WxShowQrCode(ticket string) string
- func XmlToString(val interface{}) string
- type HttpClientOptions
- type Int64Array
- type Int64Int64Map
- type Int64IntMap
- type Int64StringMap
- type IntArray
- type IntBoolMap
- type IntInt64Map
- type IntIntMap
- type IntStringMap
- type StrArray
- type StringBoolMap
- type StringIntMap
- type StringStringMap
- type TimeInt64Data
- type TimeStringData
- type WxAccessTokenData
- type WxBizDataCrypt
- type WxMediaData
- type WxQrcodeData
- type WxQrcodeUnlimitedData
- type WxResponseErrorData
- type WxUploadData
- type WxUserInfoData
Constants ¶
This section is empty.
Variables ¶
var (
RegexY, _ = regexp.Compile(`^\d{4}$`)
RegexYM, _ = regexp.Compile(`^\d{4}-\d{2}$`)
RegexYMD, _ = regexp.Compile(`^\d{4}-\d{2}-\d{2}$`)
RegexYMDHI, _ = regexp.Compile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$`)
RegexYMDHIS, _ = regexp.Compile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$`)
)
var (
NumberLetters = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
)
Functions ¶
func Base64Encode ¶
func CamelToCase ¶
func ConvertStr ¶
func ConvertStr(value interface{}) string
func CosDeleteFile ¶
CosDeleteFile 删除单个文件
func CosGetCredential ¶
func CosGetCredential(conf config.CosConfig, folder string, action []string) (*sts.CredentialResult, error)
CosGetCredential 获取COS临时密钥
func CosGetUploadCredential ¶
CosGetUploadCredential 获取COS上传临时密钥
func CosNewClient ¶
CosNewClient 实例化客户端
func CosUploadFile ¶
CosUploadFile 上传本地文件
func CosUploadRemoteFile ¶
CosUploadRemoteFile 上传远程文件
func CosUploadStreamFile ¶
CosUploadStreamFile 上传流文件
func CurrentDateTime ¶
CurrentDateTime 获取当前日和时的毫秒
func Float32ToString ¶
func Float64ToString ¶
func FormatMicroDateTimeShortString ¶
FormatMicroDateTimeShortString 把时间格式化成 今天 18:12, 明天 09:22,昨天、前天
func FormatMicroTime ¶
* 年:2006 月:01 日:02 时:15 分:04 秒:05 毫秒:.000
func FormatSecondTime ¶
func GetPostArray ¶
func GetQueryArray ¶
func GetTodayStartMircoTime ¶
func GetTodayStartMircoTime() int64
GetTodayStartMircoTime 获取当日零点时间戳(毫秒)
func GetTodayStartSecondTime ¶
func GetTodayStartSecondTime() int64
GetTodayStartSecondTime 获取当日零点时间戳(秒)
func Hex16ToFloat64 ¶
func Hex16ToInt ¶
func Hex16ToInt64 ¶
func Hex16ToUint64 ¶
func HexIEEE754ToFloat ¶
func HttpBuildQuery ¶
func HttpGet ¶
func HttpGet(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
func HttpPostForm ¶
func HttpPostForm(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
func HttpPostString ¶
func HttpPostString(accessUrl string, option *HttpClientOptions) (response []byte, ex *exception.Error)
func InArrayByFloat64 ¶
func InArrayByInt ¶
func InArrayByInt64 ¶
func InArrayByStr ¶
func Int64ArrayDiff ¶
Int64ArrayDiff 数组差异项的集合(第一个有,其它没有的)
func Int64ArrayIntersect ¶
Int64ArrayIntersect 数组交集项的集合(所有数据都有项)
func Int64ToFloat32 ¶
func Int64ToFloat64 ¶
func Int64ToString ¶
func IntAConvStrA ¶
func IntArrayDiff ¶
IntArrayDiff 数组差异项的集合(第一个有,其它没有的)
func IntArrayIntersect ¶
IntArrayIntersect 数组交集项的集合(所有数据都有项)
func IntToFloat32 ¶
func IntToFloat64 ¶
func IntToHex16 ¶
func IntToHex16(num interface{}) []byte
func IntToHex36 ¶
func IntToString ¶
func IsLetterAndNumber ¶
IsLetterAndNumber 检查是否为字母+数字
func JsonToString ¶
func JsonToString(val interface{}) string
func MD5withKEY ¶
func MicroTimeDate ¶
func MicroTimeDate() int64
func MicroTimeHour ¶
func MicroTimeHour() int64
func MicroTimeMinute ¶
func MicroTimeMinute() int64
func PKCS7UnPadding ¶
PKCS7UnPadding return unPadding []Byte plantText
func RandomInt64 ¶
func RandomString ¶
func RemoveDuplicatesAndEmpty ¶
RemoveDuplicatesAndEmpty 过滤重复值和空值
func StrAConvIntA ¶
func StringArrayDiff ¶
StringArrayDiff 数组差异项的集合(第一个有,其它没有的)
func StringArrayIntersect ¶
StringArrayIntersect 数组交集项的集合(所有数据都有项)
func StringToFloat64 ¶
func StringToInt ¶
func StringToInt64 ¶
func StringToJson ¶
func StringToJson(val string, target interface{})
func StringToXml ¶
func StringToXml(val string, target interface{})
func Thousandth ¶
func Thousandth(val interface{}) string
func ThousandthDecimals ¶
func WxCodeToSession ¶
WxCodeToSession 换取授权密钥
func WxCreateMpMenu ¶
WxCreateMpMenu 创建微信公众号菜单
func WxCreateQrcodeUnlimited ¶
func WxCreateQrcodeUnlimited(sceneId string, page string, width int, accessToken string) ([]byte, *exception.Error)
WxCreateQrcodeUnlimited 创建微信公众号、小程序二维码(永久有效,数量暂无限制)
func WxGetAccessToken ¶
func WxGetAccessToken(redis *redis.Client, conf config.WeiXinMcpConfig, force bool) (string, *exception.Error)
WxGetAccessToken 获取Token
func WxSendMpContent ¶
func WxSendMpContent(openId string, accessToken string, msgtype string, data string) *exception.Error
WxSendMpContent 发送客服消息
func XmlToString ¶
func XmlToString(val interface{}) string
Types ¶
type HttpClientOptions ¶
type Int64Array ¶
type Int64Array []int64
func (Int64Array) InArray ¶
func (arr Int64Array) InArray(val int64) bool
type Int64Int64Map ¶
func (Int64Int64Map) GetKVS ¶
func (m Int64Int64Map) GetKVS() (keys []int64, values []int64)
func (Int64Int64Map) GetKeys ¶
func (m Int64Int64Map) GetKeys() []int64
func (Int64Int64Map) GetValues ¶
func (m Int64Int64Map) GetValues() []int64
type Int64IntMap ¶
func (Int64IntMap) GetKeys ¶
func (m Int64IntMap) GetKeys() []int64
func (Int64IntMap) GetValues ¶
func (m Int64IntMap) GetValues() []int
type Int64StringMap ¶
func (Int64StringMap) GetKVS ¶
func (m Int64StringMap) GetKVS() (keys []int64, values []string)
func (Int64StringMap) GetKeys ¶
func (m Int64StringMap) GetKeys() []int64
func (Int64StringMap) GetValues ¶
func (m Int64StringMap) GetValues() []string
type IntBoolMap ¶
func (IntBoolMap) GetKeys ¶
func (m IntBoolMap) GetKeys() []int
type IntInt64Map ¶
func (IntInt64Map) GetKVS ¶
func (m IntInt64Map) GetKVS() (keys []int, values []int64)
func (IntInt64Map) GetKeys ¶
func (m IntInt64Map) GetKeys() []int
func (IntInt64Map) GetValues ¶
func (m IntInt64Map) GetValues() []int64
type IntStringMap ¶
func (IntStringMap) GetKVS ¶
func (m IntStringMap) GetKVS() (keys []int, values []string)
func (IntStringMap) GetKeys ¶
func (m IntStringMap) GetKeys() []int
func (IntStringMap) GetValues ¶
func (m IntStringMap) GetValues() []string
type StringBoolMap ¶
func (StringBoolMap) GetKeys ¶
func (m StringBoolMap) GetKeys() []string
type StringIntMap ¶
func (StringIntMap) GetKVS ¶
func (m StringIntMap) GetKVS() (keys []string, values []int)
func (StringIntMap) GetKeys ¶
func (m StringIntMap) GetKeys() []string
func (StringIntMap) GetValues ¶
func (m StringIntMap) GetValues() []int
type StringStringMap ¶
func (StringStringMap) GetKVS ¶
func (m StringStringMap) GetKVS() (keys []string, values []string)
func (StringStringMap) GetKeys ¶
func (m StringStringMap) GetKeys() []string
func (StringStringMap) GetPairs ¶
func (m StringStringMap) GetPairs() (pairs []string)
func (StringStringMap) GetValues ¶
func (m StringStringMap) GetValues() []string
type TimeInt64Data ¶
type TimeInt64Data struct {
Value int64
}
func GetTimeInt64 ¶
func GetTimeInt64(val int64) *TimeInt64Data
func (*TimeInt64Data) NextDay ¶
func (d *TimeInt64Data) NextDay() int64
func (*TimeInt64Data) NextMonth ¶
func (d *TimeInt64Data) NextMonth() int64
func (*TimeInt64Data) NextYear ¶
func (d *TimeInt64Data) NextYear() int64
func (*TimeInt64Data) PrevDay ¶
func (d *TimeInt64Data) PrevDay() int64
func (*TimeInt64Data) PrevMonth ¶
func (d *TimeInt64Data) PrevMonth() int64
func (*TimeInt64Data) PrevYear ¶
func (d *TimeInt64Data) PrevYear() int64
type TimeStringData ¶
type TimeStringData struct {
Value string
}
func GetTimeString ¶
func GetTimeString(val string) *TimeStringData
func (*TimeStringData) CurrentMonthFirstDayMicroTime ¶
func (d *TimeStringData) CurrentMonthFirstDayMicroTime() int64
func (*TimeStringData) CurrentYearFirstMonthMicroTime ¶
func (d *TimeStringData) CurrentYearFirstMonthMicroTime() int64
func (*TimeStringData) DateTime ¶
func (d *TimeStringData) DateTime() *time.Time
func (*TimeStringData) MicroTime ¶
func (d *TimeStringData) MicroTime() int64
func (*TimeStringData) SecondTime ¶
func (d *TimeStringData) SecondTime() int64
type WxAccessTokenData ¶
type WxAccessTokenData struct { AccessToken string `json:"access_token"` ExpiresIn time.Duration `json:"expires_in"` WxResponseErrorData }
type WxBizDataCrypt ¶
WxBizDataCrypt represents an active WxBizDataCrypt object
func (*WxBizDataCrypt) Decrypt ¶
func (wxCrypt *WxBizDataCrypt) Decrypt(encryptedData string, iv string, isJSON bool) (interface{}, *WxResponseErrorData)
Decrypt Weixin APP's AES Data If isJSON is true, Decrypt return JSON type. If isJSON is false, Decrypt return map type.
type WxMediaData ¶
type WxMediaData struct { MediaId string `json:"media_id"` Url string `json:"url"` WxResponseErrorData }
func WxAddMaterial ¶
func WxAddMaterial(file string, accessToken string, fileType string) (*WxMediaData, *exception.Error)
WxAddMaterial 上传微信永久素材 type限制: 图片(image)、语音(voice)、视频(video)和缩略图(thumb)
type WxQrcodeData ¶
type WxQrcodeData struct { Ticket string `json:"ticket"` ExpireSeconds int `json:"expire_seconds"` Url string `json:"url"` WxResponseErrorData }
func WxCreateQrcode ¶
func WxCreateQrcode(sceneId string, accessToken string) (*WxQrcodeData, *exception.Error)
WxCreateQrcode 创建微信公众号二维码
type WxQrcodeUnlimitedData ¶
type WxQrcodeUnlimitedData struct { ContentType string `json:"contentType"` Buffer string `json:"buffer"` WxResponseErrorData }
type WxResponseErrorData ¶
type WxUploadData ¶
type WxUploadData struct { Type string `json:"type"` MediaId string `json:"media_id"` CreatedAt int `json:"created_at"` WxResponseErrorData }
func WxUploadFile ¶
func WxUploadFile(file string, accessToken string, fileType string) (*WxUploadData, *exception.Error)
WxUploadFile 上传微信临时素材
type WxUserInfoData ¶
type WxUserInfoData struct { Openid string `json:"openid"` UnionId string `json:"unionid"` Nickname string `json:"nickname"` Sex int64 `json:"sex"` HeadImgUrl string `json:"headimgurl"` Subscribe int64 `json:"subscribe"` SubscribeTime int64 `json:"subscribe_time"` WxResponseErrorData }
func WxGetUserInfo ¶
func WxGetUserInfo(openId string, accessToken string) (*WxUserInfoData, *exception.Error)
WxGetUserInfo 获取用户信息