Documentation
¶
Index ¶
- Constants
- Variables
- func Base62(s int) string
- func Base64(n int) string
- func Bytes(n int) []byte
- func CheckPasswordHash(password, hash string) bool
- func CreateFile(fpath string, filePerm, dirPerm os.FileMode) (*os.File, error)
- func DeleteIfFileExist(fpath string) error
- func FileExists(path string) bool
- func Float64(in interface{}) (float64, error)
- func GetEnv(env map[string]string, key string, defaultVal string) string
- func GetEnvAsBool(env map[string]string, name string, defaultVal bool) bool
- func GetEnvAsInt(env map[string]string, name string, defaultVal int) int
- func GetEnvAsSlice(env map[string]string, name string, defaultVal []string, sep string) []string
- func GetEnvAsUInt(env map[string]string, name string, defaultVal uint) uint
- func HashPassword(password string) (string, error)
- func Hex(n int) string
- func HowLongAgo(sec int64) string
- func Int(in interface{}) (int, error)
- func Int64(in interface{}) (int64, error)
- func IsAbsPath(filepath string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsImageFile(path string) bool
- func IsNum(a string) bool
- func IsZipFile(filepath string) bool
- func JsonpToJson(json string) string
- func MimeType(path string) (mime string)
- func Mkdir(dirPath string, perm os.FileMode) error
- func MustFloat64(in interface{}) float64
- func MustInt(in interface{}) int
- func MustInt64(in interface{}) int64
- func MustUint(in interface{}) uint
- func MustUint64(in interface{}) uint64
- func PathExists(path string) bool
- func RandomNumber(min, max int) string
- func ReaderMimeType(r io.Reader) (mime string)
- func String(n int, letters ...string) string
- func ToFloat64(in interface{}) (f64 float64, err error)
- func ToInt(in interface{}) (iVal int, err error)
- func ToInt64(in interface{}) (i64 int64, err error)
- func ToUint(in interface{}) (u uint, err error)
- func ToUint64(in interface{}) (u64 uint64, err error)
- func Uint(in interface{}) (uint, error)
- func Uint64(in interface{}) (uint64, error)
- func Unzip(archive, targetDir string) (err error)
- func XML2MapStr(xmlDoc string) map[string]string
Constants ¶
View Source
const (
// sniff Length, use for detect file mime type
MimeSniffLen = 512
)
Variables ¶
View Source
var (
ErrConvertFail = errors.New("convert data type is failure")
)
Functions ¶
func CheckPasswordHash ¶
func FileExists ¶
FileExists reports whether the named file or directory exists. Deprecated
please use PathExists() or IsFile() instead it
func GetEnvAsSlice ¶
func HashPassword ¶
func IsZipFile ¶
IsZipFile check is zip file. from https://blog.csdn.net/wangshubo1989/article/details/71743374
func JsonpToJson ¶
JsonpToJson modify jsonp string to json string Example: foobar({a:"1",b:2}) to {"a":"1","b":2}
func MustFloat64 ¶
func MustFloat64(in interface{}) float64
func MustUint64 ¶
func MustUint64(in interface{}) uint64
func PathExists ¶
PathExists reports whether the named file or directory exists.
func RandomNumber ¶
func ReaderMimeType ¶
ReaderMimeType get the io.Reader mimeType Usage:
file, err := os.Open(filepath) if err != nil { return } mime := ReaderMimeType(file)
func String ¶
String generates a random string using only letters provided in the letters parameter if user ommit letters parameters, this function will use defLetters instead
func Unzip ¶
Unzip a zip archive from https://blog.csdn.net/wangshubo1989/article/details/71743374
func XML2MapStr ¶
simple xml to string support utf8
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.