redis

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 10 Imported by: 4

README

REDIS

One redis service for fns

Install

go get github.com/aacfactory/fns-contrib/databases/redis

Usage

Config
  • Standalone type
    • addr size is one
  • Cluster type
    • all in addr is members

Example

redis:
  db:
    addr: 
      - "ip:port"
    username: ""
    password: ""
    db: 0
    poolSize: 0
Deploy
app.Deply(redis.Service())
Use service client
// get
result, err := redis.Get(ctx, key)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decr

func Decr(ctx context.Context, key string) (v int64, err errors.CodeError)

func DecrBy added in v1.0.0

func DecrBy(ctx context.Context, param DecrByParam) (v int64, err errors.CodeError)

func Del added in v1.0.0

func Del(ctx context.Context, keys []string) (err errors.CodeError)

func Discard added in v1.0.0

func Discard(ctx context.Context) (err errors.CodeError)

func Exists added in v1.0.0

func Exists(ctx context.Context, key string) (has bool, err errors.CodeError)

func Expire

func Expire(ctx context.Context, param ExpireParam) (err errors.CodeError)

func Incr

func Incr(ctx context.Context, key string) (v int64, err errors.CodeError)

func IncrBy added in v1.0.0

func IncrBy(ctx context.Context, param IncrByParam) (v int64, err errors.CodeError)

func Keys added in v1.0.0

func Keys(ctx context.Context, pattern string) (values []string, err errors.CodeError)

func MGet added in v1.0.0

func MGet(ctx context.Context, keys []string) (v map[string]string, err errors.CodeError)

func MSet added in v1.0.0

func MSet(ctx context.Context, param MSetParam) (err errors.CodeError)

func Persist

func Persist(ctx context.Context, key string) (err errors.CodeError)

func Pipeline added in v1.0.0

func Pipeline(ctx context.Context, tx bool) (err errors.CodeError)

func Service

func Service(databases ...string) service.Service

func Set

func Set(ctx context.Context, param SetParam) (err errors.CodeError)

func SetEx added in v1.0.0

func SetEx(ctx context.Context, param SetParam) (err errors.CodeError)

func SetNx added in v1.0.0

func SetNx(ctx context.Context, param SetParam) (err errors.CodeError)

func Sort added in v1.0.0

func Sort(ctx context.Context, param SortParam) (v []string, err errors.CodeError)

func WithOptions added in v1.0.0

func WithOptions(ctx context.Context, options ...ProxyOption) context.Context

func ZAdd

func ZAdd(ctx context.Context, param ZAddParam) (v int64, err errors.CodeError)

func ZCard

func ZCard(ctx context.Context, param ZCardParam) (v int64, err errors.CodeError)

func ZCount added in v1.0.0

func ZCount(ctx context.Context, param ZCountParam) (v int64, err errors.CodeError)

func ZRange

func ZRange(ctx context.Context, param ZRangeParam) (v []string, err errors.CodeError)

func ZRangeByScore added in v1.0.0

func ZRangeByScore(ctx context.Context, param ZRangeByScoreParam) (v []string, err errors.CodeError)

func ZRem

func ZRem(ctx context.Context, param ZRemParam) (v int64, err errors.CodeError)

func ZRemRangeByRank added in v1.0.0

func ZRemRangeByRank(ctx context.Context, param ZRemByRangeParam) (v int64, err errors.CodeError)

func ZRemRangeByScore added in v1.0.0

func ZRemRangeByScore(ctx context.Context, param ZRemByScoreParam) (v int64, err errors.CodeError)

Types

type DecrByParam added in v1.0.0

type DecrByParam struct {
	Key   string
	Value int64
}

type ExecResult added in v1.0.0

type ExecResult struct {
	Finished bool
	Cmders   []ExecResultCmder
}

type ExecResultCmder added in v1.0.0

type ExecResultCmder struct {
	Name  string
	Error string
}

func Exec added in v1.0.0

func Exec(ctx context.Context) (v []ExecResultCmder, err errors.CodeError)

type ExpireParam

type ExpireParam struct {
	Key        string
	Expiration time.Duration
}

type GetResult added in v0.6.0

type GetResult struct {
	Has   bool
	Value string
}

func Get

func Get(ctx context.Context, key string) (v GetResult, err errors.CodeError)

func GetSet added in v0.6.0

func GetSet(ctx context.Context, param GetSetParam) (v GetResult, err errors.CodeError)

type GetSetParam added in v1.0.0

type GetSetParam struct {
	Key   string
	Value string
}

type IncrByParam added in v1.0.0

type IncrByParam struct {
	Key   string
	Value int64
}

type KeyPair added in v1.0.0

type KeyPair struct {
	Key   string
	Value string
}

type KeysParam added in v1.0.0

type KeysParam struct {
	Pattern string
}

type KeysResult added in v1.0.0

type KeysResult struct {
	Values []string
}

type MSetParam added in v1.0.0

type MSetParam []KeyPair

type PipelineParam added in v1.0.0

type PipelineParam struct {
	Tx bool
}

type ProxyOption added in v1.0.0

type ProxyOption func(*ProxyOptions)

func Database added in v1.0.0

func Database(name string) ProxyOption

type ProxyOptions added in v1.0.0

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

type ScanParam added in v1.0.0

type ScanParam struct {
	Cursor uint64
	Match  string
	Count  int64
}

type ScanResult added in v1.0.0

type ScanResult struct {
	Keys []string
	Next uint64
}

func Scan added in v1.0.0

func Scan(ctx context.Context, param ScanParam) (r ScanResult, err errors.CodeError)

type SetParam

type SetParam struct {
	Key        string
	Value      string
	Expiration time.Duration
}

type SortParam added in v1.0.0

type SortParam struct {
	Key    string
	By     string
	Offset int64
	Count  int64
	Get    []string
	Order  string
	Alpha  bool
}

type Z added in v1.0.0

type Z struct {
	Score float64
	Value string
}

type ZAddParam

type ZAddParam struct {
	Key    string
	Values []Z
}

type ZCardParam added in v1.0.0

type ZCardParam struct {
	Key string
}

type ZCountParam added in v1.0.0

type ZCountParam struct {
	Key string
	Min string
	Max string
}

type ZRangeByScoreParam

type ZRangeByScoreParam struct {
	Key    string
	Min    string
	Max    string
	Offset int64
	Count  int64
}

type ZRangeParam

type ZRangeParam struct {
	Key   string
	Start int64
	Stop  int64
}

type ZRemByRangeParam added in v1.0.0

type ZRemByRangeParam struct {
	Key   string
	Start int64
	Stop  int64
}

type ZRemByScoreParam

type ZRemByScoreParam struct {
	Key string
	Min string
	Max string
}

type ZRemParam

type ZRemParam struct {
	Key    string
	Values []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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