Documentation ¶
Index ¶
- Constants
- func DebugDB()
- func SetRedisScript()
- func StartMysql(cfg MysqlConf) error
- func StartRedis(cfg RedisConf)
- func StopMysql()
- func StopRedis()
- type GLocker
- type IGLocker
- type IMysql
- type IRedis
- type Mysql
- func (m *Mysql) Close()
- func (m *Mysql) Connect(user, password, ip string, port int, db string) error
- func (m *Mysql) Exec(query string, args ...interface{}) (sql.Result, error)
- func (m *Mysql) IsConnected() bool
- func (m *Mysql) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (m *Mysql) QueryRow(query string, args ...interface{}) *sql.Row
- func (m *Mysql) Stats() *sql.DBStats
- type Redis
- func (r *Redis) Close()
- func (r *Redis) Decrby(key string, dec int) error
- func (r *Redis) DelKey(key string) error
- func (r *Redis) DoCmd(cmd string, args ...interface{}) (reply interface{}, err error)
- func (r *Redis) DoScript(key string, args ...interface{}) (reply interface{}, err error)
- func (r *Redis) GetActiveCount() int
- func (r *Redis) GetIdleCount() int
- func (r *Redis) GetString(key string) (string, error)
- func (r *Redis) HExists(key string, field interface{}) (bool, error)
- func (r *Redis) HGet(key string, field interface{}) (string, error)
- func (r *Redis) HGetAll(key string) (map[string]string, error)
- func (r *Redis) HKeys(key string) ([]string, error)
- func (r *Redis) HLen(key string) (int64, error)
- func (r *Redis) HMget(key string, fields ...interface{}) ([]string, error)
- func (r *Redis) HMset(key string, fields ...interface{}) error
- func (r *Redis) HSet(key string, field interface{}, value interface{}) error
- func (r *Redis) Hdel(key string, fields ...interface{}) error
- func (r *Redis) Incrby(key string, inc int) error
- func (r *Redis) InitConnect(ip string, port int, password string, db int)
- func (r *Redis) LIndex(key string, index int) (string, error)
- func (r *Redis) LLen(key string) (int64, error)
- func (r *Redis) LPop(key string) (string, error)
- func (r *Redis) LPush(key string, values ...interface{}) error
- func (r *Redis) LRange(key string, start, end int) ([]string, error)
- func (r *Redis) RPop(key string) (string, error)
- func (r *Redis) RPush(key string, values ...interface{}) error
- func (r *Redis) SAdd(key string, member interface{}) error
- func (r *Redis) SCard(key string) (int64, error)
- func (r *Redis) SIsMember(key string, member interface{}) (bool, error)
- func (r *Redis) SMembers(key string) ([]string, error)
- func (r *Redis) SPop(key string) (string, error)
- func (r *Redis) SRem(key string, members ...interface{}) error
- func (r *Redis) SetEX(key string, duration int, value string) error
- func (r *Redis) SetKeyExpire(key string, duration int) error
- func (r *Redis) SetNX(key string, value string) error
- func (r *Redis) SetScript(key string, script string, keyCount int)
- func (r *Redis) SetString(key string, value string) error
- func (r *Redis) StrLen(key string) (int64, error)
- func (r *Redis) ZAdd(key string, scoreAndmembers ...interface{}) error
- func (r *Redis) ZCard(key string) (int64, error)
- func (r *Redis) ZCount(key string, min, max int64) (int64, error)
- func (r *Redis) ZRank(key string, member interface{}) ([]string, error)
- func (r *Redis) ZRem(key string, members ...interface{}) error
- func (r *Redis) ZRevRange(key string, start, end int64, withScores bool) ([][]string, error)
- func (r *Redis) ZRevRank(key string) (int64, error)
- func (r *Redis) ZScore(key string, member interface{}) (int64, error)
Constants ¶
View Source
const ( MAX_OPEN_CONNS = 256 MAX_CONN_TIME = 24 * 3600 MAX_IDLE_CONNS = 32 MAX_IDLE_TIME = 5 * 60 )
View Source
const ( REDIS_MAX_IDLE = 30 REDIS_MAX_ACTIVE = 100 REDIS_MAX_DILE_TIMEOUT = 180 * time.Second )
View Source
const ( REDIS_SCRIPT_GET = "redis_get" REDIS_SCRIPT_HGET = "redis_hget" REDIS_SCRIPT_SET = "redis_set" REDIS_SCRIPT_HSET = "redis_hset" REDIS_SCRIPT_UNLOCK = "redis_unlock" REDIS_SCRIPT_HUNLOCK = "redis_hunlock" REDIS_SCRIPT_DEL = "redis_del" REDIS_SCRIPT_HDEL = "redis_hdel" REDIS_SCRIPT_PUSH = "redis_push" REDIS_SCRIPT_POP = "redis_pop" REDIS_SCRIPT_INCRBY = "redis_incrby" REDIS_SCRIPT_GLOCK = "redis_glock" REDIS_SCRIPT_GUNLOCK = "redis_gunlock" )
View Source
const (
GLOCK_TIMEOUT = 5
)
Variables ¶
This section is empty.
Functions ¶
func SetRedisScript ¶
func SetRedisScript()
func StartMysql ¶
func StartMysql(cfg MysqlConf) error
func StartRedis ¶
func StartRedis(cfg RedisConf)
Types ¶
type IRedis ¶
type IRedis interface { InitConnect(ip string, port int, password string, db int) SetScript(key string, script string, keyCount int) DoScript(key string, args ...interface{}) (reply interface{}, err error) GetIdleCount() int GetActiveCount() int DoCmd(cmd string, args ...interface{}) (reply interface{}, err error) Close() }
type Mysql ¶
type Mysql struct {
// contains filtered or unexported fields
}
var MysqlHelper *Mysql
func (*Mysql) IsConnected ¶
Click to show internal directories.
Click to hide internal directories.