Documentation ¶
Index ¶
- Variables
- func Base64Decode(str string) string
- func CWD() string
- func DBFile() string
- func DBFileDev() string
- func DeepCopy(dst, src interface{}) error
- func EXEName() string
- func EnsureDir(dir string) (err error)
- func ErrorLogFilename() string
- func Exist(path string) bool
- func GetRandomString(n int) string
- func GetRedisUris() []string
- func HashPassword(pwd string) string
- func InArrayS(items []string, s string) bool
- func InitCasbin()
- func InitConfig(p string)
- func InitDb()
- func InitRedisCluster(addrs []string, password string)
- func IsPortInUse(port int) bool
- func LocalIP() string
- func LogDir() string
- func MD5(str string) string
- func ParseFlostToString(f float64) string
- func ParseInt(b string, defInt int) int
- func ParseString(b int) string
- func RedisLock(key, value string, expireTime time.Duration) bool
- func RedisUnLock(key, value string) error
- func StructToMap(obj interface{}) map[string]interface{}
- func StructToString(data interface{}) string
- func SubString(str string, start, length int) string
- func TimeFormat(time *time.Time) string
- func UnitJoin(ss []uint, sep string) string
- func WorkInDir(f func(), dir string)
- func WwwPath() string
- type GeneratePhoneNumber
- type Lists
- type RedisCluster
- func (rc *RedisCluster) Close()
- func (rc *RedisCluster) Del(keys ...interface{}) (int, error)
- func (rc *RedisCluster) Do(cmd string, args ...interface{}) (interface{}, error)
- func (rc *RedisCluster) Exists(key string) bool
- func (rc *RedisCluster) Expire(key string, seconds int) (interface{}, error)
- func (rc *RedisCluster) GetKey(key string) (interface{}, error)
- func (rc *RedisCluster) HGetAll(key string) (interface{}, error)
- func (rc *RedisCluster) HIncrBy(key string, field string, incr int64) (interface{}, error)
- func (rc *RedisCluster) HMSet(key string, values ...interface{}) (interface{}, error)
- func (rc *RedisCluster) LLen(key string) int
- func (rc *RedisCluster) LPush(key string, values ...interface{}) (interface{}, error)
- func (rc *RedisCluster) LRange(key string, start, end int) (interface{}, error)
- func (rc *RedisCluster) LTrim(key string, start, end int) (interface{}, error)
- func (rc *RedisCluster) Members(key string) (interface{}, error)
- func (rc *RedisCluster) RPush(key string, values ...interface{}) (interface{}, error)
- func (rc *RedisCluster) Sadd(key string, members ...interface{}) (interface{}, error)
- func (rc *RedisCluster) Scard(key string) (interface{}, error)
- func (rc *RedisCluster) Send(cmd string, args ...interface{}) error
- func (rc *RedisCluster) Set(key string, value interface{}, ttl ...time.Duration) (interface{}, error)
- func (rc *RedisCluster) SetNX(key string, value interface{}, expireSeconds int) bool
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var Config = struct { LogLevel string `default:"info" env:"Loglevel"` Bindata bool `default:"true" env:"Bindata"` Debug bool `default:"true" env:"Debug"` HTTPS bool `default:"false" env:"HTTPS"` Certpath string `default:"" env:"Certpath"` Certkey string `default:"" env:"Certkey"` Port int `default:"8085" env:"PORT"` Host string `default:"127.0.0.1" env:"Host"` Admin struct { UserName string `env:"AdminUserName" default:"username"` Name string `env:"AdminName" default:"name"` Pwd string `env:"AdminPwd" default:"123456"` RoleName string `env:"AdminRoleName" default:"admin"` RoleDisplayName string `env:"TenantRoleDisplayName" default:"超级管理员"` } DB struct { Prefix string `env:"DBPrefix" default:"iris_"` Name string `env:"DBName" default:"goirisapi"` Adapter string `env:"DBAdapter" default:"mysql"` Host string `env:"DBHost" default:"localhost"` Port string `env:"DBPort" default:"3306"` User string `env:"DBUser" default:"root"` Password string `env:"DBPassword" default:""` } Redis struct { Host string `env:"RedisHost" default:"localhost"` Port string `env:"RedisPort" default:"6379"` Pwd string `env:"RedisPwd" default:""` } Limit struct { Disable bool `env:"LimitDisable" default:"true"` Limit float64 `env:"LimitLimit" default:"1"` Burst int `env:"LimitBurst" default:"5"` } Qiniu struct { Enable bool `env:"QiniuEnable" default:"false"` Host string `env:"QiniuHost" default:""` Accesskey string `env:"QiniuAccesskey" default:""` Secretkey string `env:"QiniuSecretkey" default:""` Bucket string `env:"QiniuBucket" default:""` } }{}
View Source
var (
Db *gorm.DB
)
View Source
var Enforcer *casbin.Enforcer
View Source
var FlagVarDBFile string
Functions ¶
func Base64Decode ¶
*
- base64 解码
- @method func
- @param {[type]} t *Tools [description]
- @return {[type]} [description]
func ErrorLogFilename ¶
func ErrorLogFilename() string
func GetRedisUris ¶
func GetRedisUris() []string
func HashPassword ¶
func InitCasbin ¶
func InitCasbin()
func InitConfig ¶
func InitConfig(p string)
func InitRedisCluster ¶
func IsPortInUse ¶
func ParseFlostToString ¶
*
- 转换浮点数为string
- @method func
- @param {[type]} t * Tools [description]
- @return {[type]} [description]
func ParseInt ¶
*
- string转换int
- @method parseInt
- @param {[type]} b string [description]
- @return {[type]} [description]
func ParseString ¶
*
- int转换string
- @method parseInt
- @param {[type]} b string [description]
- @return {[type]} [description]
func RedisUnLock ¶
func StructToMap ¶
func StructToMap(obj interface{}) map[string]interface{}
*
- 结构体转换成map对象
- @method func
- @param {[type]} t *Tools [description]
- @return {[type]} [description]
func StructToString ¶
func StructToString(data interface{}) string
*
- 结构体转成json 字符串
- @method StruckToString
- @param {[type]} data interface{} [description]
func SubString ¶
*
- 字符串截取
- @method func
- @param {[type]} t *Tools [description]
- @return {[type]} [description]
func TimeFormat ¶
*
- 时间格式化
- @method func
- @param {[type]} t *Tools [description]
- @return {[type]} [description]
Types ¶
type GeneratePhoneNumber ¶
type GeneratePhoneNumber struct {
CacheData []string
}
func (*GeneratePhoneNumber) CreatePhoneNumber ¶
func (*GeneratePhoneNumber) CreatePhoneNumber() string
生成随机手机号码
func (*GeneratePhoneNumber) CreateUniquePhoneNumber ¶
func (g *GeneratePhoneNumber) CreateUniquePhoneNumber() string
生成唯一随机手机号码
type RedisCluster ¶
func GetRedisClusterClient ¶
func GetRedisClusterClient() *RedisCluster
func (*RedisCluster) Close ¶
func (rc *RedisCluster) Close()
func (*RedisCluster) Del ¶
func (rc *RedisCluster) Del(keys ...interface{}) (int, error)
func (*RedisCluster) Do ¶
func (rc *RedisCluster) Do(cmd string, args ...interface{}) (interface{}, error)
func (*RedisCluster) Exists ¶
func (rc *RedisCluster) Exists(key string) bool
func (*RedisCluster) Expire ¶
func (rc *RedisCluster) Expire(key string, seconds int) (interface{}, error)
func (*RedisCluster) GetKey ¶
func (rc *RedisCluster) GetKey(key string) (interface{}, error)
func (*RedisCluster) HGetAll ¶
func (rc *RedisCluster) HGetAll(key string) (interface{}, error)
func (*RedisCluster) HIncrBy ¶
func (rc *RedisCluster) HIncrBy(key string, field string, incr int64) (interface{}, error)
func (*RedisCluster) HMSet ¶
func (rc *RedisCluster) HMSet(key string, values ...interface{}) (interface{}, error)
func (*RedisCluster) LLen ¶
func (rc *RedisCluster) LLen(key string) int
func (*RedisCluster) LPush ¶
func (rc *RedisCluster) LPush(key string, values ...interface{}) (interface{}, error)
func (*RedisCluster) LRange ¶
func (rc *RedisCluster) LRange(key string, start, end int) (interface{}, error)
func (*RedisCluster) LTrim ¶
func (rc *RedisCluster) LTrim(key string, start, end int) (interface{}, error)
func (*RedisCluster) Members ¶
func (rc *RedisCluster) Members(key string) (interface{}, error)
func (*RedisCluster) RPush ¶
func (rc *RedisCluster) RPush(key string, values ...interface{}) (interface{}, error)
func (*RedisCluster) Sadd ¶
func (rc *RedisCluster) Sadd(key string, members ...interface{}) (interface{}, error)
func (*RedisCluster) Scard ¶
func (rc *RedisCluster) Scard(key string) (interface{}, error)
func (*RedisCluster) Send ¶
func (rc *RedisCluster) Send(cmd string, args ...interface{}) error
Click to show internal directories.
Click to hide internal directories.