Versions in this module Expand all Collapse all v0 v0.1.1 Mar 22, 2021 Changes in this version + const Blue + const Day + const EndColor + const Gray + const Green + const Hour + const Magenta + const Minute + const Month + const Red + const UA_DEVICE_MOBILE + const UA_DEVICE_MOBILE_ANDROID + const UA_DEVICE_MOBILE_IPHONE + const UA_DEVICE_MOBILE_WINDOWS + const UA_DEVICE_PC + const UA_DEVICE_TABLE + const UA_DEVICE_TABLE_ANDROID_PAD + const UA_DEVICE_TABLE_IPAD + const UA_DEVICE_TABLE_IPOD + const UA_OS_LINUX + const UA_OS_MAC + const UA_OS_WINDOWS + const UA_UNKNOW + const Week + const Year + const Yellow + 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 struct + Childs []*FieldInfo + Index []int + Interface interface{} + Name string + Tag map[string]interface{} + Type string + Value reflect.Value + type FileInfo struct + Data []byte + Duration int64 + Filename string + Path string + Size int64 + func GetHttpRequestFile(req *http.Request, args ...int32) (*FileInfo, error) + func SaveHttpFile(req *http.Request, filename, basePath string, maxSize int32, args ...string) (*FileInfo, error) + type FileInfoList []*FileInfo + type FormFile struct + Datas io.Reader + FieldName string + FileName string + type FormFiles []FormFile + type HttpRequest struct + 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 struct + Data []byte + Header http.Header + Status string + StatusCode int + func (s *HttpResponse) GetData() []byte + func (s *HttpResponse) GetHeader() http.Header + func (s *HttpResponse) GetStatus() string + func (s *HttpResponse) GetStatusCode() int + type IFileSize interface + Size func() int64 + type IHttpRequest interface + Delete func(url string) (IHttpResponse, error) + Get func(url string) (IHttpResponse, error) + Post func(url string) (IHttpResponse, error) + Put func(url string) (IHttpResponse, error) + SetCookies func(cookies map[string]string) + SetData func(data map[string]string) + SetFiles func(files FormFiles) + SetHeaders func(headers map[string]string) + SetJson func(json interface{}) + SetParams func(params map[string]string) + SetUserAgent func(userAgent string) + func NewHttpRequest() IHttpRequest + type IHttpResponse interface + GetData func() []byte + GetHeader func() http.Header + GetStatus func() string + GetStatusCode func() int + type Keyword struct + Root *keywordNode + func NewKeyword() *Keyword + func (s *Keyword) AddKeyword(keyword string) + func (s *Keyword) AddKeywords(keywords ...string) + func (s *Keyword) Filter(content string, args ...string) string + type Mailer struct + func (m *Mailer) SendMail(to []string, subject, body string) bool + type MethodInfo struct + In []string + Index int + Name string + NumIn int + NumOut int + Out []string + Value reflect.Value + type Reflect struct + func NewReflect(target interface{}) *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 struct + func NewReflectFunc() *ReflectFunc + func (s *ReflectFunc) Call(key string, args ...interface{}) ([]reflect.Value, error) + func (s *ReflectFunc) Register(key string, fn interface{}) error + type StrTo string + 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 struct + func NewStringSet() *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 struct + func NewUserAgent(content string) *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 struct + func (s UserAgentDevice) GetChildName() string + func (s UserAgentDevice) GetContent() string + func (s UserAgentDevice) GetName() string + type UserAgentOs struct + func (s UserAgentOs) GetContent() string + func (s UserAgentOs) GetName() string