Documentation ¶
Index ¶
- func Addslashes(str string) string
- func ArrayChunk(array []interface{}, size int) [][]interface{}
- func ArrayColumn(array []interface{}, key string) []interface{}
- func ArrayCombine(s1, s2 []interface{}) map[interface{}]interface{}
- func ArrayKeyExists(key interface{}, m map[interface{}]interface{}) bool
- func ArrayKeys(array map[interface{}]interface{}) []interface{}
- func ArrayMerge(array ...[]interface{}) []interface{}
- func ArrayPop(array *[]interface{}) interface{}
- func ArrayPush(array *[]interface{}, elements ...interface{}) int
- func ArrayRand(array []interface{}) []interface{}
- func ArrayReverse(s []interface{}) []interface{}
- func ArrayShift(array *[]interface{}) interface{}
- func ArraySlice(array []interface{}, offset, length uint) []interface{}
- func ArrayUnique(array []interface{}) (newArr []interface{})
- func ArrayValues(array map[interface{}]interface{}) []interface{}
- func Base64Decode(str string) (string, error)
- func Base64Encode(str string) string
- func Basename(path string) string
- func Between(str, starting, ending string) string
- func Ceil(value float64) float64
- func Chmod(filename string, mode os.FileMode) bool
- func ChunkSplit(body string, chunklen uint, end string) string
- func CookiesString(cookies []*http.Cookie) []byte
- func Copy(source, dest string) (bool, error)
- func Critical(args ...interface{})
- func Date(format string) string
- func DateTime(format string, timestamp int64) string
- func Debug(args ...interface{})
- func DeletePunctuation(str string) string
- func Error(args ...interface{})
- func ExecCommand(c string) (string, error)
- func Explode(separator, str string) []string
- func FileExists(filename string) bool
- func FileSize(filename string) (int64, error)
- func FloatToString(f float64, size int) string
- func Floor(value float64) float64
- func GetUserHome() string
- func Getcwd() (string, error)
- func Gethostname() (string, error)
- func Glob(pattern string) ([]string, error)
- func Goos() string
- func HTMLEntityDecode(str string) string
- func Handler(f interface{}, params ...interface{}) []reflect.Value
- func Htmlentities(str string) string
- func IP2long(ipAddress string) uint32
- func If(cond bool, a, b interface{}) interface{}
- func Implode(separator string, array []string) string
- func InArray(search interface{}, array interface{}) (exists bool, index int)
- func Info(args ...interface{})
- func Int64ToString(i int64) string
- func IntToString(i int) string
- func IsDir(filename string) (bool, error)
- func IsDirCreate(path string)
- func IsEmpty(val interface{}) bool
- func IsFile(filename string) bool
- func IsNumeric(val interface{}) bool
- func IsReadable(filename string) bool
- func IsWriteable(filename string) bool
- func JSONDecode(data []byte, val interface{}) error
- func JSONEncode(val interface{}) ([]byte, error)
- func Lcfirst(str string) string
- func Log(dirname ...string) *logging.Logger
- func Long2ip(properAddress uint32) string
- func Ltrim(str string, charlist ...string) string
- func Max(nums ...float64) float64
- func MbStrlen(str string) int
- func Md5(str string) string
- func Min(nums ...float64) float64
- func Notice(args ...interface{})
- func Paging(total, limit float64) float64
- func ParseStr(encodedString string, result map[string]interface{}) error
- func Pathinfo(path string, options int) map[string]string
- func Quotemeta(str string) string
- func Rand(min, max int) int
- func ReadFile(filename string) ([]byte, error)
- func Realpath(path string) (string, error)
- func RecursiveListPath(path string, slice *[]string)
- func Rename(oldname, newname string) error
- func Round(value float64) float64
- func Rtrim(str string, charlist ...string) string
- func SimilarText(first, second string, percent *float64) int
- func Sleep(t int64)
- func StrReplace(search, replace, str string, count int) string
- func StringToFloat(str string, size int) (float64, error)
- func StringToInt(str string) (int, error)
- func StringToInt64(str string) (int64, error)
- func Stripos(str, needle string, offset int) int
- func Stripslashes(str string) string
- func Strlen(str string) int
- func Strpos(str, needle string, offset int) int
- func Strrev(str string) string
- func Strripos(str, needle string, offset int) int
- func Strrpos(str, needle string, offset int) int
- func Strstr(str string, search string) string
- func StrtoTime(format, strtime string) (int64, error)
- func Strtolower(str string) string
- func Strtoupper(str string) string
- func Strtr(haystack string, params ...interface{}) string
- func Substr(str string, start int, length int) string
- func Time() int64
- func Tracefile(content []byte, filename string, keep bool) (int, error)
- func Trim(str string, charlist ...string) string
- func UA(source ...string) string
- func URLDecode(str string) (string, error)
- func URLEncode(str string) string
- func Ucfirst(str string) string
- func Ucwords(str string) string
- func UnescapeUnicode(raw string) (string, error)
- func Unlink(filename string) error
- func Warning(args ...interface{})
- type ClientOptions
- type DB
- func (d *DB) Count(tanleName string, cond interface{}) (int64, error)
- func (d *DB) Delete(tanleName string, cond interface{}) (int64, error)
- func (d *DB) GetDb() (*gorose.Connection, error)
- func (d *DB) Insert(tanleName string, data interface{}) (int64, error)
- func (d *DB) SelectAll(tanleName string, fields []string, cond interface{}, order string, ...) ([]map[string]interface{}, error)
- func (d *DB) SelectRow(tanleName string, fields []string, cond interface{}, order string) (map[string]interface{}, error)
- func (d *DB) SelectRows(tanleName string, fields []string, cond interface{}, order string) ([]map[string]interface{}, error)
- func (d *DB) Update(tanleName string, set map[string]interface{}, cond interface{}) (int64, error)
- type FTP
- type RedisClient
- func (r *RedisClient) DeleteKey(key string) int64
- func (r *RedisClient) GetKeysCount(pattern string) int
- func (r *RedisClient) MExpire(duration int64, keys ...string)
- func (r *RedisClient) SetAdd(key string, value []string) int64
- func (r *RedisClient) SetMembersReturnVal(key string) []string
- func (r *RedisClient) SortedSetAdd(key string, values ...redis.Z) int64
- func (r *RedisClient) SortedZrangeWithScores(key string) []redis.Z
- func (r *RedisClient) StrGet(key string) string
- func (r *RedisClient) StrMGet(keys ...string) []interface{}
- func (r *RedisClient) StrMSet(pairs ...interface{}) string
- func (r *RedisClient) StrSet(key, value string) string
- type SFTP
- type SSH
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArrayChunk ¶
func ArrayChunk(array []interface{}, size int) [][]interface{}
数组分割数组块 array 规定要使用的数组。 size 整数值,规定每个新数组包含多少个元素。
func ArrayColumn ¶
func ArrayColumn(array []interface{}, key string) []interface{}
返回输入数组中某个单一列的值 array 规定要使用的多维数组 key 需要返回值的列 ArrayColumn([][]interface{}{{"id":"a", "name":"b"}, {"id":"c", "name":"d"}}, "id")
func ArrayCombine ¶
func ArrayCombine(s1, s2 []interface{}) map[interface{}]interface{}
合并两个数组来创建一个新数组,其中的一个数组元素为键名,另一个数组的元素为键值
func ArrayKeyExists ¶
func ArrayKeyExists(key interface{}, m map[interface{}]interface{}) bool
检查某个数组中是否存在指定的键名 ArrayKeyExists("a", map[interface{}]interface{"a":"a","b":b})
func ArrayKeys ¶
func ArrayKeys(array map[interface{}]interface{}) []interface{}
返回包含数组中所有键名的一个新数组 array 数组
func ArrayPush ¶
func ArrayPush(array *[]interface{}, elements ...interface{}) int
在数组尾部添加一个或多个元素 array 数组 elements 添加的值 ArrayPush(&s1, "u", "v")
func ArraySlice ¶
func ArraySlice(array []interface{}, offset, length uint) []interface{}
在数组中根据条件取出一段值 array 数组 offset 取出元素的开始位置 length 返回数组的长度
func ArrayUnique ¶
func ArrayUnique(array []interface{}) (newArr []interface{})
移除数组中的重复的值,并返回结果数组 array 规定数组。 ArrayUnique([]string("a", "b", "a"))
func ArrayValues ¶
func ArrayValues(array map[interface{}]interface{}) []interface{}
返回一个包含给定数组中所有键值的数组,但不保留键名 elements 数组
func ChunkSplit ¶
把字符串分割后添加指定end body 要分割的字符串 chunklen 数字值,定义字符串块的长度 end 定义在每个字符串块末端放置的内容 ChunkSplit("abc", 1, "e") => aebece
func DateTime ¶
时间戳转日期时间 format 格式 2006-01-02 15:04:05 必须是这个时间点, 据说是go诞生之日(返回的格式) timestamp 需要转化的时间戳
func FloatToString ¶
float转string size 32 -> float32 64 -> float64
func Implode ¶
数组转字符串 separator 规定数组元素之间放置的内容 array 要组合为字符串的数组。 Implode(",", []string{"a", "b", "c"})
func ParseStr ¶
把查询字符串解析到变量中 encodedString 要解析的字符串 result 存储变量的数组的名称。该参数指示变量将被存储到数组中 result := make(map[string]interface{}) _ = ParseStr("f1=m&f2=n", result) result => map[f1:m f2:n]
func Pathinfo ¶
以数组的形式返回文件路径的信息 path 文件路径 options -1: all; 1: dirname; 2: basename; 4: extension; 8: filename Pathinfo("/home/go/php2go.go.go", -1)
func SimilarText ¶
计算两个字符串的相似度,并返回匹配字符的数目 first 比较的第一个字符串 second 比较的第二个字符串 percent 百分比相似度的变量名 SimilarText("golang", "google", &percent)
func StrReplace ¶
以其他字符替换字符串中的一些字符(区分大小写) search 要查找的值 replace 替换 search 中的值 str 被搜索的字符串 count 对替换数进行计数的变量, 替换的数量没有限制使用 -1 StrReplace("a","b","abcd", -1)
func StringToFloat ¶
string转float size 32 -> float32 64 -> float64
func Stripos ¶
查找字符串在另一字符串中第一次出现的位置(不区分大小写) str 被搜索的字符串 needle 要查找的字符 offset 在何处开始搜索 1 Stripos("hello word", "w", 1)
func Strpos ¶
查找字符串在另一字符串中第一次出现的位置(区分大小写) str 被搜索的字符串 needle 要查找的字符 offset 在何处开始搜索 1 Strpos("hello word", "w", 1)
func Strripos ¶
查找字符串在另一字符串中最后一次出现的位置(不区分大小写) str 被搜索的字符串 needle 要查找的字符 offset 在何处开始搜索, 没有限制使用 1 Strripos("hello word", "w", 1)
func Strrpos ¶
查找字符串在另一字符串中最后一次出现的位置(区分大小写) str 被搜索的字符串 needle 要查找的字符 offset 在何处开始搜索 1 Strrpos("hello word", "w", 1)
Types ¶
type ClientOptions ¶
type ClientOptions struct { Url string Method string Body io.Reader Header map[string]string Proxy []byte Timeout int64 }
Method GET POST Body bytes.NewReader() Proxy http://IP:Proxy or socks5://Username:Password@IP:Proxy
func (*ClientOptions) HttpRequest ¶
func (c *ClientOptions) HttpRequest() ([]byte, []byte, error)
type DB ¶
Dsn "账号:密码@tcp(IP:端口)/数据库?charset=utf8" Driver mysql/sqlite/oracle/mssql/postgres Prefix 前缀
func (*DB) SelectAll ¶
func (d *DB) SelectAll(tanleName string, fields []string, cond interface{}, order string, limit, offset int) ([]map[string]interface{}, error)
分页查询数据
func (*DB) SelectRow ¶
func (d *DB) SelectRow(tanleName string, fields []string, cond interface{}, order string) (map[string]interface{}, error)
查询一条数据
type FTP ¶
func (*FTP) FileDelete ¶
FTP 删除文件 filePathName 删除文件
func (*FTP) FileDownload ¶
FTP 下载文件 filePath 本地目录 remotePath 远程文件路径名
func (*FTP) FileUpload ¶
FTP 上传文件 filePathName 文件路径名 content 文件内容
type RedisClient ¶
Addr "localhost:6379", Password no password set DB use default DB
func (*RedisClient) GetKeysCount ¶
func (r *RedisClient) GetKeysCount(pattern string) int
func (*RedisClient) MExpire ¶
func (r *RedisClient) MExpire(duration int64, keys ...string)
func (*RedisClient) SetAdd ¶
func (r *RedisClient) SetAdd(key string, value []string) int64
set 下的增加数据
func (*RedisClient) SetMembersReturnVal ¶
func (r *RedisClient) SetMembersReturnVal(key string) []string
获取set下的 value,返回数组
func (*RedisClient) SortedSetAdd ¶
func (r *RedisClient) SortedSetAdd(key string, values ...redis.Z) int64
func (*RedisClient) SortedZrangeWithScores ¶
func (r *RedisClient) SortedZrangeWithScores(key string) []redis.Z
func (*RedisClient) StrGet ¶
func (r *RedisClient) StrGet(key string) string
func (*RedisClient) StrMGet ¶
func (r *RedisClient) StrMGet(keys ...string) []interface{}
func (*RedisClient) StrSet ¶
func (r *RedisClient) StrSet(key, value string) string
type SFTP ¶
func (*SFTP) FileDelete ¶
FTP 删除文件 filePathName 删除文件
func (*SFTP) FileDownload ¶
SFTP 下载文件 filePath 本地目录 remotePath 远程文件路径名
func (*SFTP) FileUpload ¶
SFTP 上传文件 filePathName 文件路径名 content 文件内容