redis

package
v0.0.0-...-120cf50 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STRING = "string"
	HASH   = "hash"
	LIST   = "list"
	SET    = "set"
	ZSET   = "zset"
)

Variables

This section is empty.

Functions

func DelItem

func DelItem(conn RdsConn, args ...interface{}) error

func GetItem

func GetItem(conn RdsConn, target interface{}, args ...interface{}) error

func IsExist

func IsExist(conn RdsConn, cmd string, args ...interface{}) bool

是否存在

func PubRds

func PubRds(conn RdsConn, key string, msg []byte) error

发布

func SaveItem

func SaveItem(conn RdsConn, target interface{}, args ...interface{}) error

func SubRds

func SubRds(conn RdsConn, key string, subC chan []byte, ctx context.Context) error

订阅 阻塞

Types

type Model

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

func NewModel

func NewModel(p *RdsPool, t string, keys ...interface{}) *Model

func (*Model) Close

func (m *Model) Close() error

func (*Model) Create

func (m *Model) Create(content interface{}) error

func (*Model) Del

func (m *Model) Del() error

func (*Model) Do

func (m *Model) Do(args ...interface{}) error

func (*Model) Get

func (m *Model) Get(content interface{}) error

func (*Model) Update

func (m *Model) Update(content interface{}) error

type RdsConfig

type RdsConfig struct {
	PoolCapa int    `json:"PoolCapa"`
	InitNum  int    `json:"InitNum"`
	Addr     string `json:"Addr"`
	PassWord string `json:"PassWord"`
}

func (*RdsConfig) Name

func (conf *RdsConfig) Name() string

type RdsConn

type RdsConn redis.Conn

func Dial

func Dial(url string) (RdsConn, error)

获得redis的连接

type RdsDb

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

func NewRdsDb

func NewRdsDb(conf *RdsConfig) (*RdsDb, error)

func (*RdsDb) Close

func (rds *RdsDb) Close() error

func (*RdsDb) Name

func (rds *RdsDb) Name() string

func (*RdsDb) Where

func (rds *RdsDb) Where(...interface{}) def.ModelI

type RdsPool

type RdsPool struct {
	Capa int //连接池容量
	// contains filtered or unexported fields
}

func NewRdsPool

func NewRdsPool(capa int) *RdsPool

func (*RdsPool) Clean

func (p *RdsPool) Clean()

func (*RdsPool) Close

func (p *RdsPool) Close() error

func (*RdsPool) Dial

func (p *RdsPool) Dial(url string, num int) error

func (*RdsPool) Get

func (p *RdsPool) Get() RdsConn

func (*RdsPool) Put

func (p *RdsPool) Put(conn RdsConn)

Jump to

Keyboard shortcuts

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