Documentation
¶
Index ¶
- Constants
- func AbsInt64(num int64) int64
- func AddSlashes(str string) string
- func AesDecrypt(crypted, key []byte) []byte
- func AesDecryptCBC(ciphertext string, key string, iv string) (string, error)
- func AesDecryptCBCV2(ciphertext string, key string, iv string) (string, error)
- func AesDecryptUrlCode(ciphertext string, key string, iv string) (string, error)
- func AesEncryptCBC(src string, key string, iv string) (string, error)
- func AesEncryptCBCV2(src string, key string, iv string) (string, error)
- func AesEncryptECB(src, key string) string
- func AesEncryptECBUrlEncode(src, key string) string
- func AppNumVersion(appVersion string) int64
- func AppNumVersion3(appVersion string) int64
- func ArrayToString(a interface{}, delim string) (newStr string)
- func Base64Decode(data string) ([]byte, error)
- func Base64Encode(data []byte) string
- func Base64URLDecode(data string) ([]byte, error)
- func Base64UrlSafeEncode(source []byte) string
- func BaseDayOffset(baseDay int64, offset int64) (um int64)
- func BasicAuth(username, password string) string
- func BuildEsGeoLocation(lng, lat string) string
- func BuildFaceBookUserAvatar(userID string) string
- func BuildFileHashName(localFile string) (hashDir, hashName, fileMd5 string, err error)
- func BuildHashName(fileMd5, suffix string) (hashDir, hashName string)
- func BuildOpMsg(origin string, msg string, OpBy int64) string
- func BuildServiceFeeBody(amount int64) (body types.ServiceFeeBody)
- func BuildUploadFileHashName(buf []byte, suffix string) (hashDir, hashName, fileMd5 string)
- func BuildWithdrawBody(total int64) (body types.WithdrawBody)
- func CKEditorFullHtml(content string) string
- func CaculateTimeZone(lon float64) string
- func CalculateAgeByBirthday(birthday string) int
- func CamelString(s string) string
- func ChangeValueByColName(aExt interface{}, colName string, dstValue interface{}) interface{}
- func CheckRequiredParameter(parameter map[string]interface{}, requiredParameter map[string]bool) bool
- func ClearOnSignal(handler func())
- func CoinDisplay(money int64) string
- func CoinDisplayFloat64(money int64) float64
- func CompareEquals(val1, val2 float64) bool
- func ContainNumber(str string) (valid bool)
- func ConvertTime2Secs(str string) int
- func DBDriver() string
- func Date2UnixMsec(dateStr, layout string) int64
- func DateMHSZ(timestamp int64) string
- func DateParseYMDHMS(dates string) int64
- func DecimalMoneyMul100(moneyStr string) (money int64, err error)
- func Decrypter(crypted []byte, key []byte, iv []byte, paddingType int) ([]byte, error)
- func Default7DaysTimeRange() string
- func DefaultReqHeaders() (reqHeaders map[string]string)
- func DefaultToday() string
- func DefaultTodayMHS() string
- func DefaultTodayTimeRange() string
- func DefaultYesterday() string
- func DefaultYesterdayTimeRange() string
- func DetectFileByteType(buf []byte) (extension, mime string, err error)
- func DetectFileType(filename string) (string, string, error)
- func DisplayByKey4Map(key interface{}, m map[interface{}]interface{}) (html string)
- func DivideRedPacket(count, amount int64)
- func DoubleAverage(count, amount int64) int64
- func Encrypter(source []byte, key []byte, iv []byte, paddingType int) ([]byte, error)
- func EnvDisplay() string
- func EsGeoLocation2LngLat(location string) (lng, lat string)
- func Escape(html string) string
- func ExcelConvertToFormatDay(excelDaysString string) string
- func Exists(file string) bool
- func ExtractUrls(s string) ([]string, error)
- func FeeRateTransform(origin float64) (after int64)
- func FieldByName(rv reflect.Value, colName string) reflect.Value
- func FileDownload(fileName, url string) (realFileName string, err error)
- func FixCountNum(in int) int
- func Float2Str(f float32) string
- func Float64TruncateWith2(num float64) (after float64, err error)
- func Float642Str(f float64) string
- func FullStack() string
- func Gbk2Utf8(s []byte) ([]byte, error)
- func GenOpenAvatar(openAvatar string) (avatar string)
- func GenRsaKey(publicKeyWriter, privateKeyWriter io.Writer, keyLength int) error
- func GenerateMobileCaptcha(length int) string
- func GenerateRandom(min, max int) int
- func GenerateRandom64(min, max int64) int64
- func GenerateRandomStr(length int) string
- func GeoIpCityEn(ipOrigin string) string
- func GeoIpCityZhCN(ipOrigin string) string
- func GeoipISOCountryCode(ipOrigin string) string
- func GetCurrentEnv() string
- func GetDate(timestamp int64) string
- func GetDateFormat(timestamp int64, format string) string
- func GetDateMH(timestamp int64) string
- func GetDateMHS(timestamp int64) string
- func GetDateParse(dates string) int64
- func GetDateParseBackend(dates string) int64
- func GetDateParses(dates string) int64
- func GetDateRange(begin, end int64) int64
- func GetDateRangeMillis(begin, end int64) int64
- func GetDateTimeBy5step(t int64) int64
- func GetDateTimeByBegin(t int64) int64
- func GetDateTimeParseBackend(dates string) int64
- func GetDistance(lat1, lng1, lat2, lng2 float64) float64
- func GetFileExt(filename string) (suffix string)
- func GetGuid() string
- func GetHourDateTime(t int64, h int) int64
- func GetIntKeysOfMap(mymap map[int]string) (keys []int)
- func GetLocalUploadPrefix() string
- func GetMP4Duration(reader io.ReaderAt) (lengthOfTime uint32, err error)
- func GetMonth(timetag int64) int64
- func GetMonthRange(timestamp int64) (begin, end int64)
- func GetS3Key(fileName string) string
- func GetTime(timestamp int64) string
- func GetTimeByTodaySecs(secs int) string
- func GetUnixMillis() int64
- func GetUnixMillisByTime(t time.Time) int64
- func GitRevParseHead() 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 InIntSlice(v int64, sl []int64) bool
- func InSlice(v string, sl []string) bool
- func InSliceIface(v interface{}, sl []interface{}) bool
- func IndexNumber(index int) int
- func Int2Str(number int) string
- func Int642Str(number int64) string
- func InternalApiDomain() string
- func InternalH5Domain() string
- func IntsSliceToWhereInString(intsSlice interface{}) (s string, err error)
- func IsDir(file string) bool
- func IsFile(file string) bool
- func IsInMap(m map[interface{}]interface{}, key interface{}) bool
- func IsInMapV2(key interface{}, m map[interface{}]interface{}) bool
- func IsIndonesiaName(name string) (valid bool)
- func IsInternalIPV1(ip string) bool
- func IsNumber(str string) (valid bool)
- func IsProductEnv() bool
- func IsStructContainsField(obj interface{}, field string) bool
- func IsValidIndonesiaMobile(mobile string) (yes bool, err error)
- func JSONMarshal(v interface{}) ([]byte, error)
- func JsonEncode(d interface{}) (jsonStr string, err error)
- func LocalHashDir(hashDir string) string
- func LocalYearMonth(timestamp int64) string
- func Long2IP4(ipLong int64) string
- func MDateMH(timestamp int64) string
- func MDateMHS(timestamp int64) string
- func MDateMHSBeijing(timestamp int64) string
- func MDateMHSLocalDate(timestamp int64) string
- func MDateMHSLocalDateAllNum(timestamp int64) string
- func MDateUTC(timestamp int64) string
- func Map2Form(param map[string]interface{}, encode bool) (form string)
- func Map2struct(data map[string]interface{}, result interface{}) error
- func MapSortKeyStr(params map[string]interface{}) string
- func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte
- func MaxInt64(x, y int64) int64
- func Md5(s string) string
- func Md5Bytes(buf []byte) string
- func MinInt64(x, y int64) int64
- func MobileDesensitization(src string) (dst string)
- func MobileFormat(mobile string) string
- func MobileMask(mobile string) string
- func MoneyDisplay(money int64) string
- func MoneyDisplayInt64(money int64) int64
- func MultipartClient(reqUrl string, queryString map[string]interface{}, ...) (originByte []byte, httpStatusCode int, err error)
- func NaturalDay(offset int64) (um int64)
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func NicknameMask(nickname string) string
- func NumberFormat(number interface{}) string
- func PKCS1InitPubKey(key []byte) (pub *rsa.PublicKey, err error)
- func PKCS1InitPubKeyPrivateDecrypt(encrypted string, pubkey string, privateKey []byte) (string, error)
- func PKCS1RsaEncrypt(data []byte, key []byte) ([]byte, error)
- func PKCS1Verify(key []byte, data string, sign string) error
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5PaddingECB(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS5UnPaddingECB(origData []byte) []byte
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(plantText []byte) []byte
- func ParseCookie(cookie, key string) (value string, err error)
- func ParseDateRangeToDayRange(dateRange string) (start, end int, err error)
- func ParseDateRangeToDayRangeWithSep(dateRange string, splitSep string) (int, int, error)
- func ParseMediaBaseInfo(rid int64, d []byte) (info types.MediaBaseInfo, 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 RsaDecrypt(ciphertext string) (string, error)
- func RsaEncrypt(origData []byte) (string, error)
- func ScoreDisplay(score int) string
- func SecretKeyMask(secretKey string) (str string)
- func SetByFields(aExt interface{}, colName string, dstValue interface{}) error
- func Sha1(data string) string
- func Sha256(data string) string
- func ShuffleStringList(list []string)
- func Signature(params map[string]interface{}, secret string) string
- func Signature4Struct(obj interface{}, secret string) string
- func Signature4StructV2(obj interface{}, secret string) string
- func SignatureV2(params map[string]interface{}, secret string) string
- func SimpleAnonymousHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string) ([]byte, int, error)
- func SimpleHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, ...) ([]byte, int, error)
- func SimpleHttpClientCert(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, ...) ([]byte, int, error)
- func SimpleHttpClientV2(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, ...) (header http.Header, body []byte, httpStatusCode int, err error)
- func SimpleHttpClientV3(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, ...) ([]byte, int, error)
- func SimpleNumStr2Num(s string) int
- func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
- func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
- func SliceInt64ToMap(s []int64) map[int64]interface{}
- func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
- func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
- func SliceRand(a []interface{}) (b interface{})
- func SliceRandList(min, max int) []int
- func SliceRange(start, end, step int64) (intslice []int64)
- func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
- func SliceRepeatVal(slice []interface{}) (repeatSlice []interface{})
- func SliceShuffle(slice []interface{}) []interface{}
- func SliceSum(intslice []int64) (sum int64)
- func SliceUnique(slice []interface{}) (uniqueslice []interface{})
- 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 Str2TimeByLayout(layout, timeStr string) int64
- func StrLen(s string) int
- func StrReplace(origin string, search []string, replace string) (s string)
- func StrTenThousand2MoneyMul100(money string) int64
- func Strim(str string) string
- func Stringify(obj interface{}) string
- func StringsContains(array []string, val string) (index int)
- func StripSlashes(str string) string
- func Struct2Form(obj interface{}, encode bool) (form string)
- func Struct2FormMap(obj interface{}, encode bool) map[string]string
- func Struct2Map(obj interface{}) map[string]interface{}
- func Struct2MapString(obj interface{}) map[string]string
- func Struct2MapV2(obj interface{}) map[string]interface{}
- func Struct2MapV3(obj interface{}) map[string]interface{}
- func SubString(s string, pos, length int) string
- func SubStringByPos(s string, sPos, ePos int) string
- func ThreeElementExpression(status bool, exp1 interface{}, exp2 interface{}) (result interface{})
- func TimeNow() int64
- func TimeStrFormat(timestr, fromFormat, toFormat string, unixtime bool) interface{}
- func ToSlice(arr interface{}) ([]interface{}, error)
- 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 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 VerifyHttpUserAgent(userAgent string) bool
- func VerifyMobile(mobile string) bool
- func WrapGenRsaKey(bits int) (publicKey, privateKey string, err error)
- func XPack()
- type BoxHeader
- type HttpTimeout
- type Location
- type XRsa
Constants ¶
const ( SecondAHour int64 = 3600 MillsSecondAHour = SecondAHour * 1000 SecondADay int64 = 86400 MillsSecondADay = SecondADay * 1000 MillsSecondAYear = MillsSecondADay * 365 )
const ( AesPKCS5 int = iota AesPKCS7 )
const ( HttpMethodGet string = "GET" HttpMethodPOST string = "POST" )
const ( CHAR_SET = "UTF-8" BASE_64_FORMAT = "UrlSafeNoPadding" RSA_ALGORITHM_KEY_TYPE = "PKCS8" //RSA_ALGORITHM_SIGN = crypto.SHA256 RSA_ALGORITHM_SIGN = crypto.SHA1 )
const ( ProductDomain = "https://api.4reasons.cn" DevDomain = "https://4reasons-api.yichehuzhu.com" ProductH5Domain = "https://h5.yichehuzhu.com" DevH5Domain = "https://h5-dev.yichehuzhu.com" )
const (
AesCBCIV string = "7816a1762a9a145c24726ea5790fe39a"
)
const EmptyRecord string = "-"
const MinWithdrawAmount int64 = 600
Variables ¶
This section is empty.
Functions ¶
func AddSlashes ¶
func AesDecrypt ¶
func AesDecryptCBCV2 ¶
func AesDecryptUrlCode ¶
func AesEncryptCBC ¶
包装过的简单加密函数
func AesEncryptECB ¶
func AesEncryptECBUrlEncode ¶
func ArrayToString ¶
将slice 转化成字符串 []int{1, 2, 3, 4, 5} => 1,2,3,4,5 或 []string{"1", "2", "3", "4", "5"} => 1,2,3,4,5 "AAA bbb" 转为 AAA,bbb 其他类型返回空字符串
func Base64URLDecode ¶
func Base64UrlSafeEncode ¶
func BuildEsGeoLocation ¶
func BuildFaceBookUserAvatar ¶
func BuildFileHashName ¶
BuildFileHashName 创建本地文件的hash名
func BuildHashName ¶
func BuildServiceFeeBody ¶
func BuildServiceFeeBody(amount int64) (body types.ServiceFeeBody)
func BuildUploadFileHashName ¶
为app端上传文件生成hash文件名
func BuildWithdrawBody ¶
func BuildWithdrawBody(total int64) (body types.WithdrawBody)
func CKEditorFullHtml ¶
func CalculateAgeByBirthday ¶
func ChangeValueByColName ¶
func ChangeValueByColName(aExt interface{}, colName string, dstValue interface{}) interface{}
通过反射更改结构体的值
func CheckRequiredParameter ¶
func CheckRequiredParameter(parameter map[string]interface{}, requiredParameter map[string]bool) bool
CheckRequiredParameter 通用的检查必要参数的方法,只检测参数存在,不关心参数值
func ClearOnSignal ¶
func ClearOnSignal(handler func())
func CoinDisplay ¶
func CoinDisplayFloat64 ¶
func CompareEquals ¶
func ContainNumber ¶
func Date2UnixMsec ¶
func DateParseYMDHMS ¶
DateParseYMDHMS 解析 YYYY-MM-DD HH:MM:SS 格式的时间串为Unix时间戳
func DecimalMoneyMul100 ¶
DecimalMoneyMul100 将带小数点的金额转换成数据库中的乘以100后的整数
func Default7DaysTimeRange ¶
func Default7DaysTimeRange() string
func DefaultReqHeaders ¶
func DefaultToday ¶
func DefaultToday() string
func DefaultTodayMHS ¶
func DefaultTodayMHS() string
func DefaultTodayTimeRange ¶
func DefaultTodayTimeRange() string
func DefaultYesterday ¶
func DefaultYesterday() string
func DefaultYesterdayTimeRange ¶
func DefaultYesterdayTimeRange() string
func DetectFileByteType ¶
func DisplayByKey4Map ¶
func DisplayByKey4Map(key interface{}, m map[interface{}]interface{}) (html string)
func DivideRedPacket ¶
func DivideRedPacket(count, amount int64)
func EnvDisplay ¶
func EnvDisplay() string
func EsGeoLocation2LngLat ¶
func ExcelConvertToFormatDay ¶
func ExtractUrls ¶
func FeeRateTransform ¶
func FileDownload ¶
func FixCountNum ¶
func Float64TruncateWith2 ¶
func Float642Str ¶
func GenOpenAvatar ¶
func GenerateRandomStr ¶
func GeoIpCityEn ¶
func GeoIpCityZhCN ¶
func GetCurrentEnv ¶
func GetCurrentEnv() string
func GetDateFormat ¶
func GetDateMHS ¶
func GetDateRange ¶
func GetDateRangeMillis ¶
func GetDateTimeParseBackend ¶
func GetIntKeysOfMap ¶
func GetLocalUploadPrefix ¶
func GetLocalUploadPrefix() string
func GetMP4Duration ¶
GetMP4Duration 获取视频时长,以秒计
func GetTimeByTodaySecs ¶
func GetUnixMillisByTime ¶
func GitRevParseHead ¶
func GitRevParseHead() string
func HmacSha256 ¶
func HumanMoney ¶
func HumanUnixMillis ¶
func HumanUnixMillisV2 ¶
func InIntSlice ¶
InIntSlice checks given string in string slice or not.
func InSliceIface ¶
func InSliceIface(v interface{}, sl []interface{}) bool
InSliceIface checks given interface in interface slice.
func InternalApiDomain ¶
func InternalApiDomain() string
func InternalH5Domain ¶
func InternalH5Domain() string
func IntsSliceToWhereInString ¶
IntsSliceToWhereInString 将状态或者IDs集合转换为string interface{}支持所有int, int8 etc.: %d
func IsInMap ¶
func IsInMap(m map[interface{}]interface{}, key interface{}) bool
IsInMap template辅助方法 key 是否在map中
func IsProductEnv ¶
func IsProductEnv() bool
func IsStructContainsField ¶
IsStructContainsField 判断结构体是否包含给定的字段 方法有点脆弱,不能传结构体指针!!!
func IsValidIndonesiaMobile ¶
IsValidIndonesiaMobile 是否是印尼的有效电话号 08 开头, 10-13位数字, 2018.08,有13位手机号段了 2018.11 增加15位手机号判断
func JSONMarshal ¶
直接json.Marshal , 会把 < > & 转成 unicode 编码 JSONMarshal 解决直接json.Marshal 后单引号,双引号,< > & 符号的问题
func JsonEncode ¶
func LocalYearMonth ¶
func MDateMHSLocalDate ¶
func MDateMHSLocalDateAllNum ¶
func Map2struct ¶
func MapSortKeyStr ¶
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte
func MobileDesensitization ¶
手机号脱敏处理(只保留前两位和后四位,中间的每个字符都替换为"*") 例如:08123456789 改为 08*****6789, 0812345645678 改为 08*******5678
func MobileMask ¶
func MoneyDisplay ¶
func MoneyDisplayInt64 ¶
func MultipartClient ¶
func MultipartClient(reqUrl string, queryString map[string]interface{}, reqHeaders map[string]string, files map[string]string, timeoutConf HttpTimeout) (originByte []byte, httpStatusCode int, err error)
支持post原始多文件上传,同时携带表单数据
func NaturalDay ¶
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 NicknameMask ¶
func PKCS5PaddingECB ¶
func PKCS5UnPadding ¶
func PKCS5UnPaddingECB ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func ParseCookie ¶
func ParseDateRangeToDayRange ¶
ParseDateRangeToDayRange 将时间范围字符串解析成毫秒时间戳 默认日期分隔符 " - " start, end, err
func ParseDateRangeToDayRangeWithSep ¶
PareseDateRangeToDayRangeWithSep 将时间范围字符串解析成毫秒时间戳 start, end, err
func ParseMediaBaseInfo ¶
func ParseMediaBaseInfo(rid int64, d []byte) (info types.MediaBaseInfo, err error)
func ParseTableName ¶
ParseTableName 从SQL语句中解析主表名
func ParseTargetList ¶
func PasswordEncrypt ¶
func PickRandomEmoji ¶
func PickRandomEmoji() string
func RFC3339TimeTransfer ¶
func RawUrlEncode ¶
func RealNameMask ¶
func RegRemoveScript ¶
func ReplaceInvalidRealName ¶
func ScoreDisplay ¶
func SecretKeyMask ¶
func SetByFields ¶
func ShuffleStringList ¶
func ShuffleStringList(list []string)
func Signature4Struct ¶
func Signature4StructV2 ¶
func SignatureV2 ¶
SignatureV2 空参数不参与签名
func SimpleAnonymousHttpClient ¶
func SimpleAnonymousHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string) ([]byte, int, error)
简单的http客户端,支持POST表单域,但不支持上传文件
func SimpleHttpClient ¶
func SimpleHttpClient(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, timeoutConf HttpTimeout) ([]byte, int, error)
简单的http客户端,支持POST表单域,但不支持上传文件
func SimpleHttpClientCert ¶
func SimpleHttpClientCert(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, timeoutConf HttpTimeout) ([]byte, int, error)
简单的http客户端,支持POST表单域,但不支持上传文件
func SimpleHttpClientV2 ¶
func SimpleHttpClientV3 ¶
func SimpleHttpClientV3(reqMethod string, reqUrl string, reqHeaders map[string]string, reqBody string, timeoutConf HttpTimeout) ([]byte, int, error)
简单的http客户端,支持POST表单域,但不支持上传文件
func SimpleNumStr2Num ¶
func SliceChunk ¶
func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
SliceChunk separates one slice to some sized slice.
func SliceDiff ¶
func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
SliceDiff returns diff slice of slice1 - slice2.
func SliceFilter ¶
func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
SliceFilter generates a new slice after filter function.
func SliceInt64ToMap ¶
SliceInt64ToMap 输出格式化数字,千分位以逗号分割
func SliceIntersect ¶
func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
SliceIntersect returns slice that are present in all the slice1 and slice2.
func SliceMerge ¶
func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
SliceMerge merges interface slices to one slice.
func SlicePad ¶
func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
SlicePad prepends size number of val into slice.
func SliceRand ¶
func SliceRand(a []interface{}) (b interface{})
SliceRand returns random one from slice.
func SliceRandList ¶
SliceRandList generate an int slice from min to max.
func SliceRange ¶
SliceRange generates a new slice from begin to end with step duration of int64 number.
func SliceReduce ¶
func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
SliceReduce generates a new slice after parsing every value by reduce function
func SliceRepeatVal ¶
func SliceRepeatVal(slice []interface{}) (repeatSlice []interface{})
SliceRepeatVal 获取数组中重复的值
func SliceUnique ¶
func SliceUnique(slice []interface{}) (uniqueslice []interface{})
SliceUnique 去掉重复的值
func SqlPlaceholderWithArray ¶
func Str2Float64 ¶
func Str2TimeByLayout ¶
Str2TimeByLayout 使用layout将时间字符串转unix时间戳(毫秒)
func StrReplace ¶
StrReplace 在 origin 中搜索 search 组,替换成 replace
func StringsContains ¶
func StripSlashes ¶
func Struct2FormMap ¶
func Struct2Map ¶
func Struct2Map(obj interface{}) map[string]interface{}
func Struct2MapString ¶
func Struct2MapV2 ¶
func Struct2MapV2(obj interface{}) map[string]interface{}
func Struct2MapV3 ¶
func Struct2MapV3(obj interface{}) map[string]interface{}
Struct2MapV3 结构体转map,有效防止了整型意外转科学记数法
func ThreeElementExpression ¶
func ThreeElementExpression(status bool, exp1 interface{}, exp2 interface{}) (result interface{})
func TimeStrFormat ¶
* 从一种时间格式转为另一种 ,或者转为时间戳 * @param timestr 即将处理的时间字符串 * @param fromFormat 当前时间格式 Mon, 02 Jan 2006 MST * @param toFormat 目标时间格式 2006-01-02 15:04:05 * @param fromFormat 当前时间格式 * @param unixtime 为真返回时间戳,否则正常转换时间格式 * @return string []byte
func TrimRealName ¶
func UnixMsec2Date ¶
func VerifyBirthday ¶
func VerifyHttpUserAgent ¶
func WrapGenRsaKey ¶
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