Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateCurrentTimeAndZeroTime() time.Duration
- func CompactStr(str ...string) string
- func ContentFilter(text string) bool
- func CurrentDayEnd() string
- func CurrentDayZero() string
- func Decode(bytesBuffer io.Reader) (bodyBuf []byte, err error)
- func EnValidateParam(param interface{}) string
- func Encode(bytesBuffer io.Writer, content string) error
- func FileMd5(filepath string) (string, error)
- func FilterString(key, value, operator string) func(db *gorm.DB) *gorm.DB
- func Get(url string, header map[string]string, params map[string]interface{}) ([]byte, error)
- func InOrNotInFilter(key string, value interface{}, operator string) func(db *gorm.DB) *gorm.DB
- func LoadConfig(cf string)
- func Md5SaltCode(code, slat string) string
- func Md5StrToUpper(code string) string
- func Md5encoder(code string) string
- func MergeMap(dest, src map[interface{}]interface{}) map[interface{}]interface{}
- func NewClusterEtcd(addr []string) (*clientv3.Client, error)
- func NewEtcd(addr string) (*clientv3.Client, error)
- func NewGorm(dsn string, args ...[]int) (*gorm.DB, error)
- func NewTicker(ttl time.Duration, sch chan string, fn func(sch chan string) int)
- func PKCS5Adding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func Paginate(page interface{}, pageSize interface{}, s map[string]interface{}) func(db *gorm.DB) *gorm.DB
- func Post(url string, header map[string]string, param map[string]interface{}) ([]byte, error)
- func PostMultipart(url string, header map[string]string, payload *bytes.Buffer) ([]byte, error)
- func PreviousAfterDate(n int) string
- func PreviousAfterTime(n int) string
- func PreviousDayEndTime() string
- func PreviousDayStartTime() string
- func PrintConfigMap(config map[string]interface{})
- func QiNiuFileUpload(r *http.Request, store string) (string, error)
- func QiNiuResumeUploadFile(r *http.Request, store string) (string, error)
- func QiNiuUploadChunk(r *http.Request, store string) (string, string, error)
- func SendGmail(from string, to []string, content []byte, ...) (err error)
- func SendGmailEmail(from, to, title, content, mailServer, mailServerPort, mailPassword string) (err error)
- func SendMail(from, to, title, content, mailServer, mailServerPort, mailPassword string) (err error)
- func SetWordsFilter()
- func Sha1(code string) string
- func Sha256(code string) string
- func ToString(i interface{}) (string, error)
- func Transaction(fs ...func(tx *xorm.Session) error) (err error)
- func ZhValidateParam(param interface{}) string
- type AesEncrypt
- type ConsistentHashPolling
- type Counter
- type Database
- type DbEngine
- type DbOption
- type EchoLogger
- type EngineOption
- func WithXrmCharset(charset string) EngineOption
- func WithXrmDatabase(database string) EngineOption
- func WithXrmDbDriver(driver string) EngineOption
- func WithXrmHost(host string) EngineOption
- func WithXrmMaxIdleConn(maxIdleConn int) EngineOption
- func WithXrmMaxOpenConn(maxOpenConn int) EngineOption
- func WithXrmPassword(password string) EngineOption
- func WithXrmPort(port string) EngineOption
- func WithXrmShowSql(showSql bool) EngineOption
- func WithXrmUsername(username string) EngineOption
- type EtcdS
- type GMap
- type GoRegs
- func (g *GoRegs) MatchChineseCharacter(str string) bool
- func (g *GoRegs) MatchChineseIDCardNumber(id string) bool
- func (g *GoRegs) MatchChinesePhoneNumber(str string) bool
- func (g *GoRegs) MatchContainChineseCharacter(str string) bool
- func (g *GoRegs) MatchDoubleByte(input string) bool
- func (g *GoRegs) MatchEmail(str string) bool
- func (g *GoRegs) MatchEmptyLine(input string) bool
- func (g *GoRegs) MatchEnCharacter(str string) bool
- func (g *GoRegs) MatchGeNNumber(str string, n int) bool
- func (g *GoRegs) MatchIPv4(input string) bool
- func (g *GoRegs) MatchIPv6(input string) bool
- func (g *GoRegs) MatchIntOrFloat(str string) bool
- func (g *GoRegs) MatchIsContainSpecialCharacter(str string) bool
- func (g *GoRegs) MatchLenNNumber(str string, n int) bool
- func (g *GoRegs) MatchLowerEnCharacter(str string) bool
- func (g *GoRegs) MatchMKNoContainSpecialCharacter(str string, m, k int) bool
- func (g *GoRegs) MatchMNIntervalNumber(str string, m, n int) bool
- func (g *GoRegs) MatchMNLeCharacter(str string, m, z int) bool
- func (g *GoRegs) MatchMNNovelsOfRealNumber(str string, m, n int) bool
- func (g *GoRegs) MatchNLeCharacter(str string, n int) bool
- func (g *GoRegs) MatchNNovelsOfRealNumber(str string, n int) bool
- func (g *GoRegs) MatchNanZeroNegNumber(str string) bool
- func (g *GoRegs) MatchNanZeroNumber(str string) bool
- func (g *GoRegs) MatchNumber(str string) bool
- func (g *GoRegs) MatchNumberEnCharacter(str string) bool
- func (g *GoRegs) MatchNumberEnUnderscores(str string) bool
- func (g *GoRegs) MatchPass1(str string, m, n int) bool
- func (g *GoRegs) MatchPass2(str string) bool
- func (g *GoRegs) MatchStartingWithNonZero(str string) bool
- func (g *GoRegs) MatchUpEnCharacter(str string) bool
- type Hash
- type JwtClaims
- type LeakyBucket
- type LevelDB
- type LevelDBWithCache
- func (db *LevelDBWithCache) BatchDelete(keys []string) error
- func (db *LevelDBWithCache) BatchPut(kvs map[string]interface{}) error
- func (db *LevelDBWithCache) CountAll() (int64, error)
- func (db *LevelDBWithCache) CountPrefixSubsetKey(key string) (int64, error)
- func (db *LevelDBWithCache) Delete(key string) error
- func (db *LevelDBWithCache) DeleteAll() (bool, error)
- func (db *LevelDBWithCache) DeletePrefixSubsetKey(key string) (bool, error)
- func (db *LevelDBWithCache) Get(key string) ([]byte, error)
- func (db *LevelDBWithCache) Has(key string) (bool, error)
- func (db *LevelDBWithCache) Put(key string, value interface{}) error
- func (db *LevelDBWithCache) SelectAll() iterator.Iterator
- func (db *LevelDBWithCache) SelectPrefixSubsetKeyAll(key string) ([]map[string]interface{}, error)
- type LoggerEngineOption
- type LoggerOption
- type MongoDb
- func (m *MongoDb) BatchInsertCollection(c *mongo.Client, db string, collection string, data []interface{}) (res *mongo.InsertManyResult, err error)
- func (m *MongoDb) CountCollection(c *mongo.Client, db string, collection string, filter map[string]interface{}) (int64, int64, error)
- func (m *MongoDb) DeleteOneRecord(c *mongo.Client, db string, collection string, filter map[string]interface{}) (res *mongo.DeleteResult, err error)
- func (m *MongoDb) InsertCollection(c *mongo.Client, db string, collection string, data interface{}) (res *mongo.InsertOneResult, err error)
- func (m *MongoDb) UpdateOneRecord(c *mongo.Client, db string, collection string, id string, data bson.D) (res *mongo.UpdateResult, err error)
- type RandomPolling
- type RedisClientOption
- type RedisOption
- type RotationPolling
- type Scheduler
- type TokenBucket
- type ToolsSlice
- func (w *ToolsSlice) CompareSliceByte(s1, s2 []byte) bool
- func (w *ToolsSlice) CompareSliceInt(s1, s2 []int) bool
- func (w *ToolsSlice) CompareSliceStr(s1, s2 []string) bool
- func (w *ToolsSlice) Count(arr []interface{}) int
- func (w *ToolsSlice) DifferentSet(s1, s2 []string) []string
- func (w *ToolsSlice) ExpandStringSlice(s []string, split string) []string
- func (w *ToolsSlice) InSlice(s string, ts []string) bool
- func (w *ToolsSlice) InSliceInterface(s interface{}, ts []interface{}) bool
- func (w *ToolsSlice) Intersect(s1, s2 []string) []string
- func (w *ToolsSlice) Merge(s1, s2 []string) []string
- func (w *ToolsSlice) MergeRepeatedElement(s1, s2 []string) []string
- func (w *ToolsSlice) MergeSlice(s1, s2 []interface{}) (s3 []interface{})
- func (w *ToolsSlice) MoveStr2Slice(str string, buf []byte)
- func (w *ToolsSlice) PaginateArray(arr []interface{}, page, pageSize int) []interface{}
- func (w *ToolsSlice) RandSlice(min, max int) []int
- func (w *ToolsSlice) RemoveRepeatedElement(arr []string) (newArr []string)
- func (w *ToolsSlice) SliceChunk(s []interface{}, size int) (chunkSlice [][]interface{})
- func (w *ToolsSlice) SliceDiff(s1, s2 []interface{}) (s3 []interface{})
- func (w *ToolsSlice) SliceFilter(s []interface{}, a filterType) (ftSlice []interface{})
- func (w *ToolsSlice) SliceHex2SliceUInt16(s []string) (ret []uint16)
- func (w *ToolsSlice) SliceIntersect(s1, s2 []interface{}) (s3 []interface{})
- func (w *ToolsSlice) SlicePad(slice []interface{}, size int, val interface{}) []interface{}
- func (w *ToolsSlice) SliceRand(a []interface{}) (b interface{})
- func (w *ToolsSlice) SliceRange(start, end, step int64) (intSlice []int64)
- func (w *ToolsSlice) SliceReduce(s []interface{}, a reduceType) (s2 []interface{})
- func (w *ToolsSlice) SliceShuffle(slice []interface{}) []interface{}
- func (w *ToolsSlice) SliceStr2SliceInt(s []string) (ret []int)
- func (w *ToolsSlice) SliceSum(s []int64) (sum int64)
- func (w *ToolsSlice) SliceUnique(slice []interface{}) (uniqueSlice []interface{})
- type Uint32Slice
- type WeightPolling
- type WeightedNode
Constants ¶
const DBDriverDefault = "mysql"
const MsgHeader = "12345678"
Variables ¶
var (
AppLog *zap.Logger
)
var Db *xorm.Engine
var (
ErrEmptyKey = errors.New("key could not be empty")
)
var (
ParamsNoEnoughError = errors.New("at least one parameter is required")
)
var Rc *redis.Client
var Response *result
var ResponsePage *pageList
var (
Wf *wordsfilter.WordsFilter
)
Functions ¶
func CalculateCurrentTimeAndZeroTime ¶
CalculateCurrentTimeAndZeroTime 计算当前时间和零点的时间差
func EnValidateParam ¶
func EnValidateParam(param interface{}) string
EnValidateParam validate params english
func FilterString ¶
FilterString 进行快速条件过滤
func InOrNotInFilter ¶
InOrNotInFilter where in 或者 where not in
func Md5StrToUpper ¶
func Md5encoder ¶
func MergeMap ¶
func MergeMap(dest, src map[interface{}]interface{}) map[interface{}]interface{}
MergeMap desc: 合并源 map 到目标 map
func NewGorm ¶
NewGorm gorm 初始化mysql连接 eg: root:123456@tcp(127.0.0.1:3306)/demo?charset=utf8mb4&parseTime=True&loc=Local
func PKCS5Adding ¶
func PKCS5UnPadding ¶
func Paginate ¶
func Paginate(page interface{}, pageSize interface{}, s map[string]interface{}) func(db *gorm.DB) *gorm.DB
Paginate page, pageSize 传入参数 s 分页默认配置
func PostMultipart ¶
func PrintConfigMap ¶
func PrintConfigMap(config map[string]interface{})
func QiNiuFileUpload ¶
QiNiuFileUpload 上传文件到七牛云
func QiNiuResumeUploadFile ¶
QiNiuResumeUploadFile 七牛云文件断点续传
func QiNiuUploadChunk ¶
QiNiuUploadChunk 七牛云分片上传
func SendGmail ¶
func SendGmail(from string, to []string, content []byte, mailServer, mailServerPort, mailPassword string) (err error)
SendGmail 发送谷歌邮件 支持同时给多人发送
func SendGmailEmail ¶
func SendGmailEmail(from, to, title, content, mailServer, mailServerPort, mailPassword string) (err error)
SendGmailEmail 发送谷歌邮件 支持 Gmail邮箱 from 发件人邮箱 `[email protected]` to 接受人邮箱 title 邮箱标题 content 邮箱内容 mailServer Gmail邮箱服务地址 `smtp.gmail.com` mailServerPort Gmail邮箱端口 `:587` mailPassword Gmail邮箱登陆密码
func SendMail ¶
func SendMail(from, to, title, content, mailServer, mailServerPort, mailPassword string) (err error)
SendMail 发送邮件 支持 163邮箱、QQ邮箱、126邮箱 from 发件人邮箱 `[email protected]`、`[email protected]`、`[email protected]` to 接受人邮箱 title 邮箱标题 content 邮箱内容 mailServer 163邮箱服务地址 163: `smtp.163.com`、 QQ邮箱: `smtp.qq.com`、 126邮箱: `smtp.126.com` mailServerPort 163邮箱端口 163: `:465` 、 QQ邮箱端口: `:465`、 126邮箱: `:465` mailPassword 163邮箱、QQ邮箱、126邮箱 授权码 `xxxxxxxxxxx`
func ZhValidateParam ¶
func ZhValidateParam(param interface{}) string
ZhValidateParam validate params english
Types ¶
type AesEncrypt ¶
type AesEncrypt struct {
// contains filtered or unexported fields
}
func NewAesEncryptInstance ¶
func NewAesEncryptInstance(key string, secret string) (*AesEncrypt, error)
func (*AesEncrypt) AesBase64Decrypt ¶
func (a *AesEncrypt) AesBase64Decrypt(b string) (string, error)
AesBase64Decrypt aes Base64 解密
func (*AesEncrypt) AesBase64Encrypt ¶
func (a *AesEncrypt) AesBase64Encrypt(in string) (string, error)
AesBase64Encrypt aes Base64 加密
type ConsistentHashPolling ¶
type ConsistentHashPolling struct {
// contains filtered or unexported fields
}
func NewConsistentHashPolling ¶
func NewConsistentHashPolling(replicas int, fn Hash) *ConsistentHashPolling
func (*ConsistentHashPolling) Add ¶
func (p *ConsistentHashPolling) Add(params ...interface{}) error
func (*ConsistentHashPolling) Next ¶
func (p *ConsistentHashPolling) Next(key string) (interface{}, error)
type Database ¶
type Database interface {
Put(key string, value interface{}) error
BatchPut(kvs map[string]interface{}) error
Get(key string) ([]byte, error)
Has(key string) (bool, error)
Delete(key string) error
BatchDelete(keys []string) error
SelectAll() iterator.Iterator
SelectPrefixSubsetKeyAll(key string) ([]map[string]interface{}, error)
CountPrefixSubsetKey(key string) (int64, error)
CountAll() (int64, error)
DeletePrefixSubsetKey(key string) (bool, error)
}
type DbEngine ¶
type DbEngine struct {
DbOption
}
func NewXrmEngine ¶
func NewXrmEngine(options ...EngineOption) *DbEngine
type DbOption ¶
type DbOption struct {
DbDriver string `json:"db_driver"`
Host string `json:"host"`
Port string `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
Database string `json:"database"`
Charset string `json:"charset"`
MaxIdleConn int `json:"max_idle_conn"`
MaxOpenConn int `json:"max_open_conn"`
ShowSql bool `json:"show_sql"`
}
type EngineOption ¶
type EngineOption func(option *DbOption)
func WithXrmCharset ¶
func WithXrmCharset(charset string) EngineOption
func WithXrmDatabase ¶
func WithXrmDatabase(database string) EngineOption
func WithXrmDbDriver ¶
func WithXrmDbDriver(driver string) EngineOption
func WithXrmHost ¶
func WithXrmHost(host string) EngineOption
func WithXrmMaxIdleConn ¶
func WithXrmMaxIdleConn(maxIdleConn int) EngineOption
func WithXrmMaxOpenConn ¶
func WithXrmMaxOpenConn(maxOpenConn int) EngineOption
func WithXrmPassword ¶
func WithXrmPassword(password string) EngineOption
func WithXrmPort ¶
func WithXrmPort(port string) EngineOption
func WithXrmShowSql ¶
func WithXrmShowSql(showSql bool) EngineOption
func WithXrmUsername ¶
func WithXrmUsername(username string) EngineOption
type GoRegs ¶
type GoRegs struct{}
func (*GoRegs) MatchChineseCharacter ¶
MatchChineseCharacter 纯汉字
func (*GoRegs) MatchChineseIDCardNumber ¶
MatchChineseIDCardNumber 验证大陆身份证号
func (*GoRegs) MatchChinesePhoneNumber ¶
MatchChinesePhoneNumber 大陆手机号
func (*GoRegs) MatchContainChineseCharacter ¶
MatchContainChineseCharacter 大陆手机号
func (*GoRegs) MatchDoubleByte ¶
MatchDoubleByte 匹配双字节字符(包括汉字在内)
func (*GoRegs) MatchEmptyLine ¶
MatchEmptyLine 匹配零个或多个空白字符(包括空格、制表符、换页符等)
func (*GoRegs) MatchEnCharacter ¶
MatchEnCharacter 纯英文字符串,大小写不敏感
func (*GoRegs) MatchGeNNumber ¶
MatchGeNNumber 长度不小于n位的纯数字
func (*GoRegs) MatchIntOrFloat ¶
MatchIntOrFloat 整数或者小数
func (*GoRegs) MatchIsContainSpecialCharacter ¶
MatchIsContainSpecialCharacter 验证是否包含特殊字符串
func (*GoRegs) MatchLenNNumber ¶
MatchLenNNumber 长度为n的纯数字
func (*GoRegs) MatchLowerEnCharacter ¶
MatchLowerEnCharacter 纯小写英文字符串
func (*GoRegs) MatchMKNoContainSpecialCharacter ¶
MatchMKNoContainSpecialCharacter 长度m-k的字符串,包含数字、字母、汉字,不包含特殊字符 一般多用于校验用户名或昵称等
func (*GoRegs) MatchMNIntervalNumber ¶
MatchMNIntervalNumber 长度m~n位的纯数字
func (*GoRegs) MatchMNLeCharacter ¶
MatchMNLeCharacter 长度m-z的字符串,包含特殊字符、数字、字母、汉字, 一般多用于校验用户名或昵称等
func (*GoRegs) MatchMNNovelsOfRealNumber ¶
MatchMNNovelsOfRealNumber m~n位小数的正实数
func (*GoRegs) MatchNLeCharacter ¶
MatchNLeCharacter 长度为n的字符,特殊字符除外
func (*GoRegs) MatchNNovelsOfRealNumber ¶
MatchNNovelsOfRealNumber 有n位小数的正实数
func (*GoRegs) MatchNanZeroNegNumber ¶
MatchNanZeroNegNumber 非零的负整数
func (*GoRegs) MatchNanZeroNumber ¶
MatchNanZeroNumber 非零的正整数
func (*GoRegs) MatchNumberEnCharacter ¶
MatchNumberEnCharacter 数字和26个英文字母组成的字符串,大小写不敏感
func (*GoRegs) MatchNumberEnUnderscores ¶
MatchNumberEnUnderscores 数字和26个英文字母组成的字符串,大小写不敏感
func (*GoRegs) MatchPass1 ¶
MatchPass1 密码1 由数字、26个英文字母或者下划线组成的英文开头的字符串, 长度m~n位
func (*GoRegs) MatchPass2 ¶
MatchPass2 密码2 密码长度至少为8个字符。 包含至少一个小写字母。 包含至少一个大写字母。 包含至少一个数字。 包含至少一个特殊字符(例如 !@#$%^&*() 等
func (*GoRegs) MatchStartingWithNonZero ¶
MatchStartingWithNonZero 非零开头的纯数字
func (*GoRegs) MatchUpEnCharacter ¶
MatchUpEnCharacter 纯大写英文字符串
type JwtClaims ¶
type JwtClaims struct {
Expire time.Duration
Secret string
LoginInfo interface{} `json:"login_info"`
jwt.StandardClaims
}
func (*JwtClaims) GenerateToken ¶
GenerateToken 签发Token
type LeakyBucket ¶
type LeakyBucket struct {
// contains filtered or unexported fields
}
func (*LeakyBucket) Pass ¶
func (l *LeakyBucket) Pass() bool
func (*LeakyBucket) Set ¶
func (l *LeakyBucket) Set(r, c float64)
type LevelDBWithCache ¶
type LevelDBWithCache struct {
// contains filtered or unexported fields
}
func NewLevelDBWithCache ¶
func NewLevelDBWithCache(path string) (*LevelDBWithCache, error)
func (*LevelDBWithCache) BatchDelete ¶
func (db *LevelDBWithCache) BatchDelete(keys []string) error
func (*LevelDBWithCache) BatchPut ¶
func (db *LevelDBWithCache) BatchPut(kvs map[string]interface{}) error
func (*LevelDBWithCache) CountAll ¶
func (db *LevelDBWithCache) CountAll() (int64, error)
func (*LevelDBWithCache) CountPrefixSubsetKey ¶
func (db *LevelDBWithCache) CountPrefixSubsetKey(key string) (int64, error)
func (*LevelDBWithCache) Delete ¶
func (db *LevelDBWithCache) Delete(key string) error
func (*LevelDBWithCache) DeleteAll ¶
func (db *LevelDBWithCache) DeleteAll() (bool, error)
func (*LevelDBWithCache) DeletePrefixSubsetKey ¶
func (db *LevelDBWithCache) DeletePrefixSubsetKey(key string) (bool, error)
func (*LevelDBWithCache) Put ¶
func (db *LevelDBWithCache) Put(key string, value interface{}) error
func (*LevelDBWithCache) SelectAll ¶
func (db *LevelDBWithCache) SelectAll() iterator.Iterator
func (*LevelDBWithCache) SelectPrefixSubsetKeyAll ¶
func (db *LevelDBWithCache) SelectPrefixSubsetKeyAll(key string) ([]map[string]interface{}, error)
type LoggerEngineOption ¶
type LoggerEngineOption func(*LoggerOption)
func WithLoggerCompress ¶
func WithLoggerCompress() LoggerEngineOption
func WithLoggerFilePath ¶
func WithLoggerFilePath(path string) LoggerEngineOption
func WithLoggerLocalTime ¶
func WithLoggerLocalTime() LoggerEngineOption
func WithLoggerMaxAge ¶
func WithLoggerMaxAge(age int) LoggerEngineOption
func WithLoggerMaxSize ¶
func WithLoggerMaxSize(size int) LoggerEngineOption
type LoggerOption ¶
func NewLogger ¶
func NewLogger(option ...LoggerEngineOption) *LoggerOption
func (*LoggerOption) Start ¶
func (l *LoggerOption) Start()
type MongoDb ¶
type MongoDb struct {
// contains filtered or unexported fields
}
func NewMongoDb ¶
NewMongoDb mongodb 连接
func (*MongoDb) BatchInsertCollection ¶
func (m *MongoDb) BatchInsertCollection(c *mongo.Client, db string, collection string, data []interface{}) ( res *mongo.InsertManyResult, err error)
BatchInsertCollection 批量写入
func (*MongoDb) CountCollection ¶
func (m *MongoDb) CountCollection(c *mongo.Client, db string, collection string, filter map[string]interface{}) (int64, int64, error)
CountCollection 统计
func (*MongoDb) DeleteOneRecord ¶
func (m *MongoDb) DeleteOneRecord(c *mongo.Client, db string, collection string, filter map[string]interface{}) ( res *mongo.DeleteResult, err error)
DeleteOneRecord 删除单条记录
func (*MongoDb) InsertCollection ¶
func (m *MongoDb) InsertCollection(c *mongo.Client, db string, collection string, data interface{}) ( res *mongo.InsertOneResult, err error)
InsertCollection 写入 db 写入的数据库 collection 写入的文档(表) data 写入的数据
type RandomPolling ¶
type RandomPolling struct {
// contains filtered or unexported fields
}
func (*RandomPolling) Add ¶
func (p *RandomPolling) Add(params ...interface{}) error
func (*RandomPolling) RandomNext ¶
func (p *RandomPolling) RandomNext() interface{}
type RedisClientOption ¶
type RedisClientOption func(option *RedisOption)
func WithRedisAddress ¶
func WithRedisAddress(address string) RedisClientOption
func WithRedisDB ¶
func WithRedisDB(db int) RedisClientOption
func WithRedisPassword ¶
func WithRedisPassword(password string) RedisClientOption
type RedisOption ¶
type RedisOption struct {
Addr string `json:"addr"`
Password string `json:"password"`
DB int `json:"db"`
}
func NewRedisClient ¶
func NewRedisClient(option ...RedisClientOption) *RedisOption
func (*RedisOption) Connect ¶
func (c *RedisOption) Connect()
type RotationPolling ¶
type RotationPolling struct {
// contains filtered or unexported fields
}
func (*RotationPolling) Add ¶
func (p *RotationPolling) Add(params ...interface{}) error
func (*RotationPolling) RotationNext ¶
func (p *RotationPolling) RotationNext() interface{}
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler 调度器结构
type TokenBucket ¶
type TokenBucket struct {
// contains filtered or unexported fields
}
func (*TokenBucket) Pass ¶
func (l *TokenBucket) Pass() bool
func (*TokenBucket) Set ¶
func (l *TokenBucket) Set(r, c int64)
type ToolsSlice ¶
type ToolsSlice struct{}
func (*ToolsSlice) CompareSliceByte ¶
func (w *ToolsSlice) CompareSliceByte(s1, s2 []byte) bool
func (*ToolsSlice) CompareSliceInt ¶
func (w *ToolsSlice) CompareSliceInt(s1, s2 []int) bool
func (*ToolsSlice) CompareSliceStr ¶
func (w *ToolsSlice) CompareSliceStr(s1, s2 []string) bool
func (*ToolsSlice) Count ¶
func (w *ToolsSlice) Count(arr []interface{}) int
repeat item in slice. No contain self item
func (*ToolsSlice) DifferentSet ¶
func (w *ToolsSlice) DifferentSet(s1, s2 []string) []string
DifferentSet 取两个列表的差集
func (*ToolsSlice) ExpandStringSlice ¶
func (w *ToolsSlice) ExpandStringSlice(s []string, split string) []string
func (*ToolsSlice) InSlice ¶
func (w *ToolsSlice) InSlice(s string, ts []string) bool
InSlice 检查字符串是否存在字符串切片中
func (*ToolsSlice) InSliceInterface ¶
func (w *ToolsSlice) InSliceInterface(s interface{}, ts []interface{}) bool
InSliceInterface 检查Interface是否存在Interface切片中
func (*ToolsSlice) Intersect ¶
func (w *ToolsSlice) Intersect(s1, s2 []string) []string
Intersect 取两个列表的交集
func (*ToolsSlice) MergeRepeatedElement ¶
func (w *ToolsSlice) MergeRepeatedElement(s1, s2 []string) []string
MergeRepeatedElement 合集去重
func (*ToolsSlice) MergeSlice ¶
func (w *ToolsSlice) MergeSlice(s1, s2 []interface{}) (s3 []interface{})
MergeSlice merge two interface slices to one slice
func (*ToolsSlice) MoveStr2Slice ¶
func (w *ToolsSlice) MoveStr2Slice(str string, buf []byte)
func (*ToolsSlice) PaginateArray ¶
func (w *ToolsSlice) PaginateArray(arr []interface{}, page, pageSize int) []interface{}
func (*ToolsSlice) RandSlice ¶
func (w *ToolsSlice) RandSlice(min, max int) []int
func (*ToolsSlice) RemoveRepeatedElement ¶
func (w *ToolsSlice) RemoveRepeatedElement(arr []string) (newArr []string)
RemoveRepeatedElement 数组切片去重
func (*ToolsSlice) SliceChunk ¶
func (w *ToolsSlice) SliceChunk(s []interface{}, size int) (chunkSlice [][]interface{})
func (*ToolsSlice) SliceDiff ¶
func (w *ToolsSlice) SliceDiff(s1, s2 []interface{}) (s3 []interface{})
func (*ToolsSlice) SliceFilter ¶
func (w *ToolsSlice) SliceFilter(s []interface{}, a filterType) (ftSlice []interface{})
func (*ToolsSlice) SliceHex2SliceUInt16 ¶
func (w *ToolsSlice) SliceHex2SliceUInt16(s []string) (ret []uint16)
func (*ToolsSlice) SliceIntersect ¶
func (w *ToolsSlice) SliceIntersect(s1, s2 []interface{}) (s3 []interface{})
func (*ToolsSlice) SlicePad ¶
func (w *ToolsSlice) SlicePad(slice []interface{}, size int, val interface{}) []interface{}
func (*ToolsSlice) SliceRand ¶
func (w *ToolsSlice) SliceRand(a []interface{}) (b interface{})
func (*ToolsSlice) SliceRange ¶
func (w *ToolsSlice) SliceRange(start, end, step int64) (intSlice []int64)
func (*ToolsSlice) SliceReduce ¶
func (w *ToolsSlice) SliceReduce(s []interface{}, a reduceType) (s2 []interface{})
func (*ToolsSlice) SliceShuffle ¶
func (w *ToolsSlice) SliceShuffle(slice []interface{}) []interface{}
func (*ToolsSlice) SliceStr2SliceInt ¶
func (w *ToolsSlice) SliceStr2SliceInt(s []string) (ret []int)
func (*ToolsSlice) SliceSum ¶
func (w *ToolsSlice) SliceSum(s []int64) (sum int64)
func (*ToolsSlice) SliceUnique ¶
func (w *ToolsSlice) SliceUnique(slice []interface{}) (uniqueSlice []interface{})
type Uint32Slice ¶
type Uint32Slice []uint32
func (Uint32Slice) Len ¶
func (p Uint32Slice) Len() int
func (Uint32Slice) Less ¶
func (p Uint32Slice) Less(i, j int) bool
func (Uint32Slice) Swap ¶
func (p Uint32Slice) Swap(i, j int)
type WeightPolling ¶
type WeightPolling struct {
// contains filtered or unexported fields
}
func (*WeightPolling) Add ¶
func (r *WeightPolling) Add(params ...string) error
func (*WeightPolling) Next ¶
func (r *WeightPolling) Next() string
type WeightedNode ¶
type WeightedNode struct {
// contains filtered or unexported fields
}
Source Files
¶
- aes.go
- api_response.go
- email.go
- encry.go
- etcd.go
- gmap.go
- gorm.go
- httprequest.go
- jwt.go
- leveldb.go
- limit_counter.go
- limit_leaky_bucket.go
- limit_tocker_bucket.go
- load_polling.go
- logger.go
- map.go
- mongo.go
- oss.go
- redis.go
- regexp.go
- regexp_const.go
- scheduler.go
- slice.go
- string.go
- ticker.go
- time.go
- unpack.go
- validate_params.go
- viper.go
- wordsfilter.go
- xorm.go