redix

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXPIRE = "expire" // 过期时间
	NX     = "nx"     // setnx
	XX     = "xx"     // setxx
)

Variables

This section is empty.

Functions

func Init

func Init()

func RegisterRedis

func RegisterRedis()

RegisterRedis 注册

Types

type Config

type Config struct {
	Name     string `mapstructure:"name"`
	Conn     string `mapstructure:"conn"`
	Password string `mapstructure:"password"`
	Timeout  int    `mapstructure:"timeout"`
	DB       int    `mapstructure:"db"`
}

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(data []interface{}) *Iterator

func (*Iterator) HasNext

func (i *Iterator) HasNext() bool

func (*Iterator) Next

func (i *Iterator) Next() (res interface{})

type MResult

type MResult struct {
	Value []interface{}
	Error error
}

func NewMResult

func NewMResult(value []interface{}, error error) *MResult

func (*MResult) Iterator

func (m *MResult) Iterator() *Iterator

func (*MResult) Result

func (m *MResult) Result(v []interface{}) []interface{}

type Operation

type Operation struct {
	Name  string
	Value interface{}
}

func WithExpire

func WithExpire(t int) *Operation

func WithNX

func WithNX() *Operation

func WithXX

func WithXX() *Operation

type Operations

type Operations []*Operation

func (Operations) Find

func (c Operations) Find(name string) *Result

type RedisClient

type RedisClient struct {
	// contains filtered or unexported fields
}

func DB

func DB(name string) *RedisClient

New 根据名称获取数据库连接

func (*RedisClient) Get

func (c *RedisClient) Get(key string) *Result

func (*RedisClient) MGet

func (c *RedisClient) MGet(key string) *MResult

func (*RedisClient) Set

func (c *RedisClient) Set(key string, value interface{}, ops ...*Operation) *Result

type Result

type Result struct {
	Value interface{}
	Error error
}

func NewResult

func NewResult(value interface{}, error error) *Result

func (*Result) Result

func (c *Result) Result(v ...interface{}) interface{}

Jump to

Keyboard shortcuts

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