lib

package
v0.0.0-...-0f6e941 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cfg *ini.File
View Source
var RedisPool *redis.Pool

Functions

func Decr

func Decr(key string) (int64, error)

Decr 自减

func DelKey

func DelKey(key string) error

del

func ExistsKey

func ExistsKey(key string) (bool, error)

ExistsKey

func GenerateToken

func GenerateToken(id int, email string) (string, error)

func GetKey

func GetKey(key string) (string, error)

get

func Incr

func Incr(key string) (int64, error)

incr 自增

func LPop

func LPop(key string) (string, error)

lpop

func LPushAndTrimKey

func LPushAndTrimKey(key, value interface{}, size int64) error

LPushAndTrimKey

func LRange

func LRange(key string, start, stop int64) ([]string, error)

lrange

func MgetKey

func MgetKey(keys ...interface{}) map[interface{}]string

mget 批量读取 mget key1, key2, 返回map结构

func MsetKey

func MsetKey(key_value ...interface{}) error

mset 批量写入 rds.Do("MSET", "ket1", "value1", "key2","value2")

func RPushAndTrimKey

func RPushAndTrimKey(key, value interface{}, size int64) error

RPushAndTrimKey

func SetKey

func SetKey(key, value interface{}, expires int) error

set expires为0时,表示永久性存储

func TTLKey

func TTLKey(key string) (int64, error)

ttl 返回剩余时间

Types

type Claims

type Claims struct {
	UserID    int    `json:"user_id"`
	UserEmail string `json:"user_email"`
	jwt.StandardClaims
}

func ParseToken

func ParseToken(tokenStr string) (*Claims, error)

type ServerConfig

type ServerConfig struct {
	RunMode        string
	HTTPPort       int
	ReadTimeout    time.Duration
	WriteTimeout   time.Duration
	Type           string
	User           string
	Password       string
	Host           string
	DbName         string
	TablePrefix    string
	RedisHost      string
	RedisPass      string
	RedisIndex     string
	JwtSecret      string
	JwtTokenExpire int64
}

服务端配置数据结构

func LoadServerConfig

func LoadServerConfig() ServerConfig

加载服务端配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL