Documentation ¶
Overview ¶
Package com is an open source project for commonly used functions for the Go programming language.
Index ¶
- Constants
- func AESGCMDecrypt(key, ciphertext []byte) ([]byte, error)
- func AESGCMEncrypt(key, plaintext []byte) ([]byte, error)
- func AddDaysForCurrent(days int) time.Time
- func AddHoursForCurrent(hours int) time.Time
- func AddMinutesForCurrent(minutes int) time.Time
- func AesDecrypt(crypted, key []byte, args ...[]byte) ([]byte, error)
- func AesEncrypt(origData, key []byte, args ...[]byte) ([]byte, error)
- func AorB(condition bool, a, b string) string
- func AppendStr(strs []string, str string) []string
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func Br2String(source string) string
- func ColorLog(format string, a ...interface{})
- func ColorLogS(format string, a ...interface{}) string
- func Command(cmd string, args ...string) (string, error)
- func CompareSliceStr(s1, s2 []string) bool
- func CompareSliceStrU(s1, s2 []string) bool
- func CompareVersion(src, toCompare string) bool
- func CompressedHTML(h *template.HTML)
- func CopyDir(srcPath, destPath string, filters ...func(filePath string) bool) error
- func CopyMap(m map[string]string) map[string]string
- func CreateCurrentDateDir(rootPath string, perm os.FileMode) (string, error)
- func CreateDateDir(rootPath string, datetime time.Time, perm os.FileMode) (string, error)
- func CreateDir(perm os.FileMode, args ...string) (string, error)
- func CurrentTimeToString(args ...interface{}) string
- func CutVideoImage(sourceFile, newFilename string, width, height uint64, second, q int) (string, error)
- func Date(ti int64, format string) string
- func DateParse(dateString, format string) (time.Time, error)
- func DateS(ts string, format string) string
- func DateT(t time.Time, format string) string
- func DateToIntSlice(date time.Time) []int
- func DateToStringSlice(date time.Time) []string
- func DateToUnixNanoTimestamp(date time.Time) int64
- func DateToUnixTimestamp(date time.Time) int64
- func DatetimeAdd(firstDatetime time.Time, duration time.Duration) time.Time
- func DatetimeAddDay(firstDatetime time.Time, dayValue int) time.Time
- func DatetimeAddHour(firstDatetime time.Time, hourValue int) time.Time
- func DatetimeAddMinute(firstDatetime time.Time, minuteValue int) time.Time
- func DatetimeAddSecond(firstDatetime time.Time, secondValue int) time.Time
- func DatetimeSub(firstDatetime, secondDatetime time.Time) time.Duration
- func DeleteFile(filename string, args ...string) error
- func DesDecrypt(crypted, key []byte) ([]byte, error)
- func DesEncrypt(origData, key []byte) ([]byte, error)
- func EmailFilter(source string) string
- func ExecCmd(cmdName string, args ...string) (string, string, error)
- func ExecCmdBytes(cmdName string, args ...string) ([]byte, []byte, error)
- func ExecCmdDir(dir, cmdName string, args ...string) (string, string, error)
- func ExecCmdDirBytes(dir, cmdName string, args ...string) ([]byte, []byte, error)
- func Expand(template string, match map[string]string, subs ...string) string
- func FileIsExists(filename string) bool
- func FilterHostProtocol(path string) string
- func FilterInt64Slice(all, other []int64) []int64
- func FilterStringSlice(all, other []string) []string
- func FilterUint64Slice(all, other []uint64) []uint64
- func FindPid(processName string) (int, error)
- func Float64ToString(value float64) string
- func Fnv32Hash(content string) uint32
- func Fnv64Hash(content string) uint64
- func FromBase64(data string, args ...bool) (string, error)
- func FromJson(jsonString string, object interface{}) error
- func FromXml(xmlString string, object interface{}) error
- func GenRsaKey(bits int) (string, string, error)
- func GetAbsolutePath(filePath string) string
- func GetAllSubDirs(rootPath string) ([]string, error)
- func GetCurrentDay() int32
- func GetCurrentDayCount(args ...time.Time) int
- func GetCurrentHour() int32
- func GetCurrentMinute() int32
- func GetCurrentMonth() int32
- func GetCurrentMonthMaxDate(args ...time.Time) time.Time
- func GetCurrentMonthMaxNanoTimestamp(args ...time.Time) int64
- func GetCurrentMonthMaxTimestamp(args ...time.Time) int64
- func GetCurrentMonthMinDate(args ...time.Time) time.Time
- func GetCurrentMonthMinNanoTimestamp(args ...time.Time) int64
- func GetCurrentMonthMinTimestamp(args ...time.Time) int64
- func GetCurrentPath() string
- func GetCurrentSecond() int32
- func GetCurrentTime() time.Time
- func GetCurrentTimeStr() string
- func GetCurrentTimeUnix() int64
- func GetCurrentWeek() int
- func GetCurrentWeekDayRange() (int, int)
- func GetCurrentYear() int32
- func GetDateDay(datetime time.Time) int32
- func GetDateHour(datetime time.Time) int32
- func GetDateMinute(datetime time.Time) int32
- func GetDateMonth(datetime time.Time) int32
- func GetDateRangeForWeekInDateRange(startDate, endDate time.Time, week int) []time.Time
- func GetDateSecond(datetime time.Time) int32
- func GetDateYear(datetime time.Time) int32
- func GetDateYearMonthDay(args ...time.Time) int
- func GetDatetimeForDateAndTimeString(date time.Time, timeString string) time.Time
- func GetDatetimeWeekString(datetime time.Time) string
- func GetDayCount(datetime time.Time) int
- func GetField(v reflect.Value, i int) reflect.Value
- func GetFileContent(fullFilename string) ([]byte, error)
- func GetFileListBySuffix(dirPath, suffix string) ([]string, error)
- func GetFilePath(filePath string) (string, string)
- func GetFilename(filePath string) (string, string, string)
- func GetGOPATHs() []string
- func GetImageFile(filename string, args ...string) (image.Image, error)
- func GetMaxDate(dtTime time.Time) time.Time
- func GetMaxDateNanoTimestamp(dtTime time.Time) int64
- func GetMaxDateTimestamp(dtTime time.Time) int64
- func GetMinDate(dtTime time.Time) time.Time
- func GetMinDateNanoTimestamp(dtTime time.Time) int64
- func GetMinDateTimestamp(dtTime time.Time) int64
- func GetNow() time.Time
- func GetRelativePath(fullpath string) string
- func GetSeqNumber() string
- func GetSrcPath(importPath string) (appPath string, err error)
- func GetStringCount(sourceString string) int
- func GetStructFieldValueByName(model interface{}, fieldName string) (string, interface{}, error)
- func GetSubString(sourceString string, count int, args ...string) string
- func GetTimeIntervalStringSlice(startDate, endDate time.Time, minutes int64) []string
- func GetTokenString() string
- func GetUint64SliceRange(int64Slice []uint64, count int) []uint64
- func GetUrlParam(sourceUrl, paramName string) string
- func GetUtcNow() time.Time
- func GetWeek(datetime time.Time) int
- func Guid() string
- func HasPrefix(content, target string) bool
- func HasPrefixSuffix(content, target string) bool
- func HasSuffix(content, target string) bool
- func Hash(content string) uint64
- func HexStr2int(hexStr string) (int, error)
- func HmacSha1(data string, key string, args ...bool) string
- func HmacSha256(data string, key string, args ...bool) string
- func HomeDir() (home string, err error)
- func HtmlAudioFilter(source string) string
- func HtmlCssFilter(source string) string
- func HtmlDecode(source string, args ...bool) string
- func HtmlEncode(source string, args ...bool) string
- func HtmlHyperLinkFilter(source string) string
- func HtmlImageFilter(source string) string
- func HtmlScriptFilter(source string) string
- func HtmlTagFilter(source string) string
- func HtmlToPureText(html string) string
- func HtmlVideoFilter(source string) string
- func HttpGet(url string, args ...string) (string, error)
- func HttpPost(url, params string, args ...string) (string, error)
- func HttpPostFile(url, filename, fileTag string, params map[string]string) (int, map[string][]string, string, error)
- func IdCardNumFilter(source string) string
- func InArray(arr []string, str string) bool
- func Int2HexStr(num int) (hex string)
- func Int64Diff(one, two []int64) []int64
- func Int64Inter(one, two []int64) []int64
- func Int64SliceToString(intSlice []int64, args ...string) string
- func Int64SliceToStringSlice(values []int64) []string
- func Int64ToString(value int64) string
- func Int64Union(one, two []int64) []int64
- func IntSliceToDate(intSlice []int) (time.Time, error)
- func IsAlpha(sourceString string, args ...interface{}) bool
- func IsAlphaOrNumber(sourceString string) bool
- func IsChinese(sourceString string, args ...interface{}) bool
- func IsDateGreaterThan(firstDatetime, secondDatetime time.Time) bool
- func IsDateLessThan(firstDatetime, secondDatetime time.Time) bool
- func IsDir(dir string) bool
- func IsEmail(sourceString string, args ...interface{}) bool
- func IsIdCardNum(sourceString string) bool
- func IsJSON(str string) bool
- func IsLetter(l uint8) bool
- func IsLocalIp(ip string) (bool, error)
- func IsMatchStringSliceCount(srcSlice []string, maxCount, stringItemCount int) bool
- func IsMobile(sourceString string) bool
- func IsNumber(sourceString string, args ...interface{}) bool
- func IsRegexpMatch(sourceString string, pattern string) bool
- func IsSliceContainsInt64(sl []int64, i int64) bool
- func IsSliceContainsStr(sl []string, str string) bool
- func IsSql(source string) bool
- func IsTelphone(sourceString string) bool
- func IsUsername(sourceString string, args ...interface{}) bool
- func JSON(a interface{}) string
- func JoinMapToString(params map[string]string, filterKeys []string, isEscape bool) string
- func JsonToStruct(data string, value interface{}) error
- func LgetAllSubDirs(rootPath string) ([]string, error)
- func LstatDir(rootPath string, includeDir ...bool) ([]string, error)
- func Map64Hash(content string) uint64
- func MapDataSign(params map[string]string, secret string) (string, bool)
- func MarkdownImageFilter(source string) string
- func Md5(data string) string
- func Min(x, y int) int
- func MinutesToTimeString(minutes int64) string
- func MobileFilter(source string) string
- func ModFloat64(value float64, length int) float64
- func MonthsToSeasons(months []int32) []string
- func MoveFile(srcFilename, dstPath string, creationDate time.Time) (string, error)
- func NewStringTable(args ...int) *stringTable
- func NewkeywordNode() *keywordNode
- func Nonzero(v reflect.Value) bool
- func NumberToStringTable(id int64) string
- func PackageName(v interface{}) string
- func ParseBool(s string) bool
- func ParseFloat32(f string) float32
- func ParseHTML(name, tmpl string, param interface{}) template.HTML
- func ParseText(name, tmpl string, param interface{}) string
- func ParseTime(stringTime string) time.Time
- func Pkcs5Padding(ciphertext []byte, blockSize int) []byte
- func Pkcs5UnPadding(origData []byte) []byte
- func PowInt(x int, y int) int
- func ProcessID(processName string) (int, error)
- func ProcessStart(processName string) (string, error)
- func ProcessStop(processName string) (string, error)
- func QrCode(content string, args ...int) ([]byte, error)
- func QueryEncode(value string) string
- func RSADecrypt(cipherData, privateKey []byte) ([]byte, error)
- func RSAEncrypt(origData, publicKey []byte) ([]byte, error)
- func RandInt(maxInt int) int
- func RandIntRange(min, max int) int
- func RandNumberString(length int) string
- func RandString(length int) string
- func Random2(strings []string) ([]string, error)
- func RandomCreateBytes(n int, alphabets ...byte) []byte
- func ReplaceAll(s string, oldnew ...string) string
- func ReplaceNth(s, old, new string, n int) string
- func Reverse(s string) string
- func ReverseString(sourceString string) string
- func ReverseUint64Slice(int64Slice []uint64)
- func RsaPrivateToMultipleLine(privateKey string) string
- func RsaPublicToMultipleLine(privateKey string) string
- func SafeParam(source string) string
- func SafeString(source string) string
- func Salt() string
- func SaveFile(data []byte, filename, basePath string, args ...string) (string, error)
- func SetDefault(value, condition, def string) string
- func Sha1(data string) string
- func Sha256(data string) string
- func Sha256WithRsa(data string, privateKey string) (string, error)
- func Sha256WithRsaVerify(data, sign, publicKey string) (bool, error)
- func Shuffle(arr []int, args ...int)
- func Split(str, sep string) []string
- func SplitIpPort(ip string) (string, int)
- func SqlFilter(source string) string
- func StartProcess(processName string) (string, error)
- func StatDir(rootPath string, includeDir ...bool) ([]string, error)
- func StopProcess(processName string) (string, error)
- func String2Br(source string) string
- func StringDiff(one, two []string) []string
- func StringInter(one, two []string) []string
- func StringReplace(sourceString string, args ...string) string
- func StringSliceLatest(srcSlice []string, maxCount int) []string
- func StringSliceToDate(dateStringSlice []string) (time.Time, error)
- func StringSliceToInt64Slice(values []string) []int64
- func StringSliceToString(stringSlice []string, args ...string) string
- func StringSliceToUint64Slice(values []string) []uint64
- func StringTableToNumber(sourceString string) int64
- func StringToBool(stringValue string) bool
- func StringToFloat64(stringValue string) float64
- func StringToInt(e string) (int, error)
- func StringToInt32(stringValue string) int32
- func StringToInt64(stringValue string) int64
- func StringToInt64Slice(sourceString string, args ...string) []int64
- func StringToIntSlice(sourceString string, args ...string) []int
- func StringToStringSlice(sourceString string, args ...string) []string
- func StringToTime(datetimeString string, args ...interface{}) (time.Time, error)
- func StringToUint32(stringValue string) uint32
- func StringToUint64(stringValue string) uint64
- func StringToUint64Slice(sourceString string, args ...string) []uint64
- func StringUnion(one, two []string) []string
- func StructToJson(value interface{}) (res string, err error)
- func SubString(src string, start, end int) string
- func Substr(s string, pos, length int) string
- func TimeSincePro(then time.Time, m map[string]string) string
- func TimeStringAddMinutes(timeString string, minutes int) string
- func TimeToFriendString(datetime time.Time, args ...interface{}) string
- func TimeToString(datetime time.Time, args ...interface{}) string
- func TimeToUnix(e time.Time) int64
- func ToBase64(data string, args ...bool) string
- func ToJson(object interface{}) (string, error)
- func ToLowerUnderlinedNamer(name string) string
- func ToQueryString(values map[string]interface{}, args ...bool) string
- func ToSnakeCase(str string) string
- func ToStr(value interface{}, args ...int) (s string)
- func ToXml(object interface{}) (string, error)
- func TrimSpaceLine(source string) string
- func Try(fnSource func(), fnError func(interface{})) (er error)
- func Uint64Diff(one, two []uint64) []uint64
- func Uint64Inter(one, two []uint64) []uint64
- func Uint64SliceToString(uintSlice []uint64, args ...string) string
- func Uint64SliceToStringSlice(values []uint64) []string
- func Uint64ToString(value uint64) string
- func Uint64Union(one, two []uint64) []uint64
- func UnixDate() time.Time
- func UnixNanoTimestamp() int64
- func UnixNanoTimestampToDate(unixNanoTimestamp int64) time.Time
- func UnixTimestamp() int64
- func UnixTimestampDate() time.Time
- func UnixTimestampToDate(unixTimestamp int64) time.Time
- func UnixToTime(e string) (datatime time.Time, err error)
- func UrlDecode(str string) (string, error)
- func UrlEncode(str string) string
- func Uuid(length int64) string
- func WeekDay(t time.Time) string
- func WrapURL(u string) string
- type FieldInfo
- type FileInfo
- type FileInfoList
- type FormFile
- type FormFiles
- type HttpRequest
- func (s *HttpRequest) Delete(url string) (IHttpResponse, error)
- func (s *HttpRequest) Get(url string) (IHttpResponse, error)
- func (s *HttpRequest) Post(url string) (IHttpResponse, error)
- func (s *HttpRequest) Put(url string) (IHttpResponse, error)
- func (s *HttpRequest) SetCookies(cookies map[string]string)
- func (s *HttpRequest) SetData(data map[string]string)
- func (s *HttpRequest) SetFiles(files FormFiles)
- func (s *HttpRequest) SetHeaders(headers map[string]string)
- func (s *HttpRequest) SetJson(json interface{})
- func (s *HttpRequest) SetParams(params map[string]string)
- func (s *HttpRequest) SetUserAgent(userAgent string)
- type HttpResponse
- type IFileSize
- type IHttpRequest
- type IHttpResponse
- type Keyword
- type Mailer
- type MethodInfo
- type Reflect
- func (s *Reflect) Dump() string
- func (s *Reflect) Field(index int) (fieldValue reflect.Value, er error)
- func (s *Reflect) FieldByIndex(index []int) (fieldValue reflect.Value, er error)
- func (s *Reflect) FieldByName(name string) (reflect.Value, error)
- func (s *Reflect) FieldInfo(index int) (fieldInfo *FieldInfo, er error)
- func (s *Reflect) FieldInfoByIndex(index []int) (fieldInfo *FieldInfo, er error)
- func (s *Reflect) FieldInfoByName(name string) (*FieldInfo, error)
- func (s *Reflect) Fields() ([]*FieldInfo, error)
- func (s *Reflect) Interfce() interface{}
- func (s *Reflect) Invoke(methodName string, args ...interface{}) ([]reflect.Value, error)
- func (s *Reflect) IsAssignableTo(u reflect.Type) bool
- func (s *Reflect) IsComparable() bool
- func (s *Reflect) IsConvertibleTo(u reflect.Type) bool
- func (s *Reflect) IsImplements(u reflect.Type) bool
- func (s *Reflect) IsSlice() bool
- func (s *Reflect) IsStruct() bool
- func (s *Reflect) Kind() reflect.Kind
- func (s *Reflect) Method(index int) (reflect.Value, error)
- func (s *Reflect) MethodByName(name string) (reflect.Value, error)
- func (s *Reflect) MethodInfoByName(name string) (*MethodInfo, error)
- func (s *Reflect) Methods() []*MethodInfo
- func (s *Reflect) NumField() int
- func (s *Reflect) NumMethod() int
- func (s *Reflect) SetField(name string, value interface{}) error
- func (s *Reflect) Size() uintptr
- func (s *Reflect) Tag(index int) reflect.StructTag
- func (s *Reflect) Type() reflect.Type
- func (s *Reflect) Value() reflect.Value
- type ReflectFunc
- type StrTo
- func (f StrTo) Exist() bool
- func (f StrTo) Float64() (float64, error)
- func (f StrTo) Int() (int, error)
- func (f StrTo) Int64() (int64, error)
- func (f StrTo) MustFloat64() float64
- func (f StrTo) MustInt() int
- func (f StrTo) MustInt64() int64
- func (f StrTo) MustUint8() uint8
- func (f StrTo) String() string
- func (f StrTo) Uint8() (uint8, error)
- type StringSet
- func (set *StringSet) Add(i string) bool
- func (set *StringSet) Contains(i string) bool
- func (set *StringSet) Index(c string) int
- func (set *StringSet) ItemByIndex(idx int) string
- func (set *StringSet) Len() int
- func (set *StringSet) Remove(i string)
- func (set *StringSet) Sort()
- func (set *StringSet) String() string
- type UserAgent
- func (s *UserAgent) GetContent() string
- func (s *UserAgent) GetDevice() UserAgentDevice
- func (s *UserAgent) GetOs() UserAgentOs
- func (s *UserAgent) IsAndroid() bool
- func (s *UserAgent) IsAndroidPad() bool
- func (s *UserAgent) IsBlackBerry() bool
- func (s *UserAgent) IsChromeBrowser() bool
- func (s *UserAgent) IsFirfoxBrowser() bool
- func (s *UserAgent) IsIeBrowser() bool
- func (s *UserAgent) IsIpad() bool
- func (s *UserAgent) IsIphone() bool
- func (s *UserAgent) IsIpod() bool
- func (s *UserAgent) IsMobile() bool
- func (s *UserAgent) IsOperaBrowser() bool
- func (s *UserAgent) IsPc() bool
- func (s *UserAgent) IsSafariBrowser() bool
- func (s *UserAgent) IsTable() bool
- func (s *UserAgent) IsWindowsPhone() bool
- type UserAgentDevice
- type UserAgentOs
Examples ¶
Constants ¶
const ( Gray = uint8(iota + 90) Red Green Yellow Blue Magenta //NRed = uint8(31) // Normal EndColor = "\033[0m" )
Color number constants.
const ( UA_DEVICE_PC string = "pc" UA_DEVICE_TABLE string = "table" UA_DEVICE_TABLE_IPAD string = "ipad" UA_DEVICE_TABLE_IPOD string = "ipod" UA_DEVICE_TABLE_ANDROID_PAD string = "apad" UA_DEVICE_MOBILE string = "mobile" UA_DEVICE_MOBILE_IPHONE string = "iphone" UA_DEVICE_MOBILE_ANDROID string = "android" UA_DEVICE_MOBILE_WINDOWS string = "winphone" UA_OS_WINDOWS string = "windows" UA_OS_MAC string = "mac" UA_OS_LINUX string = "linux" UA_UNKNOW string = "unknow" )
================================================================================ * 用户浏览代理 * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================
const ( Minute = 60 Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month )
Seconds-based time units
Variables ¶
This section is empty.
Functions ¶
func AESGCMDecrypt ¶
AESGCMDecrypt decrypts ciphertext with the given key using AES in GCM mode.
func AESGCMEncrypt ¶
AESGCMEncrypt encrypts plaintext with the given key using AES in GCM mode.
func AddMinutesForCurrent ¶
* 在当前的日期时间增加指定的分钟数,返回日期时间 *
func AesDecrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Aes解密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func AesEncrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Aes加密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func AppendStr ¶
AppendStr appends string to slice with no duplicates.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { s := []string{"a"} s = util.AppendStr(s, "a") s = util.AppendStr(s, "b") fmt.Println(s) }
Output: [a b]
func Br2String ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 换行转br标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ColorLog ¶
func ColorLog(format string, a ...interface{})
ColorLog prints colored log to stdout. See color rules in function 'ColorLogS'.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { util.ColorLog(fmt.Sprintf( "[WARN] This is a tesing log that should be colored, path( %s ),"+ " highlight # %s #, error [ %s ].", "path to somewhere", "highlighted content", "tesing error")) }
Output:
func ColorLogS ¶
ColorLogS colors log and return colored content. Log format: <level> <content [highlight][path]> [ error ]. Level: TRAC -> blue; ERRO -> red; WARN -> Magenta; SUCC -> green; others -> default. Content: default; path: yellow; error -> red. Level has to be surrounded by "[" and "]". Highlights have to be surrounded by "# " and " #"(space), "#" will be deleted. Paths have to be surrounded by "( " and " )"(space). Errors have to be surrounded by "[ " and " ]"(space). Note: it hasn't support windows yet, contribute is welcome.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { coloredLog := util.ColorLogS(fmt.Sprintf( "[WARN] This is a tesing log that should be colored, path( %s ),"+ " highlight # %s #, error [ %s ].", "path to somewhere", "highlighted content", "tesing error")) fmt.Println(coloredLog) }
Output:
func Command ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 运行命令 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func CompareSliceStr ¶
CompareSliceStr compares two 'string' type slices. It returns true if elements and order are both the same.
func CompareSliceStrU ¶
CompareSliceStrU compares two 'string' type slices. It returns true if elements are the same, and ignores the order.
func CompareVersion ¶
func CompressedHTML ¶
func CopyDir ¶
CopyDir copy files recursively from source to target directory.
The filter accepts a function that process the path info. and should return true for need to filter.
It returns error when error occurs in underlying functions.
func CreateCurrentDateDir ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据当前日期在指定根目录下创建多级目录 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func CreateDateDir ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据指定的日期在指定的目录下创建多级目录 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func CreateDir ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 创建多级目录 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func CutVideoImage ¶
func CutVideoImage(sourceFile, newFilename string, width, height uint64, second, q int) (string, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 从视频文件截取图片 * ffmpeg -i ./test.mp4 -ss 00:00:01 -s 120*120 -r 1 -q:v 2 -f image2 -vframes 1 image-%2d.jpg * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func DateT ¶
Format time.Time struct to string MM - month - 01 M - month - 1, single bit DD - day - 02 D - day 2 YYYY - year - 2006 YY - year - 06 HH - 24 hours - 03 H - 24 hours - 3 hh - 12 hours - 03 h - 12 hours - 3 mm - minute - 04 m - minute - 4 ss - second - 05 s - second = 5
func DateToUnixNanoTimestamp ¶
* 获取指定日期的Unix纳秒时间戳 *
func DatetimeAdd ¶
* firstDatetime加上时间间隔duration,返回日期时间 *
func DatetimeAddDay ¶
* firstDatetime加上指定的天数,返回日期时间 *
func DatetimeAddHour ¶
* firstDatetime加上指定的小时数,返回日期时间 *
func DatetimeAddMinute ¶
* firstDatetime加上指定的分钟数,返回日期时间 *
func DatetimeAddSecond ¶
* firstDatetime加上指定的秒数,返回日期时间 *
func DatetimeSub ¶
* firstDatetime减去secondDatetime,返回时间间隔 *
func DeleteFile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 删除文件 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func DesDecrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Des解密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func DesEncrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Des加密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func EmailFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 电子邮件过滤 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ExecCmd ¶
ExecCmd executes system command and return stdout, stderr in string type, along with possible error.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { stdout, stderr, err := util.ExecCmd("go", "help", "get") fmt.Println(stdout, stderr, err) }
Output:
func ExecCmdBytes ¶
ExecCmdBytes executes system command and return stdout, stderr in bytes type, along with possible error.
func ExecCmdDir ¶
ExecCmdDir executes system command in given directory and return stdout, stderr in string type, along with possible error.
func ExecCmdDirBytes ¶
ExecCmdDirBytes executes system command in given directory and return stdout, stderr in bytes type, along with possible error.
func Expand ¶
Expand replaces {k} in template with match[k] or subs[atoi(k)] if k is not in match.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { match := map[string]string{ "domain": "gowalker.org", "subdomain": "github.com", } s := "http://{domain}/{subdomain}/{0}/{1}" fmt.Println(util.Expand(s, match, "unknwon", "gowalker")) }
Output: http://gowalker.org/github.com/unknwon/gowalker
func FileIsExists ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断文件是否存在 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FilterHostProtocol ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤主机协议 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FilterInt64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤int64数组(从all中过滤所有other中的数据,返回未被过滤的数据集合) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FilterStringSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤字符数组(从all中过滤所有other中的数据,返回未被过滤的数据集合) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FilterUint64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤uint64数组(从all中过滤所有other中的数据,返回未被过滤的数据集合) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FindPid ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据进程名称找到对应的pid * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Float64ToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 浮点64转为字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Fnv32Hash ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串fnv哈希返回uint32数值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Fnv64Hash ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串fnv哈希返回uint64数值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FromBase64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Base64字符解码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FromJson ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Json字符串转换成对象 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func FromXml ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Xml字符串转换成对象 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GenRsaKey ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 生成RsaKey * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetAbsolutePath ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取文件绝对全路径 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetAllSubDirs ¶
GetAllSubDirs returns all subdirectories of given root path. Slice does not include given path itself.
func GetCurrentMonthMaxDate ¶
* 获取当月里最大日期时间(2016-01-02 23:59:59 999999999) *
func GetCurrentMonthMaxNanoTimestamp ¶
* 获取当月里最大日期时间戳(当月最后一天最大时间),单位纳秒 *
func GetCurrentMonthMaxTimestamp ¶
* 获取当月里最大日期时间戳(当月最后一天最大时间),单位秒 *
func GetCurrentMonthMinDate ¶
* 获取当月里最小日期时间(2016-01-01 0:0:0 0) *
func GetCurrentMonthMinNanoTimestamp ¶
* 获取当月里最小日期时间戳(当月第一天最小时间),单位纳秒 *
func GetCurrentMonthMinTimestamp ¶
* 获取当月里最小日期时间戳(当月第一天最小时间),单位秒 *
func GetCurrentPath ¶
func GetCurrentPath() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取当前文件执行的全路径 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetCurrentTime ¶
func GetCurrentTimeStr ¶
func GetCurrentTimeStr() string
func GetCurrentTimeUnix ¶
func GetCurrentTimeUnix() int64
func GetCurrentWeekDayRange ¶
* 获取当前周对应的月份里的日期范围(minDay in month, maxDay in month) *
func GetDateRangeForWeekInDateRange ¶
* 获取日期范围内的所属周几的日期集合 * week:从1开始,1表示周一,依次类推 *
func GetDatetimeForDateAndTimeString ¶
* 日期时间的日期部分和时间字符串连接,返回日期时间 *
func GetDatetimeWeekString ¶
* 获取日期时间的日期和星期字符串 *
func GetFileContent ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取文件内容 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetFileListBySuffix ¶
GetFileListBySuffix returns an ordered list of file paths. It recognize if given path is a file, and don't do recursive find.
func GetFilePath ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取路径里的路径和文件名 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetFilename ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取路径里的文件名,不带扩展名的文件名,扩展名 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetGOPATHs ¶
func GetGOPATHs() []string
GetGOPATHs returns all paths in GOPATH variable.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { gps := util.GetGOPATHs() fmt.Println(gps) }
Output:
func GetImageFile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取图片文件 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetMaxDate ¶
* 返回日期的最大日期时间(2016-01-02 23:59:59 999999999) *
func GetMaxDateNanoTimestamp ¶
* 获取日期的最大日期时间戳,单位纳秒 *
func GetMinDateNanoTimestamp ¶
* 获取日期的最小日期时间戳,单位纳秒 *
func GetRelativePath ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取全文件路径的相对路径 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetSeqNumber ¶
func GetSeqNumber() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取当前日期流水字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetSrcPath ¶
GetSrcPath returns app. source code path. It only works when you have src. folder in GOPATH, it returns error not able to locate source folder path.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { srcPath, err := util.GetSrcPath("github.com/unknwon/com") if err != nil { fmt.Println(err) return } fmt.Println(srcPath) }
Output:
func GetStringCount ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取字符串个数(不是字节数) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetStructFieldValueByName ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据结构体和字段名获取对应的包名和字段值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetSubString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取指定长度的字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetTimeIntervalStringSlice ¶
* 获取一段时间范围内指定间隔的时间段集合 *
func GetTokenString ¶
func GetTokenString() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取当前唯一Token字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetUint64SliceRange ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取指定个数的uint64slice * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func GetUrlParam ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取url里指定参数的值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Guid ¶
func Guid() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 唯一Guid * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HasPrefix ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断内容字符串头是否包含指定的字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HasPrefixSuffix ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断内容字符串头尾是否包含指定的字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HasSuffix ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断内容字符串尾是否包含指定的字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Hash ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串哈希返回uint64数值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HexStr2int ¶
HexStr2int converts hex format string to decimal number.
func HmacSha1 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Hmac Sha1哈希 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HmacSha256 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Hmac Sha256哈希 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HomeDir ¶
HomeDir returns path of '~'(in Linux) on Windows, it returns error when the variable does not exist.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { hd, err := util.HomeDir() fmt.Println(hd, err) }
Output:
func HtmlAudioFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html audio标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlCssFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html css标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlDecode ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * html解码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlEncode ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * html编码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlHyperLinkFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html超链接标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlImageFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html img标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlScriptFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html script标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlTagFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HtmlToPureText ¶
func HtmlVideoFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤html video标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HttpGet ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http Get请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HttpPost ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http POST请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func HttpPostFile ¶
func HttpPostFile(url, filename, fileTag string, params map[string]string) (int, map[string][]string, string, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 上传文件 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IdCardNumFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 身份证号过滤 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int2HexStr ¶
Int2HexStr converts decimal number to hex format string.
func Int64Diff ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * int64差集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int64Inter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * int64交集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int64SliceToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串把int64切片链接为字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int64SliceToStringSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 整型64切片转为字符串切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int64ToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 整型64转为字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Int64Union ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * int64并集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsAlpha ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否英文单词 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsAlphaOrNumber ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否英文单词或数字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsChinese ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否中文 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsDateGreaterThan ¶
* 判断firstDatetime是否在secondDatetime的后面,即firstDatetime比secondDatetime日期大 *
func IsDateLessThan ¶
* 判断firstDatetime是否在secondDatetime的前面,即firstDatetime比secondDatetime日期小 *
func IsDir ¶
IsDir returns true if given path is a directory, or returns false when it's a file or does not exist.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { if util.IsDir("files") { fmt.Println("directory 'files' exists") return } fmt.Println("'files' is not a directory or does not exist") }
Output:
func IsEmail ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否电子邮件 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { fmt.Println(util.IsEmail("test@example.com")) fmt.Println(util.IsEmail("@example.com")) }
Output: true false
func IsIdCardNum ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否身份证号码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsLetter ¶
IsLetter returns true if the 'l' is an English letter.
Example ¶
package main import ( "fmt" "github.com/qtoad/myxd-gokit/util" ) func main() { fmt.Println(util.IsLetter('1')) fmt.Println(util.IsLetter('[')) fmt.Println(util.IsLetter('a')) fmt.Println(util.IsLetter('Z')) }
Output: false false true true
func IsLocalIp ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否本地Ip * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsMatchStringSliceCount ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断字符串切片及单个项的字符数是否匹配指定大小, * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsMobile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否手机号码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsNumber ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否数字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsRegexpMatch ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 正则是否匹配 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsSliceContainsInt64 ¶
IsSliceContainsInt64 returns true if the int64 exists in given slice.
func IsSliceContainsStr ¶
IsSliceContainsStr returns true if the string exists in given slice, ignore case.
func IsSql ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否sql * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsTelphone ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否电话号码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func IsUsername ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否用户名(以英文字母开头,后面跟英文字母和数据以及下划线) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func JoinMapToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字典参数升序排序,组成键=值集合,然后把集合用&拼接成字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func JsonToStruct ¶
func LgetAllSubDirs ¶
LgetAllSubDirs returns all subdirectories of given root path, including following symbolic links, if any. Slice does not include given path itself.
func LstatDir ¶
LstatDir gathers information of given directory by depth-first. It returns slice of file list, follows symbolic links and includes subdirectories if enabled; it returns error and nil slice when error occurs in underlying functions, or given path is not a directory or does not exist.
Slice does not include given path itself. If subdirectories is enabled, they will have suffix '/'.
func Map64Hash ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串map哈希返回uint64数值 * 同一个输入字符串每次MapHash返回值会动态变化 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func MapDataSign ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 签名算法 * params里的每个Value都需要进行url编码 * fmt.Sprintf("%s=%s", key, url.QueryEscape(value)) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func MarkdownImageFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 过滤markdown img标记 * ![](http://a.b.com/s/1/000002/wKgAA1oAjnCAOrkgAADQl5vsv_s123.jpg) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Md5 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Md5哈希 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func MobileFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 手机号过滤 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ModFloat64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 保留浮点数指定长度的小数位数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func MoveFile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 移动文件(全路径源文件,目的路径,日期,会根据日期自动创建路径然后连接到目的路径后) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewStringTable ¶
func NewStringTable(args ...int) *stringTable
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 初始化实例 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewkeywordNode ¶
func NewkeywordNode() *keywordNode
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 新节点 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NumberToStringTable ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 数字映射字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func PackageName ¶
func PackageName(v interface{}) string
func ParseFloat32 ¶
func Pkcs5Padding ¶
func Pkcs5UnPadding ¶
func QrCode ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取二维码图片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func QueryEncode ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Query编码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RSADecrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Rsa解密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RSAEncrypt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Rsa加密 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RandInt ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * maxInt以内的随机数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RandIntRange ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * min,max范围内的随机数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RandNumberString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 指定长度的随机数字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RandString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 随机英文和数字字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RandomCreateBytes ¶
RandomCreateBytes generate random []byte by specify chars.
func ReplaceAll ¶
func ReplaceNth ¶
func ReverseString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 翻转字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ReverseUint64Slice ¶
func ReverseUint64Slice(int64Slice []uint64)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 翻转uint64 Slice * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RsaPrivateToMultipleLine ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 将单行的Ras Private字符串格式化为多行格式 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func RsaPublicToMultipleLine ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 将单行的Ras Public字符串格式化为多行格式 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SafeParam ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 安全参数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SafeString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 安全字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Salt ¶
func Salt() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 随机Salt * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SaveFile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 保存文件 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SetDefault ¶
func Sha1 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Sha1哈希 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Sha256 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Sha256哈希 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Sha256WithRsa ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Sha256WithRsa签名 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Sha256WithRsaVerify ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Sha256WithRsa验签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Shuffle ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 整型数组随机打乱 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SplitIpPort ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 分隔Ip和端口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SqlFilter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * sql过滤 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StartProcess ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 运行指定的进程 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StatDir ¶
StatDir gathers information of given directory by depth-first. It returns slice of file list and includes subdirectories if enabled; it returns error and nil slice when error occurs in underlying functions, or given path is not a directory or does not exist.
Slice does not include given path itself. If subdirectories is enabled, they will have suffix '/'.
func StopProcess ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 杀死指定pid进程 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func String2Br ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 换行转br标签 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringDiff ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符集合的差集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringInter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符集合的交集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringReplace ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串替换 * sourceString: 原始字符串 * args[0...n-2]: 被替换字符串集合 * args[n-1]: 替换字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringSliceLatest ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 保留指定长度字符串切片,前面的数据移除 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringSliceToDate ¶
* 日期字符串切片转成日期 *
func StringSliceToInt64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串切片转为整型64切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringSliceToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串链接字符串切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringSliceToUint64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串切片转为无符号整型64切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringTableToNumber ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串映射数字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToBool ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为bool * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToFloat64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为float64 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToInt ¶
func StringToInt32 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为int32 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToInt64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为int64 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToInt64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串把源字符串分隔为int64切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToIntSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串把源字符串分隔为int切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToStringSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串分隔源字符串为字符串切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToTime ¶
* 字符串转时间 * isUtc参数决定传入的日期字符串是否是utc日期 * isUtc:bool | format:string * 返回UTC日期 *
func StringToUint32 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为uint32 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToUint64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符串转换为uint64 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringToUint64Slice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串把源字符串分隔为uint64切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StringUnion ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字符集合的并集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func StructToJson ¶
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
func TimeStringAddMinutes ¶
* 时间字符串加指定的分钟数,返回时间字符串 *
func TimeToFriendString ¶
* 日期时间转换成友好的显示字符串 * isUtc:bool | format:string *
func ToBase64 ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Base64字符编码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ToJson ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 对象转换成Json字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ToLowerUnderlinedNamer ¶
ToLowerUnderlinedNamer 转换为小写下划线命名
func ToQueryString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 字典转URL查询字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func ToSnakeCase ¶
ToSnakeCase can convert all upper case characters in a string to underscore format.
Some samples.
"FirstName" => "first_name" "HTTPServer" => "http_server" "NoHTTPS" => "no_https" "GO_PATH" => "go_path" "GO PATH" => "go_path" // space is converted to underscore. "GO-PATH" => "go_path" // hyphen is converted to underscore.
func ToXml ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 对象转换成Xml字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func TrimSpaceLine ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 去除连续的换行符 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Try ¶
func Try(fnSource func(), fnError func(interface{})) (er error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 捕获函数执行时的异常 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64Diff ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * uint64差集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64Inter ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * uint64交集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64SliceToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 用指定的字符串把uint64切片链接为字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64SliceToStringSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 无符号整型64切片转为字符串切片 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64ToString ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 无符号整型64转为字符串 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func Uint64Union ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * uint64并集合 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func UnixNanoTimestampToDate ¶
* 根据Unix纳秒时间戳返回日期 *
func UnixTimestampToDate ¶
* 根据Unix时间戳返回日期 *
Types ¶
type FieldInfo ¶
type FieldInfo struct { Index []int Name string Tag map[string]interface{} Type string Value reflect.Value Interface interface{} Childs []*FieldInfo }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type FileInfo ¶
type FileInfo struct { Filename string `form:"filename" json:"filename"` //原始文件名(test.jpg) Data []byte `form:"data" json:"data"` //文件字节切片 Size int64 `form:"size" json:"size"` //大小(单位:字节) Duration int64 `form:"duration" json:"duration"` //时长(单位:秒) Path string `form:"path" json:"path"` //全路径(本地磁盘或第三方文件系统) }
================================================================================ * 文件 * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================
func GetHttpRequestFile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取Http请求里的文件数据 * maxSize: 文件大小限制,0表示不限制 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func SaveHttpFile ¶
func SaveHttpFile(req *http.Request, filename, basePath string, maxSize int32, args ...string) (*FileInfo, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 保存Http 上传的文件到磁盘指定目录(返回客户端原文件名,大小,全文件路径,错误) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type FileInfoList ¶
type FileInfoList []*FileInfo
================================================================================ * 文件 * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================
type FormFiles ¶
type FormFiles []FormFile
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http表单文件数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type HttpRequest ¶
type HttpRequest struct {
// contains filtered or unexported fields
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http请求数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Delete ¶
func (s *HttpRequest) Delete(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Delete请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Get ¶
func (s *HttpRequest) Get(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Get请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Post ¶
func (s *HttpRequest) Post(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Post请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) Put ¶
func (s *HttpRequest) Put(url string) (IHttpResponse, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Put请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetCookies ¶
func (s *HttpRequest) SetCookies(cookies map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置Cookie * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetData ¶
func (s *HttpRequest) SetData(data map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置字典数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetFiles ¶
func (s *HttpRequest) SetFiles(files FormFiles)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置文件数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetHeaders ¶
func (s *HttpRequest) SetHeaders(headers map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetJson ¶
func (s *HttpRequest) SetJson(json interface{})
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置Json数据 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetParams ¶
func (s *HttpRequest) SetParams(params map[string]string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置参数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpRequest) SetUserAgent ¶
func (s *HttpRequest) SetUserAgent(userAgent string)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置用户代理http头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type HttpResponse ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http响应数据结构 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetData ¶
func (s *HttpResponse) GetData() []byte
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取请求内容 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetHeader ¶
func (s *HttpResponse) GetHeader() http.Header
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取请求头 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetStatus ¶
func (s *HttpResponse) GetStatus() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取状态描述 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*HttpResponse) GetStatusCode ¶
func (s *HttpResponse) GetStatusCode() int
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取状态码 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type IFileSize ¶
type IFileSize interface {
Size() int64
}
================================================================================ * 文件 * qq group: 582452342 * email : 2091938785@qq.com * author : 美丽的地球啊 - mliu * ================================================================================
type IHttpRequest ¶
type IHttpRequest interface { Get(url string) (IHttpResponse, error) Post(url string) (IHttpResponse, error) Put(url string) (IHttpResponse, error) Delete(url string) (IHttpResponse, error) SetUserAgent(userAgent string) SetHeaders(headers map[string]string) SetParams(params map[string]string) SetCookies(cookies map[string]string) SetJson(json interface{}) SetData(data map[string]string) SetFiles(files FormFiles) }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http请求接口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewHttpRequest ¶
func NewHttpRequest() IHttpRequest
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 初始化Http请求 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type IHttpResponse ¶
type IHttpResponse interface { GetData() []byte GetHeader() http.Header GetStatusCode() int GetStatus() string }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Http响应接口 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type Keyword ¶
type Keyword struct {
Root *keywordNode
}
func NewKeyword ¶
func NewKeyword() *Keyword
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 新关键词 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Keyword) AddKeyword ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 增加关键字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Keyword) AddKeywords ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 增加关键字 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type MethodInfo ¶
type MethodInfo struct { Index int Name string Value reflect.Value NumIn int NumOut int In []string Out []string }
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type Reflect ¶
type Reflect struct {
// contains filtered or unexported fields
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewReflect ¶
func NewReflect(target interface{}) *Reflect
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 实例化Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Dump ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 输出信息 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Field ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引获取字段reflect.Value * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) FieldByIndex ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引链获取字段reflect.Value * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) FieldByName ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据名称获取字段字段reflect.Value * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) FieldInfo ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引获取字段*FieldInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) FieldInfoByIndex ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引链获取字段*FieldInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) FieldInfoByName ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据名称获取字段*FieldInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Fields ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取字段集合[]*FieldInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Interfce ¶
func (s *Reflect) Interfce() interface{}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 对象信息 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Invoke ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 调用指定名称的方法 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsAssignableTo ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断类型的值可否赋值给 u 类型 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsComparable ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断类型的值可否进行比较操作 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsConvertibleTo ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断类型的值可否转换为 u 类型 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsImplements ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否实现了 u 接口。 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsSlice ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否切片对象 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) IsStruct ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 是否结构对象 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Kind ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 类型类别 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Method ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引获取方法reflect.Value * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) MethodByName ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据名称获取方法reflect.Value * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) MethodInfoByName ¶
func (s *Reflect) MethodInfoByName(name string) (*MethodInfo, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据名称获取方法*MethodInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Methods ¶
func (s *Reflect) Methods() []*MethodInfo
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取方法集合[]*MethodInfo * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) NumField ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取字段数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) NumMethod ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取方法数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) SetField ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 设置字段值 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Size ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 类型大小 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*Reflect) Tag ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 根据索引获取字段reflect.StructTag * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type ReflectFunc ¶
type ReflectFunc struct {
// contains filtered or unexported fields
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func NewReflectFunc ¶
func NewReflectFunc() *ReflectFunc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 实例化ReflectFunc * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*ReflectFunc) Call ¶
func (s *ReflectFunc) Call(key string, args ...interface{}) ([]reflect.Value, error)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 动态调用函数 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*ReflectFunc) Register ¶
func (s *ReflectFunc) Register(key string, fn interface{}) error
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 注册Reflect * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type StringSet ¶
type StringSet struct {
// contains filtered or unexported fields
}
StringSet is string sets val
type UserAgent ¶
type UserAgent struct {
// contains filtered or unexported fields
}
func NewUserAgent ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 初始化UserAgent * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) GetContent ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取原始信息 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) GetDevice ¶
func (s *UserAgent) GetDevice() UserAgentDevice
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取设备 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) GetOs ¶
func (s *UserAgent) GetOs() UserAgentOs
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取操作系统 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsAndroid ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Android * Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsAndroidPad ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Android Pad * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsBlackBerry ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否BlackBerry * Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.337 Mobile Safari/534.1+ * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsChromeBrowser ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Chrome Browser * Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsFirfoxBrowser ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Firefox Browser * Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:66.0) Gecko/20100101 Firefox/66.0 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsIeBrowser ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否IE Browser * Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsIpad ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Ipad * Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsIphone ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Iphone * Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsIpod ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Ipod * Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsMobile ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Mobile * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsOperaBrowser ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Opera Browser * Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.8.131 Version/11.11 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsPc ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Pc * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsSafariBrowser ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Safari Browser * Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsTable ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Table * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (*UserAgent) IsWindowsPhone ¶
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 判断是否Windows Phone * Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; HTC; Titan) * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type UserAgentDevice ¶
type UserAgentDevice struct {
// contains filtered or unexported fields
}
func (UserAgentDevice) GetChildName ¶
func (s UserAgentDevice) GetChildName() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取设备子名称 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (UserAgentDevice) GetContent ¶
func (s UserAgentDevice) GetContent() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取设备信息 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (UserAgentDevice) GetName ¶
func (s UserAgentDevice) GetName() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取设备名称 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
type UserAgentOs ¶
type UserAgentOs struct {
// contains filtered or unexported fields
}
func (UserAgentOs) GetContent ¶
func (s UserAgentOs) GetContent() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取操作系统信息 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
func (UserAgentOs) GetName ¶
func (s UserAgentOs) GetName() string
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * 获取操作系统名称 * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++