Documentation ¶
Index ¶
- Constants
- func AbsInt64(num int64) int64
- func AddSlashes(str string) string
- func BaiduSignature(params map[string]interface{}, secret string) string
- func Base64Decode(data string) ([]byte, error)
- func Base64Encode(data []byte) string
- func BasicAuth(username, password string) string
- func BuildEsGeoLocation(lng, lat string) string
- func CalculateAgeByBirthday(birthday string) int
- func CamelString(s string) string
- func ChangeValueByColName(aExt interface{}, colName string, dstValue interface{}) interface{}
- func ClearOnSignal(handler func())
- func ContainNumber(str string) (valid bool)
- func ConvertTime2Secs(str string) int
- func Date2UnixMsec(dateStr, layout string) int64
- func DecimalMoneyMul100(moneyStr string) (money int64, err error)
- func DefaultFormReqHeaders() map[string]string
- func DefaultJsonReqHeaders() map[string]string
- func DetectFileByteType(buf []byte) (extension, mime string, err error)
- func DetectFileType(filename string) (string, string, error)
- func EsGeoLocation2LngLat(location string) (lng, lat string)
- func Escape(html string) string
- func Exists(file string) bool
- func ExtractUrls(s string) ([]string, error)
- func FieldByName(rv reflect.Value, colName string) reflect.Value
- func Float2Str(f float32) string
- func Float642Str(f float64) string
- func FullStack() string
- func Gbk2Utf8(s []byte) ([]byte, error)
- func GenerateMobileCaptcha(length int) string
- func GenerateRandom(min, max int) int
- func GenerateRandom64(min, max int64) int64
- func GenerateRandomStr(length int) string
- func GeoDistance(lat1, lng1, lat2, lng2 float64) float64
- func GetFileExt(filename string) (suffix string)
- func GetUnixMillis() int64
- func Guid() string
- func HmacSHA1(key string, data string) string
- func HmacSha256(date, secret string) string
- func Hostname() string
- func HumanMoney(money int64) string
- func HumanUnixMillis(t int64) (display string)
- func HumanUnixMillisV2(t int64) (display string)
- func IP2Long(ip string) int64
- func Int2Str(number int) string
- func Int642Str(number int64) string
- func IsDir(file string) bool
- func IsFile(file string) bool
- func IsNumber(str string) (valid bool)
- func JSONMarshal(v interface{}) ([]byte, error)
- func JsonEncode(d interface{}) (jsonStr string, err error)
- func Long2IP4(ipLong int64) string
- func MaxInt64(x, y int64) int64
- func Md5(s string) string
- func Md5Bytes(buf []byte) string
- func MinInt64(x, y int64) int64
- func MobileMask(mobile string) string
- func MoneyDisplay(money int64) string
- func NaturalDay(offset int64) (um int64)
- func NicknameMask(nickname string) string
- func NumberFormat(number interface{}) string
- func ParseCookie(cookie, key string) (value string, err error)
- func ParseTableName(sql string) (name string, err error)
- func ParseTargetList(str string) []string
- func PasswordEncrypt(password string, salt int64) string
- func PickRandomEmoji() string
- func RFC3339TimeTransfer(datetime string) int64
- func RawUrlEncode(s string) (r string)
- func RealNameMask(realName string) (maskStr string)
- func RegRemoveScript(in string) string
- func Remove(filename string) (err error)
- func ReplaceInvalidRealName(name string) string
- func SecretKeyMask(secretKey string) (str string)
- func SetByFields(aExt interface{}, colName string, dstValue interface{}) error
- func SetupSignalHandler(shutdownFunc func())
- func Sha1(data string) string
- func Sha256(data string) string
- func SimpleHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, ...) (statusCode int, respHeader http.Header, respBody []byte, err error)
- func SimpleNumStr2Num(s string) int
- func SnakeString(s string) string
- func SqlPlaceholderWithArray(length int) string
- func Str2Float(s string) (f float32, err error)
- func Str2Float64(s string) (f float64, err error)
- func Str2Int(str string) (int, error)
- func Str2Int64(str string) (int64, error)
- func StrReplace(origin string, search []string, replace string) (s string)
- func StrTenThousand2MoneyMul100(money string) int64
- func StrTrim(str string) string
- func Stringify(obj interface{}) string
- func StringsContains(array []string, val string) (index int)
- func StripSlashes(str string) string
- func SubString(s string, pos, length int) string
- func SubStringByPos(s string, sPos, ePos int) string
- func TrimRealName(name string) string
- func TrimTags(s string) string
- func URLBase64Decode(data string) ([]byte, error)
- func URLBase64Encode(data []byte) string
- func Unicode(rs string) string
- func UnixMillis() int64
- func UnixMsec2Date(um int64, layout string) string
- func UrlDecode(data string) (string, error)
- func UrlEncode(data string) string
- func Utf8ToGbk(s []byte) ([]byte, error)
- func VerifyBirthday(birthday string) bool
- func VerifyEmail(email string) bool
- func VerifyMobile(mobile string) bool
- type HttpTimeout
Constants ¶
View Source
const ( SecondAHour int64 = 3600 MillsSecondAHour = SecondAHour * 1000 SecondADay int64 = 86400 MillsSecondADay = SecondADay * 1000 MillsSecondAYear = MillsSecondADay * 365 )
View Source
const ( HttpMethodGet string = "GET" HttpMethodPOST string = "POST" )
Variables ¶
This section is empty.
Functions ¶
func AddSlashes ¶
func BaiduSignature ¶
BaiduSignature 空参数值的参数名参与签名,来源:百度开放平台
func BuildEsGeoLocation ¶
func CalculateAgeByBirthday ¶
func ChangeValueByColName ¶
func ChangeValueByColName(aExt interface{}, colName string, dstValue interface{}) interface{}
ChangeValueByColName 通过反射更改结构体的值
func ClearOnSignal ¶
func ClearOnSignal(handler func())
func ContainNumber ¶
func Date2UnixMsec ¶
func DecimalMoneyMul100 ¶
DecimalMoneyMul100 将带小数点的金额转换成数据库中的乘以100后的整数
func DefaultFormReqHeaders ¶
func DefaultJsonReqHeaders ¶
func DetectFileByteType ¶
func EsGeoLocation2LngLat ¶
func ExtractUrls ¶
func Float642Str ¶
func GenerateMobileCaptcha ¶
GenerateMobileCaptcha 手机验证在4-8位之间,简单实现
func GenerateRandom64 ¶
GenerateRandom64 生成一个区间范围的随机数,左闭右开
func GenerateRandomStr ¶
func GetFileExt ¶
GetFileExt 简易版取文件名后缀,path.Ext()方法会带着个`.`
func HmacSha256 ¶
func HumanMoney ¶
func HumanUnixMillis ¶
func HumanUnixMillisV2 ¶
func JSONMarshal ¶
直接json.Marshal , 会把 < > & 转成 unicode 编码 JSONMarshal 解决直接json.Marshal 后单引号,双引号,< > & 符号的问题
func JsonEncode ¶
func MobileMask ¶
func MoneyDisplay ¶
func NicknameMask ¶
func ParseCookie ¶
func ParseTableName ¶
ParseTableName 从SQL语句中解析主表名
func ParseTargetList ¶
func PasswordEncrypt ¶
func PickRandomEmoji ¶
func PickRandomEmoji() string
func RFC3339TimeTransfer ¶
func RawUrlEncode ¶
func RealNameMask ¶
func RegRemoveScript ¶
func ReplaceInvalidRealName ¶
func SecretKeyMask ¶
func SetByFields ¶
func SetupSignalHandler ¶
func SetupSignalHandler(shutdownFunc func())
SetupSignalHandler setup signal handler
func SimpleHttpClient ¶
func SimpleHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, timeoutConf HttpTimeout) (statusCode int, respHeader http.Header, respBody []byte, err error)
SimpleHttpClient Deprecated: please use more advanced go-resty instead see: https://github.com/go-resty/resty
func SimpleNumStr2Num ¶
func SqlPlaceholderWithArray ¶
func Str2Float64 ¶
func StrReplace ¶
StrReplace 在 origin 中搜索 search 组,替换成 replace
func StringsContains ¶
func StripSlashes ¶
func TrimRealName ¶
func UnixMsec2Date ¶
func VerifyBirthday ¶
Types ¶
type HttpTimeout ¶
type HttpTimeout struct { DialTimeout int DialKeepAlive int TLSHandshakeTimeout int ResponseHeaderTimeout int ExpectContinueTimeout int Timeout int }
func DefaultHttpTimeout ¶
func DefaultHttpTimeout() HttpTimeout
func SetHttpTimeout ¶
func SetHttpTimeout(dialTimeout, dialKeepAlive, tlsHandshakeTimeout, responseHeaderTimeout, expectContinueTimeout, timeout int) HttpTimeout
Source Files ¶
Click to show internal directories.
Click to hide internal directories.