diff --git a/bitmap_commands.go b/bitmap_commands.go index a21558289..3a9790518 100644 --- a/bitmap_commands.go +++ b/bitmap_commands.go @@ -12,7 +12,7 @@ type BitMapCmdable interface { BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd - BitOpNot(ctx context.Context, destKey string, key string) *IntCmd + BitOpNot(ctx context.Context, destKey, key string) *IntCmd BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *IntCmd BitField(ctx context.Context, key string, values ...interface{}) *IntSliceCmd @@ -42,8 +42,10 @@ type BitCount struct { Unit string // BYTE(default) | BIT } -const BitCountIndexByte string = "BYTE" -const BitCountIndexBit string = "BIT" +const ( + BitCountIndexByte string = "BYTE" + BitCountIndexBit string = "BIT" +) func (c cmdable) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd { args := make([]any, 2, 5) @@ -90,7 +92,7 @@ func (c cmdable) BitOpXor(ctx context.Context, destKey string, keys ...string) * return c.bitOp(ctx, "xor", destKey, keys...) } -func (c cmdable) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd { +func (c cmdable) BitOpNot(ctx context.Context, destKey, key string) *IntCmd { return c.bitOp(ctx, "not", destKey, key) } diff --git a/bitmap_commands_test.go b/bitmap_commands_test.go index f3cc3205f..14fc39603 100644 --- a/bitmap_commands_test.go +++ b/bitmap_commands_test.go @@ -3,6 +3,7 @@ package redis_test import ( . "github.com/bsm/ginkgo/v2" . "github.com/bsm/gomega" + "github.com/redis/go-redis/v9" ) @@ -31,7 +32,7 @@ var _ = Describe("BitCountBite", func() { }) It("bit count bite", func() { - var expected = []bitCountExpected{ + expected := []bitCountExpected{ {0, 0, 0}, {0, 1, 1}, {0, 2, 1}, @@ -71,7 +72,7 @@ var _ = Describe("BitCountByte", func() { }) It("bit count byte", func() { - var expected = []bitCountExpected{ + expected := []bitCountExpected{ {0, 0, 1}, {0, 1, 3}, } @@ -84,7 +85,7 @@ var _ = Describe("BitCountByte", func() { }) It("bit count byte with no unit specified", func() { - var expected = []bitCountExpected{ + expected := []bitCountExpected{ {0, 0, 1}, {0, 1, 3}, } diff --git a/cluster_commands.go b/cluster_commands.go index 0caf0977a..a1a799f72 100644 --- a/cluster_commands.go +++ b/cluster_commands.go @@ -15,7 +15,7 @@ type ClusterCmdable interface { ClusterResetHard(ctx context.Context) *StatusCmd ClusterInfo(ctx context.Context) *StringCmd ClusterKeySlot(ctx context.Context, key string) *IntCmd - ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd + ClusterGetKeysInSlot(ctx context.Context, slot, count int) *StringSliceCmd ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd @@ -101,7 +101,7 @@ func (c cmdable) ClusterKeySlot(ctx context.Context, key string) *IntCmd { return cmd } -func (c cmdable) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd { +func (c cmdable) ClusterGetKeysInSlot(ctx context.Context, slot, count int) *StringSliceCmd { cmd := NewStringSliceCmd(ctx, "cluster", "getkeysinslot", slot, count) _ = c(ctx, cmd) return cmd diff --git a/command.go b/command.go index 3cb9538a5..087972787 100644 --- a/command.go +++ b/command.go @@ -2020,7 +2020,7 @@ type XInfoConsumer struct { var _ Cmder = (*XInfoConsumersCmd)(nil) -func NewXInfoConsumersCmd(ctx context.Context, stream string, group string) *XInfoConsumersCmd { +func NewXInfoConsumersCmd(ctx context.Context, stream, group string) *XInfoConsumersCmd { return &XInfoConsumersCmd{ baseCmd: baseCmd{ ctx: ctx, diff --git a/commands_test.go b/commands_test.go index 9554bf9a9..198326100 100644 --- a/commands_test.go +++ b/commands_test.go @@ -335,7 +335,6 @@ var _ = Describe("Commands", func() { defer client2.Close() clientInfo = client2.ClientInfo(ctx).Val() Expect(clientInfo.LibName).To(ContainSubstring("go-redis(suffix,")) - }) It("should ConfigGet", func() { diff --git a/error.go b/error.go index 9b348193a..cab925a93 100644 --- a/error.go +++ b/error.go @@ -111,7 +111,7 @@ func isBadConn(err error, allowTimeout bool, addr string) bool { return true } -func isMovedError(err error) (moved bool, ask bool, addr string) { +func isMovedError(err error) (moved, ask bool, addr string) { if !isRedisError(err) { return } diff --git a/extra/rediscmd/rediscmd.go b/extra/rediscmd/rediscmd.go index c97689f95..44c1e420e 100644 --- a/extra/rediscmd/rediscmd.go +++ b/extra/rediscmd/rediscmd.go @@ -123,7 +123,7 @@ func appendArg(b []byte, v interface{}) []byte { } } -func appendUTF8String(dst []byte, src []byte) []byte { +func appendUTF8String(dst, src []byte) []byte { if isSimple(src) { dst = append(dst, src...) return dst diff --git a/extra/rediscmd/rediscmd_test.go b/extra/rediscmd/rediscmd_test.go index 2219ab0f2..9768aed8a 100644 --- a/extra/rediscmd/rediscmd_test.go +++ b/extra/rediscmd/rediscmd_test.go @@ -14,7 +14,7 @@ func TestGinkgo(t *testing.T) { var _ = Describe("AppendArg", func() { DescribeTable("...", - func(src string, wanted string) { + func(src, wanted string) { b := appendArg(nil, src) Expect(string(b)).To(Equal(wanted)) }, diff --git a/gears_commands.go b/gears_commands.go index e0d49a6b7..b9da35215 100644 --- a/gears_commands.go +++ b/gears_commands.go @@ -12,10 +12,10 @@ type GearsCmdable interface { TFunctionDelete(ctx context.Context, libName string) *StatusCmd TFunctionList(ctx context.Context) *MapStringInterfaceSliceCmd TFunctionListArgs(ctx context.Context, options *TFunctionListOptions) *MapStringInterfaceSliceCmd - TFCall(ctx context.Context, libName string, funcName string, numKeys int) *Cmd - TFCallArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd - TFCallASYNC(ctx context.Context, libName string, funcName string, numKeys int) *Cmd - TFCallASYNCArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd + TFCall(ctx context.Context, libName, funcName string, numKeys int) *Cmd + TFCallArgs(ctx context.Context, libName, funcName string, numKeys int, options *TFCallOptions) *Cmd + TFCallASYNC(ctx context.Context, libName, funcName string, numKeys int) *Cmd + TFCallASYNCArgs(ctx context.Context, libName, funcName string, numKeys int, options *TFCallOptions) *Cmd } type TFunctionLoadOptions struct { @@ -98,7 +98,7 @@ func (c cmdable) TFunctionListArgs(ctx context.Context, options *TFunctionListOp // TFCall - invoke a function. // For more information - https://redis.io/commands/tfcall/ -func (c cmdable) TFCall(ctx context.Context, libName string, funcName string, numKeys int) *Cmd { +func (c cmdable) TFCall(ctx context.Context, libName, funcName string, numKeys int) *Cmd { lf := libName + "." + funcName args := []interface{}{"TFCALL", lf, numKeys} cmd := NewCmd(ctx, args...) @@ -106,7 +106,7 @@ func (c cmdable) TFCall(ctx context.Context, libName string, funcName string, nu return cmd } -func (c cmdable) TFCallArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd { +func (c cmdable) TFCallArgs(ctx context.Context, libName, funcName string, numKeys int, options *TFCallOptions) *Cmd { lf := libName + "." + funcName args := []interface{}{"TFCALL", lf, numKeys} if options != nil { @@ -124,7 +124,7 @@ func (c cmdable) TFCallArgs(ctx context.Context, libName string, funcName string // TFCallASYNC - invoke an asynchronous JavaScript function (coroutine). // For more information - https://redis.io/commands/TFCallASYNC/ -func (c cmdable) TFCallASYNC(ctx context.Context, libName string, funcName string, numKeys int) *Cmd { +func (c cmdable) TFCallASYNC(ctx context.Context, libName, funcName string, numKeys int) *Cmd { lf := fmt.Sprintf("%s.%s", libName, funcName) args := []interface{}{"TFCALLASYNC", lf, numKeys} cmd := NewCmd(ctx, args...) @@ -132,7 +132,7 @@ func (c cmdable) TFCallASYNC(ctx context.Context, libName string, funcName strin return cmd } -func (c cmdable) TFCallASYNCArgs(ctx context.Context, libName string, funcName string, numKeys int, options *TFCallOptions) *Cmd { +func (c cmdable) TFCallASYNCArgs(ctx context.Context, libName, funcName string, numKeys int, options *TFCallOptions) *Cmd { lf := fmt.Sprintf("%s.%s", libName, funcName) args := []interface{}{"TFCALLASYNC", lf, numKeys} if options != nil { diff --git a/generic_commands.go b/generic_commands.go index dc6c3fe01..8f0bcd9a5 100644 --- a/generic_commands.go +++ b/generic_commands.go @@ -40,7 +40,7 @@ type GenericCmdable interface { Touch(ctx context.Context, keys ...string) *IntCmd TTL(ctx context.Context, key string) *DurationCmd Type(ctx context.Context, key string) *StatusCmd - Copy(ctx context.Context, sourceKey string, destKey string, db int, replace bool) *IntCmd + Copy(ctx context.Context, sourceKey, destKey string, db int, replace bool) *IntCmd Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd diff --git a/geo_commands.go b/geo_commands.go index f047b98aa..85363ce0e 100644 --- a/geo_commands.go +++ b/geo_commands.go @@ -15,7 +15,7 @@ type GeoCmdable interface { GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd GeoSearchLocation(ctx context.Context, key string, q *GeoSearchLocationQuery) *GeoSearchLocationCmd GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd - GeoDist(ctx context.Context, key string, member1, member2, unit string) *FloatCmd + GeoDist(ctx context.Context, key, member1, member2, unit string) *FloatCmd GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd } @@ -120,7 +120,7 @@ func (c cmdable) GeoSearchStore(ctx context.Context, key, store string, q *GeoSe } func (c cmdable) GeoDist( - ctx context.Context, key string, member1, member2, unit string, + ctx context.Context, key, member1, member2, unit string, ) *FloatCmd { if unit == "" { unit = "km" diff --git a/internal/arg.go b/internal/arg.go index 2e5ca33de..3011ea390 100644 --- a/internal/arg.go +++ b/internal/arg.go @@ -52,7 +52,7 @@ func AppendArg(b []byte, v interface{}) []byte { } } -func appendUTF8String(dst []byte, src []byte) []byte { +func appendUTF8String(dst, src []byte) []byte { dst = append(dst, src...) return dst } diff --git a/internal/hscan/hscan.go b/internal/hscan/hscan.go index 203ec4aa8..dd5e658c9 100644 --- a/internal/hscan/hscan.go +++ b/internal/hscan/hscan.go @@ -73,7 +73,7 @@ func Struct(dst interface{}) (StructValue, error) { // Scan scans the results from a key-value Redis map result set to a destination struct. // The Redis keys are matched to the struct's field with the `redis` tag. -func Scan(dst interface{}, keys []interface{}, vals []interface{}) error { +func Scan(dst interface{}, keys, vals []interface{}) error { if len(keys) != len(vals) { return errors.New("args should have the same number of keys and vals") } diff --git a/internal/hscan/structmap.go b/internal/hscan/structmap.go index 1a560e4a3..5031961d7 100644 --- a/internal/hscan/structmap.go +++ b/internal/hscan/structmap.go @@ -86,7 +86,7 @@ type StructValue struct { value reflect.Value } -func (s StructValue) Scan(key string, value string) error { +func (s StructValue) Scan(key, value string) error { field, ok := s.spec.m[key] if !ok { return nil diff --git a/internal/util/strconv.go b/internal/util/strconv.go index db5033802..cba1cfc99 100644 --- a/internal/util/strconv.go +++ b/internal/util/strconv.go @@ -6,11 +6,11 @@ func Atoi(b []byte) (int, error) { return strconv.Atoi(BytesToString(b)) } -func ParseInt(b []byte, base int, bitSize int) (int64, error) { +func ParseInt(b []byte, base, bitSize int) (int64, error) { return strconv.ParseInt(BytesToString(b), base, bitSize) } -func ParseUint(b []byte, base int, bitSize int) (uint64, error) { +func ParseUint(b []byte, base, bitSize int) (uint64, error) { return strconv.ParseUint(BytesToString(b), base, bitSize) } diff --git a/iterator_test.go b/iterator_test.go index 472ce38a7..3fa50a7f8 100644 --- a/iterator_test.go +++ b/iterator_test.go @@ -21,7 +21,7 @@ var _ = Describe("ScanIterator", func() { return err } - extraSeed := func(n int, m int) error { + extraSeed := func(n, m int) error { pipe := client.Pipeline() for i := 1; i <= m; i++ { pipe.Set(ctx, fmt.Sprintf("A%02d", i), "x", 0).Err() diff --git a/json.go b/json.go index b3cadf4b7..bd9e4687b 100644 --- a/json.go +++ b/json.go @@ -26,7 +26,7 @@ type JSONCmdable interface { JSONForget(ctx context.Context, key, path string) *IntCmd JSONGet(ctx context.Context, key string, paths ...string) *JSONCmd JSONGetWithArgs(ctx context.Context, key string, options *JSONGetArgs, paths ...string) *JSONCmd - JSONMerge(ctx context.Context, key, path string, value string) *StatusCmd + JSONMerge(ctx context.Context, key, path, value string) *StatusCmd JSONMSetArgs(ctx context.Context, docs []JSONSetArgs) *StatusCmd JSONMSet(ctx context.Context, params ...interface{}) *StatusCmd JSONMGet(ctx context.Context, path string, keys ...string) *JSONSliceCmd @@ -450,7 +450,7 @@ func (c cmdable) JSONGetWithArgs(ctx context.Context, key string, options *JSONG // JSONMerge merges a given JSON value into matching paths. // For more information, see https://redis.io/commands/json.merge -func (c cmdable) JSONMerge(ctx context.Context, key, path string, value string) *StatusCmd { +func (c cmdable) JSONMerge(ctx context.Context, key, path, value string) *StatusCmd { args := []interface{}{"JSON.MERGE", key, path, value} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) diff --git a/list_commands.go b/list_commands.go index 24a0de081..a915e627c 100644 --- a/list_commands.go +++ b/list_commands.go @@ -19,8 +19,8 @@ type ListCmdable interface { LMPop(ctx context.Context, direction string, count int64, keys ...string) *KeyValuesCmd LPop(ctx context.Context, key string) *StringCmd LPopCount(ctx context.Context, key string, count int) *StringSliceCmd - LPos(ctx context.Context, key string, value string, args LPosArgs) *IntCmd - LPosCount(ctx context.Context, key string, value string, count int64, args LPosArgs) *IntSliceCmd + LPos(ctx context.Context, key, value string, args LPosArgs) *IntCmd + LPosCount(ctx context.Context, key, value string, count int64, args LPosArgs) *IntSliceCmd LPush(ctx context.Context, key string, values ...interface{}) *IntCmd LPushX(ctx context.Context, key string, values ...interface{}) *IntCmd LRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd @@ -152,7 +152,7 @@ type LPosArgs struct { Rank, MaxLen int64 } -func (c cmdable) LPos(ctx context.Context, key string, value string, a LPosArgs) *IntCmd { +func (c cmdable) LPos(ctx context.Context, key, value string, a LPosArgs) *IntCmd { args := []interface{}{"lpos", key, value} if a.Rank != 0 { args = append(args, "rank", a.Rank) @@ -166,7 +166,7 @@ func (c cmdable) LPos(ctx context.Context, key string, value string, a LPosArgs) return cmd } -func (c cmdable) LPosCount(ctx context.Context, key string, value string, count int64, a LPosArgs) *IntSliceCmd { +func (c cmdable) LPosCount(ctx context.Context, key, value string, count int64, a LPosArgs) *IntSliceCmd { args := []interface{}{"lpos", key, value, "count", count} if a.Rank != 0 { args = append(args, "rank", a.Rank) diff --git a/options.go b/options.go index 8ba74ccd1..db1ca6ee2 100644 --- a/options.go +++ b/options.go @@ -59,13 +59,13 @@ type Options struct { Password string // CredentialsProvider allows the username and password to be updated // before reconnecting. It should return the current username and password. - CredentialsProvider func() (username string, password string) + CredentialsProvider func() (username, password string) // CredentialsProviderContext is an enhanced parameter of CredentialsProvider, // done to maintain API compatibility. In the future, // there might be a merge between CredentialsProviderContext and CredentialsProvider. // There will be a conflict between them; if CredentialsProviderContext exists, we will ignore CredentialsProvider. - CredentialsProviderContext func(ctx context.Context) (username string, password string, err error) + CredentialsProviderContext func(ctx context.Context) (username, password string, err error) // Database to be selected after connecting to the server. DB int diff --git a/osscluster.go b/osscluster.go index 72e922a80..666231242 100644 --- a/osscluster.go +++ b/osscluster.go @@ -69,8 +69,8 @@ type ClusterOptions struct { Protocol int Username string Password string - CredentialsProvider func() (username string, password string) - CredentialsProviderContext func(ctx context.Context) (username string, password string, err error) + CredentialsProvider func() (username, password string) + CredentialsProviderContext func(ctx context.Context) (username, password string, err error) MaxRetries int MinRetryBackoff time.Duration diff --git a/probabilistic.go b/probabilistic.go index 02ca263cb..e2be22e98 100644 --- a/probabilistic.go +++ b/probabilistic.go @@ -39,9 +39,9 @@ type ProbabilisticCmdable interface { CFMExists(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd CFReserve(ctx context.Context, key string, capacity int64) *StatusCmd CFReserveWithArgs(ctx context.Context, key string, options *CFReserveOptions) *StatusCmd - CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd - CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd - CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd + CFReserveExpansion(ctx context.Context, key string, capacity, expansion int64) *StatusCmd + CFReserveBucketSize(ctx context.Context, key string, capacity, bucketsize int64) *StatusCmd + CFReserveMaxIterations(ctx context.Context, key string, capacity, maxiterations int64) *StatusCmd CFScanDump(ctx context.Context, key string, iterator int64) *ScanDumpCmd CFLoadChunk(ctx context.Context, key string, iterator int64, data interface{}) *StatusCmd @@ -61,7 +61,7 @@ type ProbabilisticCmdable interface { TopKListWithCount(ctx context.Context, key string) *MapStringIntCmd TopKQuery(ctx context.Context, key string, elements ...interface{}) *BoolSliceCmd TopKReserve(ctx context.Context, key string, k int64) *StatusCmd - TopKReserveWithOptions(ctx context.Context, key string, k int64, width, depth int64, decay float64) *StatusCmd + TopKReserveWithOptions(ctx context.Context, key string, k, width, depth int64, decay float64) *StatusCmd TDigestAdd(ctx context.Context, key string, elements ...float64) *StatusCmd TDigestByRank(ctx context.Context, key string, rank ...uint64) *FloatSliceCmd @@ -496,7 +496,7 @@ func (c cmdable) CFReserve(ctx context.Context, key string, capacity int64) *Sta // CFReserveExpansion creates an empty Cuckoo filter with the specified capacity and expansion rate. // For more information - https://redis.io/commands/cf.reserve/ -func (c cmdable) CFReserveExpansion(ctx context.Context, key string, capacity int64, expansion int64) *StatusCmd { +func (c cmdable) CFReserveExpansion(ctx context.Context, key string, capacity, expansion int64) *StatusCmd { args := []interface{}{"CF.RESERVE", key, capacity, "EXPANSION", expansion} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) @@ -505,7 +505,7 @@ func (c cmdable) CFReserveExpansion(ctx context.Context, key string, capacity in // CFReserveBucketSize creates an empty Cuckoo filter with the specified capacity and bucket size. // For more information - https://redis.io/commands/cf.reserve/ -func (c cmdable) CFReserveBucketSize(ctx context.Context, key string, capacity int64, bucketsize int64) *StatusCmd { +func (c cmdable) CFReserveBucketSize(ctx context.Context, key string, capacity, bucketsize int64) *StatusCmd { args := []interface{}{"CF.RESERVE", key, capacity, "BUCKETSIZE", bucketsize} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) @@ -514,7 +514,7 @@ func (c cmdable) CFReserveBucketSize(ctx context.Context, key string, capacity i // CFReserveMaxIterations creates an empty Cuckoo filter with the specified capacity and maximum number of iterations. // For more information - https://redis.io/commands/cf.reserve/ -func (c cmdable) CFReserveMaxIterations(ctx context.Context, key string, capacity int64, maxiterations int64) *StatusCmd { +func (c cmdable) CFReserveMaxIterations(ctx context.Context, key string, capacity, maxiterations int64) *StatusCmd { args := []interface{}{"CF.RESERVE", key, capacity, "MAXITERATIONS", maxiterations} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) @@ -956,7 +956,7 @@ func (c cmdable) TopKReserve(ctx context.Context, key string, k int64) *StatusCm // TopKReserveWithOptions creates an empty Top-K filter with the specified number of top items to keep and additional options. // This function allows for specifying additional options such as width, depth and decay. // For more information - https://redis.io/commands/topk.reserve/ -func (c cmdable) TopKReserveWithOptions(ctx context.Context, key string, k int64, width, depth int64, decay float64) *StatusCmd { +func (c cmdable) TopKReserveWithOptions(ctx context.Context, key string, k, width, depth int64, decay float64) *StatusCmd { args := []interface{}{"TOPK.RESERVE", key, k, width, depth, decay} cmd := NewStatusCmd(ctx, args...) diff --git a/scripting_commands.go b/scripting_commands.go index af9c3397b..87329967e 100644 --- a/scripting_commands.go +++ b/scripting_commands.go @@ -201,7 +201,7 @@ func (c cmdable) FCallRO(ctx context.Context, function string, keys []string, ar return cmd } -func fcallArgs(command string, function string, keys []string, args ...interface{}) []interface{} { +func fcallArgs(command, function string, keys []string, args ...interface{}) []interface{} { cmdArgs := make([]interface{}, 3+len(keys), 3+len(keys)+len(args)) cmdArgs[0] = command cmdArgs[1] = function diff --git a/stream_commands.go b/stream_commands.go index 6d7b22922..65e8745a3 100644 --- a/stream_commands.go +++ b/stream_commands.go @@ -11,8 +11,8 @@ type StreamCmdable interface { XLen(ctx context.Context, stream string) *IntCmd XRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd XRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd - XRevRange(ctx context.Context, stream string, start, stop string) *XMessageSliceCmd - XRevRangeN(ctx context.Context, stream string, start, stop string, count int64) *XMessageSliceCmd + XRevRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd + XRevRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd XReadStreams(ctx context.Context, streams ...string) *XStreamSliceCmd XGroupCreate(ctx context.Context, stream, group, start string) *StatusCmd @@ -31,12 +31,12 @@ type StreamCmdable interface { XAutoClaimJustID(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd XTrimMaxLen(ctx context.Context, key string, maxLen int64) *IntCmd XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limit int64) *IntCmd - XTrimMinID(ctx context.Context, key string, minID string) *IntCmd - XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *IntCmd + XTrimMinID(ctx context.Context, key, minID string) *IntCmd + XTrimMinIDApprox(ctx context.Context, key, minID string, limit int64) *IntCmd XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd XInfoStream(ctx context.Context, key string) *XInfoStreamCmd XInfoStreamFull(ctx context.Context, key string, count int) *XInfoStreamFullCmd - XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd + XInfoConsumers(ctx context.Context, key, group string) *XInfoConsumersCmd } // XAddArgs accepts values in the following formats: @@ -410,15 +410,15 @@ func (c cmdable) XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limi return c.xTrim(ctx, key, "maxlen", true, maxLen, limit) } -func (c cmdable) XTrimMinID(ctx context.Context, key string, minID string) *IntCmd { +func (c cmdable) XTrimMinID(ctx context.Context, key, minID string) *IntCmd { return c.xTrim(ctx, key, "minid", false, minID, 0) } -func (c cmdable) XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *IntCmd { +func (c cmdable) XTrimMinIDApprox(ctx context.Context, key, minID string, limit int64) *IntCmd { return c.xTrim(ctx, key, "minid", true, minID, limit) } -func (c cmdable) XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd { +func (c cmdable) XInfoConsumers(ctx context.Context, key, group string) *XInfoConsumersCmd { cmd := NewXInfoConsumersCmd(ctx, key, group) _ = c(ctx, cmd) return cmd diff --git a/timeseries_commands.go b/timeseries_commands.go index 82d8cdfcf..b7cf6360e 100644 --- a/timeseries_commands.go +++ b/timeseries_commands.go @@ -13,28 +13,28 @@ type TimeseriesCmdable interface { TSCreate(ctx context.Context, key string) *StatusCmd TSCreateWithArgs(ctx context.Context, key string, options *TSOptions) *StatusCmd TSAlter(ctx context.Context, key string, options *TSAlterOptions) *StatusCmd - TSCreateRule(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd - TSCreateRuleWithArgs(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd + TSCreateRule(ctx context.Context, sourceKey, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd + TSCreateRuleWithArgs(ctx context.Context, sourceKey, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd TSIncrBy(ctx context.Context, Key string, timestamp float64) *IntCmd TSIncrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd TSDecrBy(ctx context.Context, Key string, timestamp float64) *IntCmd TSDecrByWithArgs(ctx context.Context, key string, timestamp float64, options *TSIncrDecrOptions) *IntCmd - TSDel(ctx context.Context, Key string, fromTimestamp int, toTimestamp int) *IntCmd - TSDeleteRule(ctx context.Context, sourceKey string, destKey string) *StatusCmd + TSDel(ctx context.Context, Key string, fromTimestamp, toTimestamp int) *IntCmd + TSDeleteRule(ctx context.Context, sourceKey, destKey string) *StatusCmd TSGet(ctx context.Context, key string) *TSTimestampValueCmd TSGetWithArgs(ctx context.Context, key string, options *TSGetOptions) *TSTimestampValueCmd TSInfo(ctx context.Context, key string) *MapStringInterfaceCmd TSInfoWithArgs(ctx context.Context, key string, options *TSInfoOptions) *MapStringInterfaceCmd TSMAdd(ctx context.Context, ktvSlices [][]interface{}) *IntSliceCmd TSQueryIndex(ctx context.Context, filterExpr []string) *StringSliceCmd - TSRevRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd - TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd - TSRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd - TSRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd - TSMRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd - TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd - TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd - TSMRevRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd + TSRevRange(ctx context.Context, key string, fromTimestamp, toTimestamp int) *TSTimestampValueSliceCmd + TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd + TSRange(ctx context.Context, key string, fromTimestamp, toTimestamp int) *TSTimestampValueSliceCmd + TSRangeWithArgs(ctx context.Context, key string, fromTimestamp, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd + TSMRange(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd + TSMRangeWithArgs(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd + TSMRevRange(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd + TSMRevRangeWithArgs(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd TSMGet(ctx context.Context, filters []string) *MapStringSliceInterfaceCmd TSMGetWithArgs(ctx context.Context, filters []string, options *TSMGetOptions) *MapStringSliceInterfaceCmd } @@ -316,7 +316,7 @@ func (c cmdable) TSAlter(ctx context.Context, key string, options *TSAlterOption // TSCreateRule - Creates a compaction rule from sourceKey to destKey. // For more information - https://redis.io/commands/ts.createrule/ -func (c cmdable) TSCreateRule(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd { +func (c cmdable) TSCreateRule(ctx context.Context, sourceKey, destKey string, aggregator Aggregator, bucketDuration int) *StatusCmd { args := []interface{}{"TS.CREATERULE", sourceKey, destKey, "AGGREGATION", aggregator.String(), bucketDuration} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) @@ -327,7 +327,7 @@ func (c cmdable) TSCreateRule(ctx context.Context, sourceKey string, destKey str // This function allows for specifying additional option such as: // alignTimestamp. // For more information - https://redis.io/commands/ts.createrule/ -func (c cmdable) TSCreateRuleWithArgs(ctx context.Context, sourceKey string, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd { +func (c cmdable) TSCreateRuleWithArgs(ctx context.Context, sourceKey, destKey string, aggregator Aggregator, bucketDuration int, options *TSCreateRuleOptions) *StatusCmd { args := []interface{}{"TS.CREATERULE", sourceKey, destKey, "AGGREGATION", aggregator.String(), bucketDuration} if options != nil { if options.alignTimestamp != 0 { @@ -433,7 +433,7 @@ func (c cmdable) TSDecrByWithArgs(ctx context.Context, key string, timestamp flo // TSDel - Deletes a range of samples from a time-series key. // For more information - https://redis.io/commands/ts.del/ -func (c cmdable) TSDel(ctx context.Context, Key string, fromTimestamp int, toTimestamp int) *IntCmd { +func (c cmdable) TSDel(ctx context.Context, Key string, fromTimestamp, toTimestamp int) *IntCmd { args := []interface{}{"TS.DEL", Key, fromTimestamp, toTimestamp} cmd := NewIntCmd(ctx, args...) _ = c(ctx, cmd) @@ -442,7 +442,7 @@ func (c cmdable) TSDel(ctx context.Context, Key string, fromTimestamp int, toTim // TSDeleteRule - Deletes a compaction rule from sourceKey to destKey. // For more information - https://redis.io/commands/ts.deleterule/ -func (c cmdable) TSDeleteRule(ctx context.Context, sourceKey string, destKey string) *StatusCmd { +func (c cmdable) TSDeleteRule(ctx context.Context, sourceKey, destKey string) *StatusCmd { args := []interface{}{"TS.DELETERULE", sourceKey, destKey} cmd := NewStatusCmd(ctx, args...) _ = c(ctx, cmd) @@ -586,7 +586,7 @@ func (c cmdable) TSQueryIndex(ctx context.Context, filterExpr []string) *StringS // TSRevRange - Returns a range of samples from a time-series key in reverse order. // For more information - https://redis.io/commands/ts.revrange/ -func (c cmdable) TSRevRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd { +func (c cmdable) TSRevRange(ctx context.Context, key string, fromTimestamp, toTimestamp int) *TSTimestampValueSliceCmd { args := []interface{}{"TS.REVRANGE", key, fromTimestamp, toTimestamp} cmd := newTSTimestampValueSliceCmd(ctx, args...) _ = c(ctx, cmd) @@ -598,7 +598,7 @@ func (c cmdable) TSRevRange(ctx context.Context, key string, fromTimestamp int, // Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, // BucketDuration, BucketTimestamp and Empty. // For more information - https://redis.io/commands/ts.revrange/ -func (c cmdable) TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd { +func (c cmdable) TSRevRangeWithArgs(ctx context.Context, key string, fromTimestamp, toTimestamp int, options *TSRevRangeOptions) *TSTimestampValueSliceCmd { args := []interface{}{"TS.REVRANGE", key, fromTimestamp, toTimestamp} if options != nil { if options.Latest { @@ -642,7 +642,7 @@ func (c cmdable) TSRevRangeWithArgs(ctx context.Context, key string, fromTimesta // TSRange - Returns a range of samples from a time-series key. // For more information - https://redis.io/commands/ts.range/ -func (c cmdable) TSRange(ctx context.Context, key string, fromTimestamp int, toTimestamp int) *TSTimestampValueSliceCmd { +func (c cmdable) TSRange(ctx context.Context, key string, fromTimestamp, toTimestamp int) *TSTimestampValueSliceCmd { args := []interface{}{"TS.RANGE", key, fromTimestamp, toTimestamp} cmd := newTSTimestampValueSliceCmd(ctx, args...) _ = c(ctx, cmd) @@ -654,7 +654,7 @@ func (c cmdable) TSRange(ctx context.Context, key string, fromTimestamp int, toT // Latest, FilterByTS, FilterByValue, Count, Align, Aggregator, // BucketDuration, BucketTimestamp and Empty. // For more information - https://redis.io/commands/ts.range/ -func (c cmdable) TSRangeWithArgs(ctx context.Context, key string, fromTimestamp int, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd { +func (c cmdable) TSRangeWithArgs(ctx context.Context, key string, fromTimestamp, toTimestamp int, options *TSRangeOptions) *TSTimestampValueSliceCmd { args := []interface{}{"TS.RANGE", key, fromTimestamp, toTimestamp} if options != nil { if options.Latest { @@ -754,7 +754,7 @@ func (cmd *TSTimestampValueSliceCmd) readReply(rd *proto.Reader) (err error) { // TSMRange - Returns a range of samples from multiple time-series keys. // For more information - https://redis.io/commands/ts.mrange/ -func (c cmdable) TSMRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd { +func (c cmdable) TSMRange(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd { args := []interface{}{"TS.MRANGE", fromTimestamp, toTimestamp, "FILTER"} for _, f := range filterExpr { args = append(args, f) @@ -770,7 +770,7 @@ func (c cmdable) TSMRange(ctx context.Context, fromTimestamp int, toTimestamp in // Count, Align, Aggregator, BucketDuration, BucketTimestamp, // Empty, GroupByLabel and Reducer. // For more information - https://redis.io/commands/ts.mrange/ -func (c cmdable) TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd { +func (c cmdable) TSMRangeWithArgs(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string, options *TSMRangeOptions) *MapStringSliceInterfaceCmd { args := []interface{}{"TS.MRANGE", fromTimestamp, toTimestamp} if options != nil { if options.Latest { @@ -833,7 +833,7 @@ func (c cmdable) TSMRangeWithArgs(ctx context.Context, fromTimestamp int, toTime // TSMRevRange - Returns a range of samples from multiple time-series keys in reverse order. // For more information - https://redis.io/commands/ts.mrevrange/ -func (c cmdable) TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd { +func (c cmdable) TSMRevRange(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string) *MapStringSliceInterfaceCmd { args := []interface{}{"TS.MREVRANGE", fromTimestamp, toTimestamp, "FILTER"} for _, f := range filterExpr { args = append(args, f) @@ -849,7 +849,7 @@ func (c cmdable) TSMRevRange(ctx context.Context, fromTimestamp int, toTimestamp // Count, Align, Aggregator, BucketDuration, BucketTimestamp, // Empty, GroupByLabel and Reducer. // For more information - https://redis.io/commands/ts.mrevrange/ -func (c cmdable) TSMRevRangeWithArgs(ctx context.Context, fromTimestamp int, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd { +func (c cmdable) TSMRevRangeWithArgs(ctx context.Context, fromTimestamp, toTimestamp int, filterExpr []string, options *TSMRevRangeOptions) *MapStringSliceInterfaceCmd { args := []interface{}{"TS.MREVRANGE", fromTimestamp, toTimestamp} if options != nil { if options.Latest {