redis

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = document.ErrInvalid
View Source
var ErrNotExist = document.ErrNotExist
View Source
var ErrNotSupported = document.ErrNotSupported

Functions

func NewService

func NewService() query.Service

NewService returns a new Redis service instance.

Types

type Conn

type Conn = redis.Conn

type HashObject added in v1.3.0

type HashObject map[string]string

HashObject represents a hash object.

func (HashObject) Del added in v1.3.0

func (obj HashObject) Del(fields []string) int

func (HashObject) Set added in v1.3.0

func (obj HashObject) Set(field string, val string, opt redis.HSetOption) int

nolint: ifshort

type Key added in v1.3.0

type Key = document.Key

func NewDocumentKeyWith added in v1.3.0

func NewDocumentKeyWith(dbid redis.DatabaseID, key string) Key

NewDocumentKeyWith returns a new document key.

type Message

type Message = redis.Message

type Service

type Service struct {
	*redis.Server
	*query.BaseService
}

Service represents a new Redis service instance.

func (*Service) Auth added in v1.3.0

func (service *Service) Auth(conn *Conn, username string, password string) (*Message, error)

Auth authenticates a client.

func (*Service) Del

func (service *Service) Del(conn *Conn, keys []string) (*Message, error)

func (*Service) Exists

func (service *Service) Exists(conn *Conn, keys []string) (*Message, error)

func (*Service) Expire

func (service *Service) Expire(conn *Conn, key string, opt redis.ExpireOption) (*Message, error)

func (*Service) Get

func (service *Service) Get(conn *Conn, key string) (*Message, error)

func (*Service) GetDatabase

func (service *Service) GetDatabase(ctx context.Context, dbid redis.DatabaseID) (store.Database, error)

GetDatabase returns the database with the specified ID.

func (*Service) GetServiceConfigRequirepass added in v1.3.0

func (service *Service) GetServiceConfigRequirepass() (string, error)

GetServiceConfigRequirepass returns the requirepass value of the service.

func (*Service) HDel

func (service *Service) HDel(conn *Conn, key string, fields []string) (*Message, error)

func (*Service) HGet

func (service *Service) HGet(conn *Conn, key string, field string) (*Message, error)

func (*Service) HGetAll

func (service *Service) HGetAll(conn *Conn, key string) (*Message, error)

func (*Service) HSet

func (service *Service) HSet(conn *Conn, key string, field string, val string, opt redis.HSetOption) (*Message, error)

func (*Service) Keys

func (service *Service) Keys(conn *Conn, pattern string) (*Message, error)

func (*Service) LIndex

func (service *Service) LIndex(conn *Conn, key string, index int) (*Message, error)

func (*Service) LLen

func (service *Service) LLen(conn *Conn, key string) (*Message, error)

func (*Service) LPop

func (service *Service) LPop(conn *Conn, key string, count int) (*Message, error)

func (*Service) LPush

func (service *Service) LPush(conn *Conn, key string, elements []string, opt redis.PushOption) (*Message, error)

func (*Service) LRange

func (service *Service) LRange(conn *Conn, key string, start int, stop int) (*Message, error)

func (*Service) RPop

func (service *Service) RPop(conn *Conn, key string, count int) (*Message, error)

func (*Service) RPush

func (service *Service) RPush(conn *Conn, key string, elements []string, opt redis.PushOption) (*Message, error)

func (*Service) Rename

func (service *Service) Rename(conn *Conn, key string, newkey string, opt redis.RenameOption) (*Message, error)

func (*Service) SAdd

func (service *Service) SAdd(conn *Conn, key string, members []string) (*Message, error)

func (*Service) SMembers

func (service *Service) SMembers(conn *Conn, key string) (*Message, error)

func (*Service) SRem

func (service *Service) SRem(conn *Conn, key string, members []string) (*Message, error)

func (*Service) ServiceName

func (service *Service) ServiceName() string

ServiceName returns the plug-in service name.

func (*Service) Set

func (service *Service) Set(conn *Conn, key string, val string, opt redis.SetOption) (*Message, error)

func (*Service) SetConfig added in v1.0.0

func (service *Service) SetConfig(conf config.Config)

SetConfig overrides redis.Server::SetConfig() to sets the specified plug-in configuration.

func (*Service) Start

func (service *Service) Start() error

Start starts the service.

func (*Service) Stop

func (service *Service) Stop() error

Stop stops the service.

func (*Service) TTL

func (service *Service) TTL(conn *Conn, key string) (*Message, error)

func (*Service) TransactDatabase added in v1.3.0

func (service *Service) TransactDatabase(ctx context.Context, conn *Conn, write bool) (*Transaction, error)

TransactDatabase returns a transaction for the database with the specified ID.

func (*Service) Type

func (service *Service) Type(conn *Conn, key string) (*Message, error)

func (*Service) ZAdd

func (service *Service) ZAdd(conn *Conn, key string, members []*redis.ZSetMember, opt redis.ZAddOption) (*Message, error)

func (*Service) ZIncBy

func (service *Service) ZIncBy(conn *Conn, key string, inc float64, member string) (*Message, error)

func (*Service) ZRange

func (service *Service) ZRange(conn *Conn, key string, start int, stop int, opt redis.ZRangeOption) (*Message, error)

func (*Service) ZRangeByScore

func (service *Service) ZRangeByScore(conn *Conn, key string, min float64, max float64, opt redis.ZRangeOption) (*Message, error)

func (*Service) ZRem

func (service *Service) ZRem(conn *Conn, key string, members []string) (*Message, error)

func (*Service) ZScore

func (service *Service) ZScore(conn *Conn, key string, member string) (*Message, error)

type Transaction added in v1.3.0

type Transaction struct {
	store.Transaction
	redis.DatabaseID
}

func (*Transaction) CancelWithError added in v1.3.0

func (txn *Transaction) CancelWithError(ctx context.Context, err error) error

CancelWithError cancels the transaction with an error.

func (*Transaction) GetKeyHashObject added in v1.3.0

func (txn *Transaction) GetKeyHashObject(ctx context.Context, key string) (HashObject, error)

GetKeyHashObject returns the hash objects with the specified key.

func (*Transaction) GetKeyObject added in v1.3.0

func (txn *Transaction) GetKeyObject(ctx context.Context, key string) (any, error)

GetKeyObject returns the object with the specified key.

func (*Transaction) GetKeyObjects added in v1.3.0

func (txn *Transaction) GetKeyObjects(ctx context.Context, key string) ([]any, error)

GetKeyObjects returns the objects with the specified key.

func (*Transaction) GetKeyString added in v1.3.0

func (txn *Transaction) GetKeyString(ctx context.Context, key string) (string, error)

GetKeyString returns the string with the specified key.

func (*Transaction) SetKeyHashObject added in v1.3.0

func (txn *Transaction) SetKeyHashObject(ctx context.Context, key string, val HashObject) error

SetKeyHashObject sets the objects with the specified key.

func (*Transaction) SetKeyObject added in v1.3.0

func (txn *Transaction) SetKeyObject(ctx context.Context, key string, val any) error

SetKeyObject sets the objects with the specified key.

Jump to

Keyboard shortcuts

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