Documentation ¶
Index ¶
- Constants
- func Base64decode(in string) (string, error)
- func Base64encode(in string) string
- func BytesToString(b []byte) string
- func CheckStandardMail(src string) bool
- func CheckStringIsExist(source string, check []string) bool
- func ConvertToString(src string, srcCode string, tagCode string) string
- func CurrentUsername() string
- func FileSize(s int64) string
- func FilterAddressBody(src string) string
- func GetHttpData(url string) (string, error)
- func GetRealMail(src string) string
- func HexStr2int(hexStr string) (int, error)
- func Int2HexStr(num int) (hex string)
- func IsDir(dir string) bool
- func IsExist(path string) bool
- func IsFile(path string) bool
- func IsMaliciousPath(path string) bool
- func IsNumeric(val interface{}) bool
- func IsSameSiteURLPath(url string) bool
- func Md5(s string) string
- func Md5Byte(buf []byte) string
- func PathExists(path string) (bool, error)
- func PowInt(x int, y int) int
- func RandString(len int) string
- func ReadFile(file string) (string, error)
- func RemoveDuplicatesAndEmpty(a []string) (ret []string)
- func SizeFormat(size float64) string
- func StringToBytes(str string) []byte
- func TimeSincePro(then time.Time) string
- func ToEditorLang(lang string) string
- func ToSlice(input string) ([]int64, error)
- func ToSnakeCase(str string) string
- func ToStr(value interface{}, args ...int) (s string)
- func WriteFile(file string, content string) error
- type Pager
- 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)
Constants ¶
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 Base64decode ¶
func Base64encode ¶
func CheckStandardMail ¶
func CheckStringIsExist ¶
func CurrentUsername ¶
func CurrentUsername() string
CurrentUsername returns the username of the current user.
func FilterAddressBody ¶
func GetHttpData ¶
func GetRealMail ¶
func HexStr2int ¶
HexStr2int converts hex format string to decimal number.
func Int2HexStr ¶
Int2HexStr converts decimal number to hex format string.
func IsDir ¶
IsDir returns true if given path is a directory, and returns false when it's a file or does not exist.
func IsMaliciousPath ¶
IsMaliciousPath returns true if given path is an absolute path or contains malicious content which has potential to traverse upper level directories.
func IsSameSiteURLPath ¶
IsSameSiteURLPath returns true if the URL path belongs to the same site, false otherwise. False: //url, http://url, /\url True: /url
func PathExists ¶
func RandString ¶
func SizeFormat ¶
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
func ToEditorLang ¶
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.