rueidiscompatmock

package module
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

README

Go-redis like API Mock Adapter

rueidiscompat exists as a very close interface to go-redis's Cmdable interface, but there is not a test helper that mirrors go-redis's ClientMock
interface. This package aims to do that.

Usage example

package main

import (
	"context"
	"testing"

	"github.com/redis/rueidis/mock"
	"github.com/redis/rueidis/rueidiscompat"
	"github.com/redis/rueidis/rueidiscompatmock"
	"go.uber.org/mock/gomock"
)

func TestExample(t *testing.T) {
	ctrl := gomock.NewController(t)
	m := mock.NewClient(ctrl)
	compatmock := rueidiscompatmock.NewAdapter(m)

	compatmock.ExpectSet("key", "val", 0).SetVal("OK")
	compatmock.ExpectGet("key").SetVal("val")

	rdb := rueidiscompat.NewAdapter(m)
	rdb.Set(context.Background(), "key", "val", 0)
	rdb.Get(context.Background(), "key")
}

Pipeline example

Pipelined commands use the same Expect* calls as non-pipelined commands. Expectations are matched in the order they are queued, mirroring go-redis/redismock.

compatmock.ExpectGet("k1").SetVal("v1")
compatmock.ExpectSet("k2", "v2", 0).SetVal("OK")

p := rdb.Pipeline()
p.Get(ctx, "k1")
p.Set(ctx, "k2", "v2", 0)
p.Exec(ctx)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientMock added in v1.0.77

func NewClientMock() (*Client, ClientMock)

Types

type Client added in v1.0.77

type Client struct {
	rueidiscompat.Cmdable
	// contains filtered or unexported fields
}

func (*Client) Close added in v1.0.77

func (c *Client) Close() error

func (*Client) Do added in v1.0.77

func (c *Client) Do(ctx context.Context, args ...any) *rueidiscompat.Cmd

type ClientMock

