Documentation ¶
Index ¶
- Constants
- Variables
- func CamelCase(s string) string
- func CamelCaseInitialism(s string) string
- func Concat(args ...string) string
- func CopyFile(s, d string) error
- func DateToTime(date string) int64
- func ExecShell(s string) (string, error)
- func FilterSpace(s string) string
- func Float64(reply interface{}) (float64, error)
- func GetExt(file string) string
- func Getenv(key string, args ...string) string
- func Glob(base, pattern string, abs bool) ([]string, error)
- func HTTPAuthDownload(uri, save, user, passwd string, timeout int64) error
- func HTTPAuthDownloadWithHeader(uri, save, user, passwd string, timeout int64, headers map[string]string) error
- func HTTPAuthGet(uri string, user, passwd string, timeout int64) ([]byte, error)
- func HTTPAuthPostForm(uri string, data url.Values, user, passwd string, timeout int64) ([]byte, error)
- func HTTPAuthPostJSON(uri string, body []byte, user, passwd string, timeout int64, isGzip bool) ([]byte, error)
- func HTTPDownload(uri, path string) (int, error)
- func HTTPGet(uri string, timeout int) ([]byte, error)
- func HTTPPostFile(uri string, params map[string]string, cookie string, timeout int) ([]byte, http.Header, error)
- func HTTPPostJSON(uri string, params interface{}, timeout int) ([]byte, error)
- func HTTPRangeDownload(uri, path string, process chan<- float64) (int64, error)
- func InSlice(si interface{}, s interface{}, t string) bool
- func Int(reply interface{}) (int, error)
- func Int64(reply interface{}) (int64, error)
- func IntToString(i int) string
- func IsExist(path string) bool
- func IsFile(filename string) bool
- func IsNumeric(s string) bool
- func JsonEncode(obj interface{}) (string, error)
- func MD5(str string) string
- func MD5File(filepath string) string
- func MaskEmail(email string, masks ...string) string
- func MaskMobile(mobile string, masks ...string) string
- func MaskString(str string, masks ...string) string
- func MixedToSliceInt(v interface{}) []int
- func MixedToSliceString(v interface{}) []string
- func MkdirAll(path string) error
- func MtRand(m ...int) int
- func MustFloat64(v interface{}) float64
- func MustInt(v interface{}) int
- func MustInt64(v interface{}) int64
- func PowerShell(args ...string) (string, error)
- func RandFileName() string
- func RandRangeNumber(min, max int) int
- func RandStr(size int, kind int) []byte
- func ReadDir(dirname string) ([]os.FileInfo, error)
- func ReadFile(file string) ([]byte, error)
- func Remove(filename string) error
- func SliceIntDiff(a []int, b []int) []int
- func SliceIntEqual(a, b []int) bool
- func SliceIntRand(a []int) []int
- func SliceIntToString(a []int) []string
- func SliceInterfaceRand(a []interface{}) []interface{}
- func SliceStringDiff(a []string, b []string) []string
- func SplitStringToSlice(s string, sep string) []string
- func StrNatCut(s string, length int, dot ...string) string
- func StrPad(v interface{}, length int, pad string, padType int) string
- func String(reply interface{}) (string, error)
- func StringToInt(s string) int
- func StringToInt64(s string) int64
- func StringToTime(str string) time.Time
- func TimeToDate(timestamp int64, params ...string) string
- func TimeToDateInt(timestamp int64, params ...string) int
- func ToString(v interface{}) string
- func WriteFile(file string, body []byte) (int, error)
Constants ¶
const ( KC_RAND_KIND_NUM = 0 // 纯数字 KC_RAND_KIND_LOWER = 1 // 小写字母 KC_RAND_KIND_UPPER = 2 // 大写字母 KC_RAND_KIND_ALL = 3 // 数字、大小写字母 )
const ( STR_PAD_LEFT int = iota STR_PAD_RIGHT STR_PAD_BOTH )
const ( DefaultDateFormat = "2006-01-02" DefaultDatetimeFormat = "2006-01-02 15:04:05" )
Variables ¶
var ErrNil = errors.New("nil or type error")
数据类型转换
Functions ¶
func CamelCaseInitialism ¶ added in v0.0.6
CamelCaseInitialism 将一个字符串转为大驼峰命名,强制首字母缩写命名规范
func HTTPAuthDownload ¶ added in v0.0.6
basic auth download
func HTTPAuthDownloadWithHeader ¶ added in v0.0.6
func HTTPAuthDownloadWithHeader(uri, save, user, passwd string, timeout int64, headers map[string]string) error
basic auth download
func HTTPAuthGet ¶ added in v0.0.6
func HTTPAuthPostForm ¶ added in v0.0.6
func HTTPAuthPostJSON ¶ added in v0.0.6
func HTTPDownload ¶ added in v0.0.6
HTTPDownload HTTP下载文件
func HTTPPostFile ¶ added in v0.0.6
func HTTPPostFile(uri string, params map[string]string, cookie string, timeout int) ([]byte, http.Header, error)
HTTPPostFile 使用POST上传文件,超时 单位:秒 在参数中,如果要上传文件,设 params[file]=@/data/upload/1.zip 即可,注意 @ 符号
func HTTPPostJSON ¶ added in v0.0.6
HTTPPostJSON 使用POST JSON方式请求数据,超时 单位:秒
func HTTPRangeDownload ¶ added in v0.0.6
HTTPRangeDownload HTTP断点续传下载文件,提供下载进度,通过 range process得到进度条
func IsExist ¶ added in v0.0.6
IsExist check path is exists, exist return true, not exist return false
func MaskMobile ¶ added in v0.0.6
MaskMobile 使用指定字符遮罩手机号
func MaskString ¶ added in v0.0.6
MaskString 使用指定字符遮罩字符串
func MixedToSliceInt ¶ added in v0.0.6
func MixedToSliceInt(v interface{}) []int
MixedToSliceInt 将混合类型转为 数字slice
func MixedToSliceString ¶ added in v0.0.6
func MixedToSliceString(v interface{}) []string
MixedToSliceString 将混合类型转为 字符串slice
func PowerShell ¶
func SliceIntDiff ¶ added in v0.0.6
SliceIntDiff 获取在数字切片 a 中但不在数字切片 b 中的差集
func SliceIntEqual ¶ added in v0.0.6
SliceIntEqual 判断两个数字切片中的内容是否相同,忽略元素的排序 [1,2,3] == [3,2,1]
func SliceIntToString ¶ added in v0.0.6
SliceIntToString 将数字切片转换为字符串切片 [11,22,33] 转换为 ["11","22","33"]
func SliceInterfaceRand ¶ added in v0.0.6
func SliceInterfaceRand(a []interface{}) []interface{}
SliceInterfaceRand 将切片顺序打乱随机返回
func SliceStringDiff ¶ added in v0.0.6
SliceStringDiff 获取在字符串切片 a 中但不在字符串切片 b 中的差集
func SplitStringToSlice ¶ added in v0.0.6
SplitStringToSlice 将字符串分割成数组,并去除空行
func TimeToDate ¶ added in v0.0.6
时间戳转日期/时间,可传递格式化字符串
func TimeToDateInt ¶ added in v0.0.6
时间戳转日期int
Types ¶
This section is empty.