type ClientMock interface {
	Regexp() *clientMock
	CustomMatch(fn CustomMatch) *clientMock
	MatchExpectationsInOrder(b bool)
	ClearExpect()
	ExpectationsWereMet() error
	ExpectGet(key string) *ExpectedString
	ExpectSet(key string, value any, expiration time.Duration) *ExpectedStatus
	ExpectSetNX(key string, value any, expiration time.Duration) *ExpectedBool
	ExpectGetSet(key string, value any) *ExpectedString
	ExpectAppend(key, value string) *ExpectedInt
	ExpectStrLen(key string) *ExpectedInt
	ExpectDel(keys ...string) *ExpectedInt
	ExpectExists(keys ...string) *ExpectedInt
	ExpectType(key string) *ExpectedStatus
	ExpectTTL(key string) *ExpectedDuration
	ExpectExpire(key string, expiration time.Duration) *ExpectedBool
	ExpectPing() *ExpectedStatus
	ExpectEcho(message any) *ExpectedString
	ExpectIncr(key string) *ExpectedInt
	ExpectIncrBy(key string, value int64) *ExpectedInt
	ExpectDecr(key string) *ExpectedInt
	ExpectDecrBy(key string, value int64) *ExpectedInt
	ExpectMGet(keys ...string) *ExpectedSlice
	ExpectMSet(values ...any) *ExpectedStatus
	ExpectHGet(key, field string) *ExpectedString
	ExpectHSet(key string, values ...any) *ExpectedInt
	ExpectHDel(key string, fields ...string) *ExpectedInt
	ExpectHGetAll(key string) *ExpectedMapStringString
	ExpectLPush(key string, elements ...any) *ExpectedInt
	ExpectRPush(key string, elements ...any) *ExpectedInt
	ExpectLPop(key string) *ExpectedString
	ExpectRPop(key string) *ExpectedString
	ExpectLLen(key string) *ExpectedInt
	ExpectSAdd(key string, members ...any) *ExpectedInt
	ExpectSRem(key string, members ...any) *ExpectedInt
	ExpectSMembers(key string) *ExpectedStringSlice
	ExpectEval(script string, keys []string, args ...any) *ExpectedCmd
	ExpectDo(args ...any) *ExpectedCmd
	ExpectGetEx(key string, expiration time.Duration) *ExpectedString
	ExpectGetDel(key string) *ExpectedString
	ExpectGetRange(key string, start, end int64) *ExpectedString
	ExpectSetEx(key string, value any, expiration time.Duration) *ExpectedStatus
	ExpectSetXX(key string, value any, expiration time.Duration) *ExpectedBool
	ExpectSetRange(key string, offset int64, value string) *ExpectedInt
	ExpectMSetNX(values ...any) *ExpectedBool
	ExpectIncrByFloat(key string, increment float64) *ExpectedFloat
	ExpectGetBit(key string, offset int64) *ExpectedInt
	ExpectSetBit(key string, offset int64, value int) *ExpectedInt
	ExpectBitCount(key string, bitCount *rueidiscompat.BitCount) *ExpectedInt
	ExpectBitOpAnd(destKey string, keys ...string) *ExpectedInt
	ExpectBitOpOr(destKey string, keys ...string) *ExpectedInt
	ExpectBitOpXor(destKey string, keys ...string) *ExpectedInt
	ExpectBitOpNot(destKey, key string) *ExpectedInt
	ExpectUnlink(keys ...string) *ExpectedInt
	ExpectExpireAt(key string, tm time.Time) *ExpectedBool
	ExpectExpireNX(key string, expiration time.Duration) *ExpectedBool
	ExpectExpireXX(key string, expiration time.Duration) *ExpectedBool
	ExpectExpireGT(key string, expiration time.Duration) *ExpectedBool
	ExpectExpireLT(key string, expiration time.Duration) *ExpectedBool
	ExpectExpireTime(key string) *ExpectedDuration
	ExpectPExpire(key string, expiration time.Duration) *ExpectedBool
	ExpectPExpireAt(key string, tm time.Time) *ExpectedBool
	ExpectPExpireTime(key string) *ExpectedDuration
	ExpectPTTL(key string) *ExpectedDuration
	ExpectPersist(key string) *ExpectedBool
	ExpectRandomKey() *ExpectedString
	ExpectRename(key, newkey string) *ExpectedStatus
	ExpectRenameNX(key, newkey string) *ExpectedBool
	ExpectMove(key string, db int) *ExpectedBool
	ExpectObjectEncoding(key string) *ExpectedString
	ExpectObjectIdleTime(key string) *ExpectedDuration
	ExpectObjectRefCount(key string) *ExpectedInt
	ExpectTouch(keys ...string) *ExpectedInt
	ExpectCopy(source, destination string, db int, replace bool) *ExpectedInt
	ExpectHExists(key, field string) *ExpectedBool
	ExpectHKeys(key string) *ExpectedStringSlice
	ExpectHLen(key string) *ExpectedInt
	ExpectHMGet(key string, fields ...string) *ExpectedSlice
	ExpectHMSet(key string, values ...any) *ExpectedBool
	ExpectHSetNX(key, field string, value any) *ExpectedBool
	ExpectHVals(key string) *ExpectedStringSlice
	ExpectHIncrBy(key, field string, incr int64) *ExpectedInt
	ExpectHIncrByFloat(key, field string, incr float64) *ExpectedFloat
	ExpectHRandField(key string, count int) *ExpectedStringSlice
	ExpectLIndex(key string, index int64) *ExpectedString
	ExpectLRange(key string, start, stop int64) *ExpectedStringSlice
	ExpectLRem(key string, count int64, value any) *ExpectedInt
	ExpectLSet(key string, index int64, value any) *ExpectedStatus
	ExpectLTrim(key string, start, stop int64) *ExpectedStatus
	ExpectLInsertBefore(key string, pivot, value any) *ExpectedInt
	ExpectLInsertAfter(key string, pivot, value any) *ExpectedInt
	ExpectLPushX(key string, values ...any) *ExpectedInt
	ExpectRPushX(key string, values ...any) *ExpectedInt
	ExpectRPopLPush(source, destination string) *ExpectedString
	ExpectBLPop(timeout time.Duration, keys ...string) *ExpectedStringSlice
	ExpectBRPop(timeout time.Duration, keys ...string) *ExpectedStringSlice
	ExpectSCard(key string) *ExpectedInt
	ExpectSDiff(keys ...string) *ExpectedStringSlice
	ExpectSDiffStore(destination string, keys ...string) *ExpectedInt
	ExpectSInter(keys ...string) *ExpectedStringSlice
	ExpectSInterStore(destination string, keys ...string) *ExpectedInt
	ExpectSIsMember(key string, member any) *ExpectedBool
	ExpectSMIsMember(key string, members ...any) *ExpectedBoolSlice
	ExpectSMove(source, destination string, member any) *ExpectedBool
	ExpectSPop(key string) *ExpectedString
	ExpectSPopN(key string, count int64) *ExpectedStringSlice
	ExpectSRandMember(key string) *ExpectedString
	ExpectSRandMemberN(key string, count int64) *ExpectedStringSlice
	ExpectSUnion(keys ...string) *ExpectedStringSlice
	ExpectSUnionStore(destination string, keys ...string) *ExpectedInt
	ExpectZCard(key string) *ExpectedInt
	ExpectZCount(key, min, max string) *ExpectedInt
	ExpectZIncrBy(key string, increment float64, member string) *ExpectedFloat
	ExpectZLexCount(key, min, max string) *ExpectedInt
	ExpectZRange(key string, start, stop int64) *ExpectedStringSlice
	ExpectZRevRange(key string, start, stop int64) *ExpectedStringSlice
	ExpectZRank(key, member string) *ExpectedInt
	ExpectZRevRank(key, member string) *ExpectedInt
	ExpectZRem(key string, members ...any) *ExpectedInt
	ExpectZRemRangeByLex(key, min, max string) *ExpectedInt
	ExpectZRemRangeByRank(key string, start, stop int64) *ExpectedInt
	ExpectZRemRangeByScore(key, min, max string) *ExpectedInt
	ExpectZScore(key, member string) *ExpectedFloat
	ExpectZMScore(key string, members ...string) *ExpectedFloatSlice
	ExpectZPopMax(key string, count ...int64) *ExpectedZSlice
	ExpectZPopMin(key string, count ...int64) *ExpectedZSlice
	ExpectPublish(channel string, message any) *ExpectedInt
	ExpectSPublish(channel string, message any) *ExpectedInt
	ExpectPubSubChannels(pattern string) *ExpectedStringSlice
	ExpectPubSubNumPat() *ExpectedInt
	ExpectPFAdd(key string, els ...any) *ExpectedInt
	ExpectPFCount(keys ...string) *ExpectedInt
	ExpectPFMerge(dest string, keys ...string) *ExpectedStatus
	ExpectLastSave() *ExpectedInt
	ExpectTime() *ExpectedTime
	ExpectInfo(sections ...string) *ExpectedString
	ExpectClientID() *ExpectedInt
	ExpectClientGetName() *ExpectedString
	ExpectReadOnly() *ExpectedStatus
	ExpectReadWrite() *ExpectedStatus
	ExpectEvalSha(sha string, keys []string, args ...any) *ExpectedCmd
	ExpectEvalRO(script string, keys []string, args ...any) *ExpectedCmd
	ExpectEvalShaRO(sha string, keys []string, args ...any) *ExpectedCmd
	ExpectClusterInfo() *ExpectedString
	ExpectClusterNodes() *ExpectedString
	ExpectClusterKeySlot(key string) *ExpectedInt
	ExpectBgRewriteAOF() *ExpectedStatus
	ExpectBgSave() *ExpectedStatus
	ExpectConfigGet(parameter string) *ExpectedMapStringString
	ExpectConfigResetStat() *ExpectedStatus
	ExpectConfigRewrite() *ExpectedStatus
	ExpectConfigSet(parameter, value string) *ExpectedStatus
	ExpectDBSize() *ExpectedInt
	ExpectDebugObject(key string) *ExpectedString
	ExpectFlushAll() *ExpectedStatus
	ExpectFlushAllAsync() *ExpectedStatus
	ExpectFlushDB() *ExpectedStatus
	ExpectFlushDBAsync() *ExpectedStatus
	ExpectMemoryUsage(key string, samples ...int) *ExpectedInt
	ExpectSave() *ExpectedStatus
	ExpectShutdown() *ExpectedStatus
	ExpectShutdownNoSave() *ExpectedStatus
	ExpectShutdownSave() *ExpectedStatus
	ExpectSlaveOf(host, port string) *ExpectedStatus
	ExpectSlowLogGet(num int64) *ExpectedSlowLog
	ExpectQuit() *ExpectedStatus
	ExpectCommand() *ExpectedCommandsInfo
	ExpectCommandGetKeys(commands ...any) *ExpectedStringSlice
	ExpectCommandGetKeysAndFlags(commands ...any) *ExpectedKeyFlags
	ExpectCommandList(filter any) *ExpectedStringSlice
	ExpectClientKill(ipPort string) *ExpectedStatus
	ExpectClientKillByFilter(keys ...string) *ExpectedInt
	ExpectClientList() *ExpectedString
	ExpectClientPause(dur time.Duration) *ExpectedBool
	ExpectClientUnpause() *ExpectedBool
	ExpectClientUnblock(id int64) *ExpectedInt
	ExpectClientUnblockWithError(id int64) *ExpectedInt
	ExpectClusterAddSlots(slots ...int) *ExpectedStatus
	ExpectClusterAddSlotsRange(min, max int) *ExpectedStatus
	ExpectClusterCountFailureReports(nodeID string) *ExpectedInt
	ExpectClusterCountKeysInSlot(slot int) *ExpectedInt
	ExpectClusterDelSlots(slots ...int) *ExpectedStatus
	ExpectClusterDelSlotsRange(min, max int) *ExpectedStatus
	ExpectClusterFailover() *ExpectedStatus
	ExpectClusterForget(nodeID string) *ExpectedStatus
	ExpectClusterGetKeysInSlot(slot int, count int) *ExpectedStringSlice
	ExpectClusterLinks() *ExpectedClusterLinks
	ExpectClusterMeet(host, port string) *ExpectedStatus
	ExpectClusterReplicate(nodeID string) *ExpectedStatus
	ExpectClusterResetHard() *ExpectedStatus
	ExpectClusterResetSoft() *ExpectedStatus
	ExpectClusterSaveConfig() *ExpectedStatus
	ExpectClusterShards() *ExpectedClusterShards
	ExpectClusterSlaves(nodeID string) *ExpectedStringSlice
	ExpectClusterSlots() *ExpectedClusterSlots
	ExpectACLDryRun(username string, command ...any) *ExpectedString
	ExpectBitField(key string, args ...any) *ExpectedIntSlice
	ExpectBitPos(key string, bit int64, pos ...int64) *ExpectedInt
	ExpectBitPosSpan(key string, bit int8, start, end int64, span string) *ExpectedInt
	ExpectDump(key string) *ExpectedString
	ExpectKeys(pattern string) *ExpectedStringSlice
	ExpectMigrate(host, port, key string, db int, timeout time.Duration) *ExpectedStatus
	ExpectRestore(key string, ttl time.Duration, serializedValue string) *ExpectedStatus
	ExpectRestoreReplace(key string, ttl time.Duration, serializedValue string) *ExpectedStatus
	ExpectScan(cursor uint64, match string, count int64) *ExpectedScan
	ExpectScanType(cursor uint64, match string, count int64, keyType string) *ExpectedScan
	ExpectHScan(key string, cursor uint64, match string, count int64) *ExpectedScan
	ExpectSScan(key string, cursor uint64, match string, count int64) *ExpectedScan
	ExpectSort(key string, sort *rueidiscompat.Sort) *ExpectedStringSlice
	ExpectSortInterfaces(key string, sort *rueidiscompat.Sort) *ExpectedSlice
	ExpectSortRO(key string, sort *rueidiscompat.Sort) *ExpectedStringSlice
	ExpectSortStore(key, store string, sort *rueidiscompat.Sort) *ExpectedInt
	ExpectBLMPop(timeout time.Duration, direction string, count int64, keys ...string) *ExpectedKeyValues
	ExpectBLMove(source, destination, srcpos, destpos string, timeout time.Duration) *ExpectedString
	ExpectBRPopLPush(source, destination string, timeout time.Duration) *ExpectedString
	ExpectHRandFieldWithValues(key string, count int) *ExpectedKeyValueSlice
	ExpectLCS(q *rueidiscompat.LCSQuery) *ExpectedLCS
	ExpectLInsert(key, op string, pivot, element any) *ExpectedInt
	ExpectLMPop(direction string, count int64, keys ...string) *ExpectedKeyValues
	ExpectLMove(source, destination, srcpos, destpos string) *ExpectedString
	ExpectLPopCount(key string, count int) *ExpectedStringSlice
	ExpectLPos(key string, element string, a rueidiscompat.LPosArgs) *ExpectedInt
	ExpectLPosCount(key string, element string, count int64, a rueidiscompat.LPosArgs) *ExpectedIntSlice
	ExpectRPopCount(key string, count int) *ExpectedStringSlice
	ExpectSInterCard(limit int64, keys ...string) *ExpectedInt
	ExpectSMembersMap(key string) *ExpectedStringStructMap
	ExpectSetArgs(key string, value any, a rueidiscompat.SetArgs) *ExpectedStatus
	ExpectGeoAdd(key string, geoLocation ...any) *ExpectedInt
	ExpectGeoDist(key, member1, member2, unit string) *ExpectedFloat
	ExpectGeoHash(key string, members ...string) *ExpectedStringSlice
	ExpectGeoPos(key string, members ...string) *ExpectedGeoPos
	ExpectGeoRadius(key string, longitude, latitude float64, query *rueidiscompat.GeoRadiusQuery) *ExpectedGeoLocation
	ExpectGeoRadiusByMember(key, member string, query *rueidiscompat.GeoRadiusQuery) *ExpectedGeoLocation
	ExpectGeoRadiusByMemberStore(key, member string, query *rueidiscompat.GeoRadiusQuery) *ExpectedInt
	ExpectGeoRadiusStore(key string, longitude, latitude float64, query *rueidiscompat.GeoRadiusQuery) *ExpectedInt
	ExpectGeoSearch(key string, q *rueidiscompat.GeoSearchQuery) *ExpectedStringSlice
	ExpectGeoSearchLocation(key string, q *rueidiscompat.GeoSearchLocationQuery) *ExpectedGeoSearchLocation
	ExpectGeoSearchStore(src, dest string, q *rueidiscompat.GeoSearchStoreQuery) *ExpectedInt
	ExpectBZMPop(timeout time.Duration, order string, count int64, keys ...string) *ExpectedZSliceWithKey
	ExpectBZPopMax(timeout time.Duration, keys ...string) *ExpectedZWithKey
	ExpectBZPopMin(timeout time.Duration, keys ...string) *ExpectedZWithKey
	ExpectZDiff(keys ...string) *ExpectedStringSlice
	ExpectZDiffStore(destination string, keys ...string) *ExpectedInt
	ExpectZDiffWithScores(keys ...string) *ExpectedZSlice
	ExpectZInterCard(limit int64, keys ...string) *ExpectedInt
	ExpectZMPop(order string, count int64, keys ...string) *ExpectedZSliceWithKey
	ExpectZRandMember(key string, count int) *ExpectedStringSlice
	ExpectZRandMemberWithScores(key string, count int) *ExpectedZSlice
	ExpectZRangeByLex(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedStringSlice
	ExpectZRangeByScore(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedStringSlice
	ExpectZRangeByScoreWithScores(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedZSlice
	ExpectZRangeStore(dst string, z rueidiscompat.ZRangeArgs) *ExpectedInt
	ExpectZRevRangeByLex(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedStringSlice
	ExpectZRevRangeByScore(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedStringSlice
	ExpectZRevRangeByScoreWithScores(key string, zRangeBy *rueidiscompat.ZRangeBy) *ExpectedZSlice
	ExpectZRevRangeWithScores(key string, start, stop int64) *ExpectedZSlice
	ExpectZScan(key string, cursor uint64, match string, count int64) *ExpectedScan
	ExpectZAdd(key string, members ...rueidiscompat.Z) *ExpectedInt
	ExpectZAddNX(key string, members ...rueidiscompat.Z) *ExpectedInt
	ExpectZAddXX(key string, members ...rueidiscompat.Z) *ExpectedInt
	ExpectZAddLT(key string, members ...rueidiscompat.Z) *ExpectedInt
	ExpectZAddGT(key string, members ...rueidiscompat.Z) *ExpectedInt
	ExpectZAddArgs(key string, args rueidiscompat.ZAddArgs) *ExpectedInt
	ExpectZAddArgsIncr(key string, args rueidiscompat.ZAddArgs) *ExpectedFloat
	ExpectZInter(store *rueidiscompat.ZStore) *ExpectedStringSlice
	ExpectZInterWithScores(store *rueidiscompat.ZStore) *ExpectedZSlice
	ExpectZInterStore(destination string, store *rueidiscompat.ZStore) *ExpectedInt
	ExpectZUnion(store rueidiscompat.ZStore) *ExpectedStringSlice
	ExpectZUnionWithScores(store rueidiscompat.ZStore) *ExpectedZSlice
	ExpectZUnionStore(dest string, store *rueidiscompat.ZStore) *ExpectedInt
	ExpectZRangeArgs(z rueidiscompat.ZRangeArgs) *ExpectedStringSlice
	ExpectZRangeArgsWithScores(z rueidiscompat.ZRangeArgs) *ExpectedZSlice
	ExpectZRangeWithScores(key string, start, stop int64) *ExpectedZSlice
	ExpectPubSubNumSub(channels ...string) *ExpectedMapStringInt
	ExpectPubSubShardChannels(pattern string) *ExpectedStringSlice
	ExpectPubSubShardNumSub(channels ...string) *ExpectedMapStringInt
	ExpectScriptExists(hashes ...string) *ExpectedBoolSlice
	ExpectScriptFlush() *ExpectedStatus
	ExpectScriptKill() *ExpectedStatus
	ExpectScriptLoad(script string) *ExpectedString
	ExpectFCall(function string, keys []string, args ...any) *ExpectedCmd
	ExpectFCallRo(function string, keys []string, args ...any) *ExpectedCmd
	ExpectFunctionDelete(libName string) *ExpectedString
	ExpectFunctionDump() *ExpectedString
	ExpectFunctionFlush() *ExpectedString
	ExpectFunctionFlushAsync() *ExpectedString
	ExpectFunctionKill() *ExpectedString
	ExpectFunctionList(q rueidiscompat.FunctionListQuery) *ExpectedFunctionList
	ExpectFunctionLoad(code string) *ExpectedString
	ExpectFunctionLoadReplace(code string) *ExpectedString
	ExpectFunctionRestore(libDump string) *ExpectedString
	ExpectXAck(stream, group string, ids ...string) *ExpectedInt
	ExpectXAdd(args any) *ExpectedString
	ExpectXAutoClaim(args any) *ExpectedXAutoClaim
	ExpectXAutoClaimJustID(args any) *ExpectedXAutoClaimJustID
	ExpectXClaim(args any) *ExpectedXMessageSlice
	ExpectXClaimJustID(args any) *ExpectedStringSlice
	ExpectXDel(stream string, ids ...string) *ExpectedInt
	ExpectXGroupCreate(stream, group, start string) *ExpectedStatus
	ExpectXGroupCreateConsumer(stream, group, consumer string) *ExpectedInt
	ExpectXGroupCreateMkStream(stream, group, start string) *ExpectedStatus
	ExpectXGroupDelConsumer(stream, group, consumer string) *ExpectedInt
	ExpectXGroupDestroy(stream, group string) *ExpectedInt
	ExpectXGroupSetID(stream, group, start string) *ExpectedStatus
	ExpectXInfoConsumers(key, group string) *ExpectedXInfoConsumers
	ExpectXInfoGroups(key string) *ExpectedXInfoGroups
	ExpectXInfoStream(key string) *ExpectedXInfoStream
	ExpectXInfoStreamFull(key string, count int) *ExpectedXInfoStreamFull
	ExpectXLen(stream string) *ExpectedInt
	ExpectXPending(stream, group string) *ExpectedXPending
	ExpectXPendingExt(args any) *ExpectedXPendingExt
	ExpectXRange(stream, start, stop string) *ExpectedXMessageSlice
	ExpectXRangeN(stream, start, stop string, count int64) *ExpectedXMessageSlice
	ExpectXRead(args any) *ExpectedXStreamSlice
	ExpectXReadGroup(args any) *ExpectedXStreamSlice
	ExpectXReadStreams(streams ...string) *ExpectedXStreamSlice
	ExpectXRevRange(stream, start, stop string) *ExpectedXMessageSlice
	ExpectXRevRangeN(stream, start, stop string, count int64) *ExpectedXMessageSlice
	ExpectXTrimMaxLen(key string, maxLen int64) *ExpectedInt
	ExpectXTrimMaxLenApprox(key string, maxLen, limit int64) *ExpectedInt
	ExpectXTrimMinID(key string, minID string) *ExpectedInt
	ExpectXTrimMinIDApprox(key string, minID string, limit int64) *ExpectedInt
	ExpectTxPipeline()
	ExpectTxPipelineExec() *ExpectedSlice
	ExpectWatch(keys ...string) *ExpectedError
}

func NewAdapter

func NewAdapter(m *mock.Client) ClientMock

type CustomMatch added in v1.0.77

type CustomMatch func(expected, actual []interface{}) error

type ExpectedBool

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

func (*ExpectedBool) SetErr

func (e *ExpectedBool) SetErr(err error)

func (*ExpectedBool) SetVal

func (e *ExpectedBool) SetVal(v bool)

type ExpectedBoolSlice added in v1.0.77

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

func (*ExpectedBoolSlice) SetErr added in v1.0.77

func (e *ExpectedBoolSlice) SetErr(err error)

func (*ExpectedBoolSlice) SetVal added in v1.0.77

func (e *ExpectedBoolSlice) SetVal(v []bool)
type ExpectedClusterLinks struct {
	// contains filtered or unexported fields
}

func (*ExpectedClusterLinks) SetErr added in v1.0.77

func (e *ExpectedClusterLinks) SetErr(err error)

func (*ExpectedClusterLinks) SetVal added in v1.0.77

type ExpectedClusterShards added in v1.0.77

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

func (*ExpectedClusterShards) SetErr added in v1.0.77

func (e *ExpectedClusterShards) SetErr(err error)

func (*ExpectedClusterShards) SetVal added in v1.0.77

type ExpectedClusterSlots added in v1.0.77

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

func (*ExpectedClusterSlots) SetErr added in v1.0.77

func (e *ExpectedClusterSlots) SetErr(err error)

func (*ExpectedClusterSlots) SetVal added in v1.0.77

type ExpectedCmd

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

func (*ExpectedCmd) RedisNil

func (e *ExpectedCmd) RedisNil()

func (*ExpectedCmd) SetErr

func (e *ExpectedCmd) SetErr(err error)

func (*ExpectedCmd) SetVal

func (e *ExpectedCmd) SetVal(v any)

func (*ExpectedCmd) SetValInt

func (e *ExpectedCmd) SetValInt(v int64) *ExpectedCmd

type ExpectedCommandsInfo added in v1.0.77

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

func (*ExpectedCommandsInfo) SetErr added in v1.0.77

func (e *ExpectedCommandsInfo) SetErr(err error)

func (*ExpectedCommandsInfo) SetVal added in v1.0.77

type ExpectedDuration

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

func (*ExpectedDuration) SetErr

func (e *ExpectedDuration) SetErr(err error)

func (*ExpectedDuration) SetVal

func (e *ExpectedDuration) SetVal(v time.Duration)

type ExpectedError added in v1.0.77

type ExpectedError = ExpectedStatus

type ExpectedFloat added in v1.0.77

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

func (*ExpectedFloat) SetErr added in v1.0.77

func (e *ExpectedFloat) SetErr(err error)

func (*ExpectedFloat) SetVal added in v1.0.77

func (e *ExpectedFloat) SetVal(v float64)

type ExpectedFloatSlice added in v1.0.77

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

func (*ExpectedFloatSlice) SetErr added in v1.0.77

func (e *ExpectedFloatSlice) SetErr(err error)

func (*ExpectedFloatSlice) SetVal added in v1.0.77

func (e *ExpectedFloatSlice) SetVal(v []float64)

type ExpectedFunctionList added in v1.0.77

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

func (*ExpectedFunctionList) SetErr added in v1.0.77

func (e *ExpectedFunctionList) SetErr(err error)

func (*ExpectedFunctionList) SetVal added in v1.0.77

type ExpectedGeoLocation added in v1.0.77

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

func (*ExpectedGeoLocation) SetErr added in v1.0.77

func (e *ExpectedGeoLocation) SetErr(err error)

func (*ExpectedGeoLocation) SetVal added in v1.0.77

type ExpectedGeoPos added in v1.0.77

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

func (*ExpectedGeoPos) SetErr added in v1.0.77

func (e *ExpectedGeoPos) SetErr(err error)

func (*ExpectedGeoPos) SetVal added in v1.0.77

func (e *ExpectedGeoPos) SetVal(v []*rueidiscompat.GeoPos)

type ExpectedGeoSearchLocation added in v1.0.77

type ExpectedGeoSearchLocation = ExpectedGeoLocation

type ExpectedInt

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

func (*ExpectedInt) SetErr

func (e *ExpectedInt) SetErr(err error)

func (*ExpectedInt) SetVal

func (e *ExpectedInt) SetVal(v int64)

type ExpectedIntSlice added in v1.0.77

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

func (*ExpectedIntSlice) SetErr added in v1.0.77

func (e *ExpectedIntSlice) SetErr(err error)

func (*ExpectedIntSlice) SetVal added in v1.0.77

func (e *ExpectedIntSlice) SetVal(v []int64)

type ExpectedKeyFlags added in v1.0.77

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

func (*ExpectedKeyFlags) SetErr added in v1.0.77

func (e *ExpectedKeyFlags) SetErr(err error)

func (*ExpectedKeyFlags) SetVal added in v1.0.77

func (e *ExpectedKeyFlags) SetVal(v []rueidiscompat.KeyFlags)

type ExpectedKeyValueSlice added in v1.0.77

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

func (*ExpectedKeyValueSlice) SetErr added in v1.0.77

func (e *ExpectedKeyValueSlice) SetErr(err error)

func (*ExpectedKeyValueSlice) SetVal added in v1.0.77

type ExpectedKeyValues added in v1.0.77

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

func (*ExpectedKeyValues) SetErr added in v1.0.77

func (e *ExpectedKeyValues) SetErr(err error)

func (*ExpectedKeyValues) SetVal added in v1.0.77

func (e *ExpectedKeyValues) SetVal(key string, vals []string)

type ExpectedLCS added in v1.0.77

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

func (*ExpectedLCS) SetErr added in v1.0.77

func (e *ExpectedLCS) SetErr(err error)

func (*ExpectedLCS) SetVal added in v1.0.77

func (e *ExpectedLCS) SetVal(v *rueidiscompat.LCSMatch)

type ExpectedMapStringInt added in v1.0.77

type ExpectedMapStringInt = ExpectedStringIntMap

type ExpectedMapStringString added in v1.0.77

type ExpectedMapStringString = ExpectedStringStringMap

type ExpectedOKBool added in v1.0.77

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

func (*ExpectedOKBool) SetErr added in v1.0.77

func (e *ExpectedOKBool) SetErr(err error)

func (*ExpectedOKBool) SetVal added in v1.0.77

func (e *ExpectedOKBool) SetVal(v bool)

type ExpectedRankWithScore added in v1.0.77

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

func (*ExpectedRankWithScore) RedisNil added in v1.0.77

func (e *ExpectedRankWithScore) RedisNil()

func (*ExpectedRankWithScore) SetErr added in v1.0.77

func (e *ExpectedRankWithScore) SetErr(err error)

func (*ExpectedRankWithScore) SetVal added in v1.0.77

type ExpectedScan added in v1.0.77

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

func (*ExpectedScan) SetErr added in v1.0.77

func (e *ExpectedScan) SetErr(err error)

func (*ExpectedScan) SetVal added in v1.0.77

func (e *ExpectedScan) SetVal(keys []string, cursor uint64)

type ExpectedScriptExists added in v1.0.77

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

func (*ExpectedScriptExists) SetErr added in v1.0.77

func (e *ExpectedScriptExists) SetErr(err error)

func (*ExpectedScriptExists) SetVal added in v1.0.77

func (e *ExpectedScriptExists) SetVal(v []bool)

type ExpectedSlice

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

func (*ExpectedSlice) SetErr

func (e *ExpectedSlice) SetErr(err error)

func (*ExpectedSlice) SetVal

func (e *ExpectedSlice) SetVal(v []any)

type ExpectedSlowLog added in v1.0.77

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

func (*ExpectedSlowLog) SetErr added in v1.0.77

func (e *ExpectedSlowLog) SetErr(err error)

func (*ExpectedSlowLog) SetVal added in v1.0.77

func (e *ExpectedSlowLog) SetVal(v []rueidiscompat.SlowLog)

type ExpectedStatus

type ExpectedStatus = ExpectedString

type ExpectedString

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

func (*ExpectedString) RedisNil

func (e *ExpectedString) RedisNil()

func (*ExpectedString) SetErr

func (e *ExpectedString) SetErr(err error)

func (*ExpectedString) SetVal

func (e *ExpectedString) SetVal(v string)

type ExpectedStringIntMap added in v1.0.77

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

func (*ExpectedStringIntMap) SetErr added in v1.0.77

func (e *ExpectedStringIntMap) SetErr(err error)

func (*ExpectedStringIntMap) SetVal added in v1.0.77

func (e *ExpectedStringIntMap) SetVal(v map[string]int64)

type ExpectedStringSlice

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

func (*ExpectedStringSlice) SetErr

func (e *ExpectedStringSlice) SetErr(err error)

func (*ExpectedStringSlice) SetVal

func (e *ExpectedStringSlice) SetVal(v []string)

type ExpectedStringStringMap

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

func (*ExpectedStringStringMap) SetErr

func (e *ExpectedStringStringMap) SetErr(err error)

func (*ExpectedStringStringMap) SetVal

func (e *ExpectedStringStringMap) SetVal(v map[string]string)

type ExpectedStringStructMap added in v1.0.77

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

func (*ExpectedStringStructMap) SetErr added in v1.0.77

func (e *ExpectedStringStructMap) SetErr(err error)

func (*ExpectedStringStructMap) SetVal added in v1.0.77

func (e *ExpectedStringStructMap) SetVal(v []string)

type ExpectedTime added in v1.0.77

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

func (*ExpectedTime) SetErr added in v1.0.77

func (e *ExpectedTime) SetErr(err error)

func (*ExpectedTime) SetVal added in v1.0.77

func (e *ExpectedTime) SetVal(v time.Time)

type ExpectedXAutoClaim added in v1.0.77

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

func (*ExpectedXAutoClaim) SetErr added in v1.0.77

func (e *ExpectedXAutoClaim) SetErr(err error)

func (*ExpectedXAutoClaim) SetVal added in v1.0.77

func (e *ExpectedXAutoClaim) SetVal(messages []rueidiscompat.XMessage, start string)

type ExpectedXAutoClaimJustID added in v1.0.77

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

func (*ExpectedXAutoClaimJustID) SetErr added in v1.0.77

func (e *ExpectedXAutoClaimJustID) SetErr(err error)

func (*ExpectedXAutoClaimJustID) SetVal added in v1.0.77

func (e *ExpectedXAutoClaimJustID) SetVal(ids []string, start string)

type ExpectedXInfoConsumers added in v1.0.77

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

func (*ExpectedXInfoConsumers) SetErr added in v1.0.77

func (e *ExpectedXInfoConsumers) SetErr(err error)

func (*ExpectedXInfoConsumers) SetVal added in v1.0.77

type ExpectedXInfoGroups added in v1.0.77

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

func (*ExpectedXInfoGroups) SetErr added in v1.0.77

func (e *ExpectedXInfoGroups) SetErr(err error)

func (*ExpectedXInfoGroups) SetVal added in v1.0.77

type ExpectedXInfoStream added in v1.0.77

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

func (*ExpectedXInfoStream) SetErr added in v1.0.77

func (e *ExpectedXInfoStream) SetErr(err error)

func (*ExpectedXInfoStream) SetVal added in v1.0.77

type ExpectedXInfoStreamFull added in v1.0.77

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

func (*ExpectedXInfoStreamFull) SetErr added in v1.0.77

func (e *ExpectedXInfoStreamFull) SetErr(err error)

func (*ExpectedXInfoStreamFull) SetVal added in v1.0.77

type ExpectedXMessageSlice added in v1.0.77

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

func (*ExpectedXMessageSlice) SetErr added in v1.0.77

func (e *ExpectedXMessageSlice) SetErr(err error)

func (*ExpectedXMessageSlice) SetVal added in v1.0.77

type ExpectedXPending added in v1.0.77

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

func (*ExpectedXPending) SetErr added in v1.0.77

func (e *ExpectedXPending) SetErr(err error)

func (*ExpectedXPending) SetVal added in v1.0.77

func (e *ExpectedXPending) SetVal(v *rueidiscompat.XPending)

type ExpectedXPendingExt added in v1.0.77

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

func (*ExpectedXPendingExt) SetErr added in v1.0.77

func (e *ExpectedXPendingExt) SetErr(err error)

func (*ExpectedXPendingExt) SetVal added in v1.0.77

type ExpectedXStreamSlice added in v1.0.77

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

func (*ExpectedXStreamSlice) SetErr added in v1.0.77

func (e *ExpectedXStreamSlice) SetErr(err error)

func (*ExpectedXStreamSlice) SetVal added in v1.0.77

type ExpectedZSlice added in v1.0.77

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

func (*ExpectedZSlice) SetErr added in v1.0.77

func (e *ExpectedZSlice) SetErr(err error)

func (*ExpectedZSlice) SetVal added in v1.0.77

func (e *ExpectedZSlice) SetVal(v []rueidiscompat.Z)

type ExpectedZSliceWithKey added in v1.0.77

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

func (*ExpectedZSliceWithKey) SetErr added in v1.0.77

func (e *ExpectedZSliceWithKey) SetErr(err error)

func (*ExpectedZSliceWithKey) SetVal added in v1.0.77

func (e *ExpectedZSliceWithKey) SetVal(key string, vals []rueidiscompat.Z)

type ExpectedZWithKey added in v1.0.77

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

func (*ExpectedZWithKey) RedisNil added in v1.0.77

func (e *ExpectedZWithKey) RedisNil()

func (*ExpectedZWithKey) SetErr added in v1.0.77

func (e *ExpectedZWithKey) SetErr(err error)

func (*ExpectedZWithKey) SetVal added in v1.0.77

func (e *ExpectedZWithKey) SetVal(v *rueidiscompat.ZWithKey)

Jump to

Keyboard shortcuts

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