2012-07-25 17:00:50 +04:00
|
|
|
package redis
|
|
|
|
|
|
|
|
import (
|
2020-03-11 17:26:42 +03:00
|
|
|
"context"
|
2018-02-22 15:14:30 +03:00
|
|
|
"errors"
|
2014-11-13 15:26:14 +03:00
|
|
|
"io"
|
2014-05-11 11:42:40 +04:00
|
|
|
"time"
|
2016-04-09 14:52:01 +03:00
|
|
|
|
2022-06-04 17:39:21 +03:00
|
|
|
"github.com/go-redis/redis/v9/internal"
|
2012-07-25 17:00:50 +04:00
|
|
|
)
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
|
|
|
|
// otherwise you will receive an error: (error) ERR syntax error.
|
2021-03-27 12:49:55 +03:00
|
|
|
// For example:
|
|
|
|
//
|
|
|
|
// rdb.Set(ctx, key, value, redis.KeepTTL)
|
|
|
|
const KeepTTL = -1
|
2020-09-18 14:49:12 +03:00
|
|
|
|
2015-01-31 12:08:56 +03:00
|
|
|
func usePrecise(dur time.Duration) bool {
|
|
|
|
return dur < time.Second || dur%time.Second != 0
|
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:36 +03:00
|
|
|
func formatMs(ctx context.Context, dur time.Duration) int64 {
|
2015-04-07 12:42:16 +03:00
|
|
|
if dur > 0 && dur < time.Millisecond {
|
2019-06-17 12:32:40 +03:00
|
|
|
internal.Logger.Printf(
|
2020-07-18 09:04:36 +03:00
|
|
|
ctx,
|
2020-06-10 17:22:06 +03:00
|
|
|
"specified duration is %s, but minimal supported value is %s - truncating to 1ms",
|
2015-04-07 12:42:16 +03:00
|
|
|
dur, time.Millisecond,
|
|
|
|
)
|
2020-06-10 14:52:12 +03:00
|
|
|
return 1
|
2015-04-07 12:42:16 +03:00
|
|
|
}
|
2017-03-24 13:48:32 +03:00
|
|
|
return int64(dur / time.Millisecond)
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
|
|
|
|
2020-07-18 09:04:36 +03:00
|
|
|
func formatSec(ctx context.Context, dur time.Duration) int64 {
|
2015-04-07 12:42:16 +03:00
|
|
|
if dur > 0 && dur < time.Second {
|
2019-06-17 12:32:40 +03:00
|
|
|
internal.Logger.Printf(
|
2020-07-18 09:04:36 +03:00
|
|
|
ctx,
|
2020-06-10 16:44:48 +03:00
|
|
|
"specified duration is %s, but minimal supported value is %s - truncating to 1s",
|
2015-04-07 12:42:16 +03:00
|
|
|
dur, time.Second,
|
|
|
|
)
|
2020-06-10 14:52:12 +03:00
|
|
|
return 1
|
2015-04-07 12:42:16 +03:00
|
|
|
}
|
2017-03-24 13:48:32 +03:00
|
|
|
return int64(dur / time.Second)
|
2015-05-28 15:51:19 +03:00
|
|
|
}
|
|
|
|
|
2018-03-08 15:30:27 +03:00
|
|
|
func appendArgs(dst, src []interface{}) []interface{} {
|
|
|
|
if len(src) == 1 {
|
2020-06-29 17:48:57 +03:00
|
|
|
return appendArg(dst, src[0])
|
2018-03-08 15:30:27 +03:00
|
|
|
}
|
|
|
|
|
2019-07-25 13:28:15 +03:00
|
|
|
dst = append(dst, src...)
|
2018-03-08 15:30:27 +03:00
|
|
|
return dst
|
|
|
|
}
|
|
|
|
|
2020-06-29 17:48:57 +03:00
|
|
|
func appendArg(dst []interface{}, arg interface{}) []interface{} {
|
|
|
|
switch arg := arg.(type) {
|
|
|
|
case []string:
|
|
|
|
for _, s := range arg {
|
|
|
|
dst = append(dst, s)
|
|
|
|
}
|
|
|
|
return dst
|
|
|
|
case []interface{}:
|
|
|
|
dst = append(dst, arg...)
|
|
|
|
return dst
|
|
|
|
case map[string]interface{}:
|
|
|
|
for k, v := range arg {
|
|
|
|
dst = append(dst, k, v)
|
|
|
|
}
|
|
|
|
return dst
|
2021-04-09 06:27:11 +03:00
|
|
|
case map[string]string:
|
|
|
|
for k, v := range arg {
|
|
|
|
dst = append(dst, k, v)
|
|
|
|
}
|
|
|
|
return dst
|
2020-06-29 17:48:57 +03:00
|
|
|
default:
|
|
|
|
return append(dst, arg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-21 16:24:58 +03:00
|
|
|
type Cmdable interface {
|
2017-05-02 18:00:53 +03:00
|
|
|
Pipeline() Pipeliner
|
2020-03-11 17:26:42 +03:00
|
|
|
Pipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
|
2016-09-27 12:24:14 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
TxPipelined(ctx context.Context, fn func(Pipeliner) error) ([]Cmder, error)
|
2017-09-25 11:48:44 +03:00
|
|
|
TxPipeline() Pipeliner
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
Command(ctx context.Context) *CommandsInfoCmd
|
|
|
|
ClientGetName(ctx context.Context) *StringCmd
|
|
|
|
Echo(ctx context.Context, message interface{}) *StringCmd
|
|
|
|
Ping(ctx context.Context) *StatusCmd
|
|
|
|
Quit(ctx context.Context) *StatusCmd
|
|
|
|
Del(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
Unlink(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
Dump(ctx context.Context, key string) *StringCmd
|
|
|
|
Exists(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
|
|
|
ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
|
|
|
ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
|
|
|
ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
|
|
|
ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
Keys(ctx context.Context, pattern string) *StringSliceCmd
|
|
|
|
Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd
|
|
|
|
Move(ctx context.Context, key string, db int) *BoolCmd
|
|
|
|
ObjectRefCount(ctx context.Context, key string) *IntCmd
|
|
|
|
ObjectEncoding(ctx context.Context, key string) *StringCmd
|
|
|
|
ObjectIdleTime(ctx context.Context, key string) *DurationCmd
|
|
|
|
Persist(ctx context.Context, key string) *BoolCmd
|
|
|
|
PExpire(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
|
|
|
PExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd
|
|
|
|
PTTL(ctx context.Context, key string) *DurationCmd
|
|
|
|
RandomKey(ctx context.Context) *StringCmd
|
|
|
|
Rename(ctx context.Context, key, newkey string) *StatusCmd
|
|
|
|
RenameNX(ctx context.Context, key, newkey string) *BoolCmd
|
|
|
|
Restore(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd
|
|
|
|
RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd
|
|
|
|
Sort(ctx context.Context, key string, sort *Sort) *StringSliceCmd
|
|
|
|
SortStore(ctx context.Context, key, store string, sort *Sort) *IntCmd
|
|
|
|
SortInterfaces(ctx context.Context, key string, sort *Sort) *SliceCmd
|
|
|
|
Touch(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
TTL(ctx context.Context, key string) *DurationCmd
|
|
|
|
Type(ctx context.Context, key string) *StatusCmd
|
|
|
|
Append(ctx context.Context, key, value string) *IntCmd
|
|
|
|
Decr(ctx context.Context, key string) *IntCmd
|
|
|
|
DecrBy(ctx context.Context, key string, decrement int64) *IntCmd
|
|
|
|
Get(ctx context.Context, key string) *StringCmd
|
|
|
|
GetRange(ctx context.Context, key string, start, end int64) *StringCmd
|
|
|
|
GetSet(ctx context.Context, key string, value interface{}) *StringCmd
|
2021-03-27 18:22:10 +03:00
|
|
|
GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd
|
2021-03-26 12:13:22 +03:00
|
|
|
GetDel(ctx context.Context, key string) *StringCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
Incr(ctx context.Context, key string) *IntCmd
|
|
|
|
IncrBy(ctx context.Context, key string, value int64) *IntCmd
|
|
|
|
IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd
|
|
|
|
MGet(ctx context.Context, keys ...string) *SliceCmd
|
|
|
|
MSet(ctx context.Context, values ...interface{}) *StatusCmd
|
|
|
|
MSetNX(ctx context.Context, values ...interface{}) *BoolCmd
|
|
|
|
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
2021-03-04 06:24:29 +03:00
|
|
|
SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
|
|
|
SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd
|
|
|
|
SetRange(ctx context.Context, key string, offset int64, value string) *IntCmd
|
|
|
|
StrLen(ctx context.Context, key string) *IntCmd
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
Copy(ctx context.Context, sourceKey string, destKey string, db int, replace bool) *IntCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
|
|
|
|
GetBit(ctx context.Context, key string, offset int64) *IntCmd
|
|
|
|
SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd
|
|
|
|
BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd
|
|
|
|
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
|
|
|
|
BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd
|
|
|
|
BitField(ctx context.Context, key string, args ...interface{}) *IntSliceCmd
|
|
|
|
|
|
|
|
Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd
|
2021-01-08 22:36:20 +03:00
|
|
|
ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd
|
|
|
|
HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd
|
|
|
|
ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd
|
|
|
|
|
|
|
|
HDel(ctx context.Context, key string, fields ...string) *IntCmd
|
|
|
|
HExists(ctx context.Context, key, field string) *BoolCmd
|
|
|
|
HGet(ctx context.Context, key, field string) *StringCmd
|
2021-04-27 10:04:46 +03:00
|
|
|
HGetAll(ctx context.Context, key string) *MapStringStringCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd
|
|
|
|
HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd
|
|
|
|
HKeys(ctx context.Context, key string) *StringSliceCmd
|
|
|
|
HLen(ctx context.Context, key string) *IntCmd
|
|
|
|
HMGet(ctx context.Context, key string, fields ...string) *SliceCmd
|
|
|
|
HSet(ctx context.Context, key string, values ...interface{}) *IntCmd
|
|
|
|
HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd
|
|
|
|
HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd
|
|
|
|
HVals(ctx context.Context, key string) *StringSliceCmd
|
2021-04-27 10:04:46 +03:00
|
|
|
HRandField(ctx context.Context, key string, count int) *StringSliceCmd
|
|
|
|
HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
|
|
|
|
BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
|
|
|
|
BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd
|
|
|
|
BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd
|
|
|
|
LIndex(ctx context.Context, key string, index int64) *StringCmd
|
|
|
|
LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd
|
|
|
|
LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd
|
|
|
|
LInsertAfter(ctx context.Context, key string, pivot, value interface{}) *IntCmd
|
|
|
|
LLen(ctx context.Context, key string) *IntCmd
|
|
|
|
LPop(ctx context.Context, key string) *StringCmd
|
2021-05-19 12:43:31 +03:00
|
|
|
LPopCount(ctx context.Context, key string, count int) *StringSliceCmd
|
2020-11-17 09:48:46 +03:00
|
|
|
LPos(ctx context.Context, key string, value string, args LPosArgs) *IntCmd
|
|
|
|
LPosCount(ctx context.Context, key string, value string, count int64, args LPosArgs) *IntSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
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
|
|
|
|
LRem(ctx context.Context, key string, count int64, value interface{}) *IntCmd
|
|
|
|
LSet(ctx context.Context, key string, index int64, value interface{}) *StatusCmd
|
|
|
|
LTrim(ctx context.Context, key string, start, stop int64) *StatusCmd
|
|
|
|
RPop(ctx context.Context, key string) *StringCmd
|
2021-07-11 13:27:48 +03:00
|
|
|
RPopCount(ctx context.Context, key string, count int) *StringSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
RPopLPush(ctx context.Context, source, destination string) *StringCmd
|
|
|
|
RPush(ctx context.Context, key string, values ...interface{}) *IntCmd
|
|
|
|
RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd
|
2021-04-14 03:28:55 +03:00
|
|
|
LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
BLMove(ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration) *StringCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
|
|
|
|
SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd
|
|
|
|
SCard(ctx context.Context, key string) *IntCmd
|
|
|
|
SDiff(ctx context.Context, keys ...string) *StringSliceCmd
|
|
|
|
SDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd
|
|
|
|
SInter(ctx context.Context, keys ...string) *StringSliceCmd
|
|
|
|
SInterStore(ctx context.Context, destination string, keys ...string) *IntCmd
|
|
|
|
SIsMember(ctx context.Context, key string, member interface{}) *BoolCmd
|
2021-04-28 08:56:44 +03:00
|
|
|
SMIsMember(ctx context.Context, key string, members ...interface{}) *BoolSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
SMembers(ctx context.Context, key string) *StringSliceCmd
|
|
|
|
SMembersMap(ctx context.Context, key string) *StringStructMapCmd
|
|
|
|
SMove(ctx context.Context, source, destination string, member interface{}) *BoolCmd
|
|
|
|
SPop(ctx context.Context, key string) *StringCmd
|
|
|
|
SPopN(ctx context.Context, key string, count int64) *StringSliceCmd
|
|
|
|
SRandMember(ctx context.Context, key string) *StringCmd
|
|
|
|
SRandMemberN(ctx context.Context, key string, count int64) *StringSliceCmd
|
|
|
|
SRem(ctx context.Context, key string, members ...interface{}) *IntCmd
|
|
|
|
SUnion(ctx context.Context, keys ...string) *StringSliceCmd
|
|
|
|
SUnionStore(ctx context.Context, destination string, keys ...string) *IntCmd
|
|
|
|
|
|
|
|
XAdd(ctx context.Context, a *XAddArgs) *StringCmd
|
|
|
|
XDel(ctx context.Context, stream string, ids ...string) *IntCmd
|
|
|
|
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
|
|
|
|
XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd
|
|
|
|
XReadStreams(ctx context.Context, streams ...string) *XStreamSliceCmd
|
|
|
|
XGroupCreate(ctx context.Context, stream, group, start string) *StatusCmd
|
|
|
|
XGroupCreateMkStream(ctx context.Context, stream, group, start string) *StatusCmd
|
|
|
|
XGroupSetID(ctx context.Context, stream, group, start string) *StatusCmd
|
|
|
|
XGroupDestroy(ctx context.Context, stream, group string) *IntCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
XGroupCreateConsumer(ctx context.Context, stream, group, consumer string) *IntCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
XGroupDelConsumer(ctx context.Context, stream, group, consumer string) *IntCmd
|
|
|
|
XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSliceCmd
|
|
|
|
XAck(ctx context.Context, stream, group string, ids ...string) *IntCmd
|
|
|
|
XPending(ctx context.Context, stream, group string) *XPendingCmd
|
|
|
|
XPendingExt(ctx context.Context, a *XPendingExtArgs) *XPendingExtCmd
|
|
|
|
XClaim(ctx context.Context, a *XClaimArgs) *XMessageSliceCmd
|
|
|
|
XClaimJustID(ctx context.Context, a *XClaimArgs) *StringSliceCmd
|
2021-07-02 15:56:25 +03:00
|
|
|
XAutoClaim(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimCmd
|
|
|
|
XAutoClaimJustID(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
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
|
2020-03-11 17:26:42 +03:00
|
|
|
XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd
|
2020-09-22 20:45:23 +03:00
|
|
|
XInfoStream(ctx context.Context, key string) *XInfoStreamCmd
|
2021-08-02 14:01:01 +03:00
|
|
|
XInfoStreamFull(ctx context.Context, key string, count int) *XInfoStreamFullCmd
|
2021-04-06 17:13:34 +03:00
|
|
|
XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
|
|
|
|
BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd
|
|
|
|
BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
|
|
|
|
ZAdd(ctx context.Context, key string, members ...Z) *IntCmd
|
|
|
|
ZAddNX(ctx context.Context, key string, members ...Z) *IntCmd
|
|
|
|
ZAddXX(ctx context.Context, key string, members ...Z) *IntCmd
|
|
|
|
ZAddArgs(ctx context.Context, key string, args ZAddArgs) *IntCmd
|
|
|
|
ZAddArgsIncr(ctx context.Context, key string, args ZAddArgs) *FloatCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ZCard(ctx context.Context, key string) *IntCmd
|
|
|
|
ZCount(ctx context.Context, key, min, max string) *IntCmd
|
|
|
|
ZLexCount(ctx context.Context, key, min, max string) *IntCmd
|
|
|
|
ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd
|
2021-05-29 16:11:47 +03:00
|
|
|
ZInter(ctx context.Context, store *ZStore) *StringSliceCmd
|
|
|
|
ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd
|
2021-03-05 21:02:53 +03:00
|
|
|
ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd
|
|
|
|
ZPopMin(ctx context.Context, key string, count ...int64) *ZSliceCmd
|
|
|
|
ZRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd
|
|
|
|
ZRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd
|
|
|
|
ZRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd
|
|
|
|
ZRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd
|
|
|
|
ZRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
ZRangeArgs(ctx context.Context, z ZRangeArgs) *StringSliceCmd
|
|
|
|
ZRangeArgsWithScores(ctx context.Context, z ZRangeArgs) *ZSliceCmd
|
|
|
|
ZRangeStore(ctx context.Context, dst string, z ZRangeArgs) *IntCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ZRank(ctx context.Context, key, member string) *IntCmd
|
|
|
|
ZRem(ctx context.Context, key string, members ...interface{}) *IntCmd
|
|
|
|
ZRemRangeByRank(ctx context.Context, key string, start, stop int64) *IntCmd
|
|
|
|
ZRemRangeByScore(ctx context.Context, key, min, max string) *IntCmd
|
|
|
|
ZRemRangeByLex(ctx context.Context, key, min, max string) *IntCmd
|
|
|
|
ZRevRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd
|
|
|
|
ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd
|
|
|
|
ZRevRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd
|
|
|
|
ZRevRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd
|
|
|
|
ZRevRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd
|
|
|
|
ZRevRank(ctx context.Context, key, member string) *IntCmd
|
|
|
|
ZScore(ctx context.Context, key, member string) *FloatCmd
|
|
|
|
ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd
|
2021-04-27 10:04:46 +03:00
|
|
|
ZRandMember(ctx context.Context, key string, count int) *StringSliceCmd
|
|
|
|
ZRandMemberWithScores(ctx context.Context, key string, count int) *ZSliceCmd
|
2021-06-28 12:40:38 +03:00
|
|
|
ZUnion(ctx context.Context, store ZStore) *StringSliceCmd
|
|
|
|
ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd
|
2021-05-23 11:55:03 +03:00
|
|
|
ZDiff(ctx context.Context, keys ...string) *StringSliceCmd
|
|
|
|
ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd
|
2021-06-01 05:02:09 +03:00
|
|
|
ZDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
|
|
|
|
PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd
|
|
|
|
PFCount(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd
|
|
|
|
|
|
|
|
BgRewriteAOF(ctx context.Context) *StatusCmd
|
|
|
|
BgSave(ctx context.Context) *StatusCmd
|
|
|
|
ClientKill(ctx context.Context, ipPort string) *StatusCmd
|
|
|
|
ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd
|
|
|
|
ClientList(ctx context.Context) *StringCmd
|
|
|
|
ClientPause(ctx context.Context, dur time.Duration) *BoolCmd
|
2022-06-04 15:02:53 +03:00
|
|
|
ClientUnpause(ctx context.Context) *BoolCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ClientID(ctx context.Context) *IntCmd
|
2021-08-02 14:01:01 +03:00
|
|
|
ClientUnblock(ctx context.Context, id int64) *IntCmd
|
|
|
|
ClientUnblockWithError(ctx context.Context, id int64) *IntCmd
|
2021-04-27 10:04:46 +03:00
|
|
|
ConfigGet(ctx context.Context, parameter string) *MapStringStringCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
ConfigResetStat(ctx context.Context) *StatusCmd
|
|
|
|
ConfigSet(ctx context.Context, parameter, value string) *StatusCmd
|
|
|
|
ConfigRewrite(ctx context.Context) *StatusCmd
|
|
|
|
DBSize(ctx context.Context) *IntCmd
|
|
|
|
FlushAll(ctx context.Context) *StatusCmd
|
|
|
|
FlushAllAsync(ctx context.Context) *StatusCmd
|
|
|
|
FlushDB(ctx context.Context) *StatusCmd
|
|
|
|
FlushDBAsync(ctx context.Context) *StatusCmd
|
|
|
|
Info(ctx context.Context, section ...string) *StringCmd
|
|
|
|
LastSave(ctx context.Context) *IntCmd
|
|
|
|
Save(ctx context.Context) *StatusCmd
|
|
|
|
Shutdown(ctx context.Context) *StatusCmd
|
|
|
|
ShutdownSave(ctx context.Context) *StatusCmd
|
|
|
|
ShutdownNoSave(ctx context.Context) *StatusCmd
|
|
|
|
SlaveOf(ctx context.Context, host, port string) *StatusCmd
|
2021-08-02 14:01:01 +03:00
|
|
|
SlowLogGet(ctx context.Context, num int64) *SlowLogCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
Time(ctx context.Context) *TimeCmd
|
|
|
|
DebugObject(ctx context.Context, key string) *StringCmd
|
|
|
|
ReadOnly(ctx context.Context) *StatusCmd
|
|
|
|
ReadWrite(ctx context.Context) *StatusCmd
|
|
|
|
MemoryUsage(ctx context.Context, key string, samples ...int) *IntCmd
|
|
|
|
|
|
|
|
Eval(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd
|
|
|
|
EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd
|
|
|
|
ScriptExists(ctx context.Context, hashes ...string) *BoolSliceCmd
|
|
|
|
ScriptFlush(ctx context.Context) *StatusCmd
|
|
|
|
ScriptKill(ctx context.Context) *StatusCmd
|
|
|
|
ScriptLoad(ctx context.Context, script string) *StringCmd
|
|
|
|
|
|
|
|
Publish(ctx context.Context, channel string, message interface{}) *IntCmd
|
|
|
|
PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd
|
2022-08-08 10:28:46 +03:00
|
|
|
PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
PubSubNumPat(ctx context.Context) *IntCmd
|
|
|
|
|
|
|
|
ClusterSlots(ctx context.Context) *ClusterSlotsCmd
|
|
|
|
ClusterNodes(ctx context.Context) *StringCmd
|
|
|
|
ClusterMeet(ctx context.Context, host, port string) *StatusCmd
|
|
|
|
ClusterForget(ctx context.Context, nodeID string) *StatusCmd
|
|
|
|
ClusterReplicate(ctx context.Context, nodeID string) *StatusCmd
|
|
|
|
ClusterResetSoft(ctx context.Context) *StatusCmd
|
|
|
|
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
|
|
|
|
ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd
|
|
|
|
ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd
|
|
|
|
ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd
|
|
|
|
ClusterDelSlotsRange(ctx context.Context, min, max int) *StatusCmd
|
|
|
|
ClusterSaveConfig(ctx context.Context) *StatusCmd
|
|
|
|
ClusterSlaves(ctx context.Context, nodeID string) *StringSliceCmd
|
|
|
|
ClusterFailover(ctx context.Context) *StatusCmd
|
|
|
|
ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd
|
|
|
|
ClusterAddSlotsRange(ctx context.Context, min, max int) *StatusCmd
|
|
|
|
|
|
|
|
GeoAdd(ctx context.Context, key string, geoLocation ...*GeoLocation) *IntCmd
|
|
|
|
GeoPos(ctx context.Context, key string, members ...string) *GeoPosCmd
|
|
|
|
GeoRadius(ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery) *GeoLocationCmd
|
|
|
|
GeoRadiusStore(ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery) *IntCmd
|
|
|
|
GeoRadiusByMember(ctx context.Context, key, member string, query *GeoRadiusQuery) *GeoLocationCmd
|
|
|
|
GeoRadiusByMemberStore(ctx context.Context, key, member string, query *GeoRadiusQuery) *IntCmd
|
2021-08-02 14:01:01 +03:00
|
|
|
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
|
2020-03-11 17:26:42 +03:00
|
|
|
GeoDist(ctx context.Context, key string, member1, member2, unit string) *FloatCmd
|
|
|
|
GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd
|
2016-07-21 08:50:28 +03:00
|
|
|
}
|
|
|
|
|
2017-05-01 18:42:58 +03:00
|
|
|
type StatefulCmdable interface {
|
2017-05-25 13:38:04 +03:00
|
|
|
Cmdable
|
2020-03-11 17:26:42 +03:00
|
|
|
Auth(ctx context.Context, password string) *StatusCmd
|
2020-05-21 10:16:44 +03:00
|
|
|
AuthACL(ctx context.Context, username, password string) *StatusCmd
|
2020-03-11 17:26:42 +03:00
|
|
|
Select(ctx context.Context, index int) *StatusCmd
|
|
|
|
SwapDB(ctx context.Context, index1, index2 int) *StatusCmd
|
|
|
|
ClientSetName(ctx context.Context, name string) *BoolCmd
|
2021-04-27 10:04:46 +03:00
|
|
|
Hello(ctx context.Context, ver int, username, password, clientName string) *MapStringInterfaceCmd
|
2017-05-01 18:42:58 +03:00
|
|
|
}
|
|
|
|
|
2020-07-16 09:52:07 +03:00
|
|
|
var (
|
|
|
|
_ Cmdable = (*Client)(nil)
|
|
|
|
_ Cmdable = (*Tx)(nil)
|
|
|
|
_ Cmdable = (*Ring)(nil)
|
|
|
|
_ Cmdable = (*ClusterClient)(nil)
|
|
|
|
)
|
2016-12-14 13:12:50 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
type cmdable func(ctx context.Context, cmd Cmder) error
|
2017-05-25 13:38:04 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
type statefulCmdable func(ctx context.Context, cmd Cmder) error
|
2017-05-25 13:38:04 +03:00
|
|
|
|
2012-07-27 18:21:50 +04:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c statefulCmdable) Auth(ctx context.Context, password string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "auth", password)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// AuthACL Perform an AUTH command, using the given user and pass.
|
2020-05-21 08:59:20 +03:00
|
|
|
// Should be used to authenticate the current connection with one of the connections defined in the ACL list
|
|
|
|
// when connecting to a Redis 6.0 instance, or greater, that is using the Redis ACL system.
|
2020-05-21 10:19:17 +03:00
|
|
|
func (c statefulCmdable) AuthACL(ctx context.Context, username, password string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "auth", username, password)
|
|
|
|
_ = c(ctx, cmd)
|
2020-05-21 08:59:20 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Wait(ctx context.Context, numSlaves int, timeout time.Duration) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "wait", numSlaves, int(timeout/time.Millisecond))
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c statefulCmdable) Select(ctx context.Context, index int) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "select", index)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c statefulCmdable) SwapDB(ctx context.Context, index1, index2 int) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "swapdb", index1, index2)
|
|
|
|
_ = c(ctx, cmd)
|
2017-02-16 19:15:34 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
// ClientSetName assigns a name to the connection.
|
|
|
|
func (c statefulCmdable) ClientSetName(ctx context.Context, name string) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "client", "setname", name)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
2012-08-25 16:40:49 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// Hello Set the resp protocol used.
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c statefulCmdable) Hello(ctx context.Context,
|
|
|
|
ver int, username, password, clientName string) *MapStringInterfaceCmd {
|
|
|
|
args := make([]interface{}, 0, 7)
|
|
|
|
args = append(args, "hello", ver)
|
|
|
|
if password != "" {
|
|
|
|
if username != "" {
|
|
|
|
args = append(args, "auth", username, password)
|
|
|
|
} else {
|
|
|
|
args = append(args, "auth", "default", password)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if clientName != "" {
|
|
|
|
args = append(args, "setname", clientName)
|
|
|
|
}
|
|
|
|
cmd := NewMapStringInterfaceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
func (c cmdable) Command(ctx context.Context) *CommandsInfoCmd {
|
|
|
|
cmd := NewCommandsInfoCmd(ctx, "command")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
// ClientGetName returns the name of the connection.
|
|
|
|
func (c cmdable) ClientGetName(ctx context.Context) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "client", "getname")
|
|
|
|
_ = c(ctx, cmd)
|
2018-02-14 07:42:19 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Echo(ctx context.Context, message interface{}) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "echo", message)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
2012-07-26 19:16:17 +04:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Ping(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "ping")
|
|
|
|
_ = c(ctx, cmd)
|
2018-07-22 09:46:29 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) Quit(_ context.Context) *StatusCmd {
|
2020-03-11 17:26:42 +03:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) Del(ctx context.Context, keys ...string) *IntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-07-08 12:24:02 +03:00
|
|
|
args[0] = "del"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Unlink(ctx context.Context, keys ...string) *IntCmd {
|
2016-12-22 14:42:05 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
|
|
|
args[0] = "unlink"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2016-12-22 14:42:05 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Dump(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "dump", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Exists(ctx context.Context, keys ...string) *IntCmd {
|
2017-02-10 13:15:25 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
|
|
|
args[0] = "exists"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2017-02-10 13:15:25 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
return c.expire(ctx, key, expiration, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
|
|
|
return c.expire(ctx, key, expiration, "NX")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
|
|
|
return c.expire(ctx, key, expiration, "XX")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
|
|
|
return c.expire(ctx, key, expiration, "GT")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
|
|
|
return c.expire(ctx, key, expiration, "LT")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) expire(
|
|
|
|
ctx context.Context, key string, expiration time.Duration, mode string,
|
|
|
|
) *BoolCmd {
|
|
|
|
args := make([]interface{}, 3, 4)
|
|
|
|
args[0] = "expire"
|
|
|
|
args[1] = key
|
|
|
|
args[2] = formatSec(ctx, expiration)
|
|
|
|
if mode != "" {
|
|
|
|
args = append(args, mode)
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := NewBoolCmd(ctx, args...)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "expireat", key, tm.Unix())
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Keys(ctx context.Context, pattern string) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "keys", pattern)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewStatusCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"migrate",
|
2012-07-26 19:16:17 +04:00
|
|
|
host,
|
2012-08-17 22:36:48 +04:00
|
|
|
port,
|
2012-07-26 19:16:17 +04:00
|
|
|
key,
|
2015-10-07 18:21:18 +03:00
|
|
|
db,
|
2020-07-18 09:04:36 +03:00
|
|
|
formatMs(ctx, timeout),
|
2012-07-26 19:16:17 +04:00
|
|
|
)
|
2018-07-22 08:49:48 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Move(ctx context.Context, key string, db int) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "move", key, db)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ObjectRefCount(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "object", "refcount", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ObjectEncoding(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "object", "encoding", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ObjectIdleTime(ctx context.Context, key string) *DurationCmd {
|
|
|
|
cmd := NewDurationCmd(ctx, time.Second, "object", "idletime", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Persist(ctx context.Context, key string) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "persist", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PExpire(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd := NewBoolCmd(ctx, "pexpire", key, formatMs(ctx, expiration))
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewBoolCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"pexpireat",
|
2014-05-11 11:42:40 +04:00
|
|
|
key,
|
2015-10-07 18:21:18 +03:00
|
|
|
tm.UnixNano()/int64(time.Millisecond),
|
2014-05-11 11:42:40 +04:00
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PTTL(ctx context.Context, key string) *DurationCmd {
|
|
|
|
cmd := NewDurationCmd(ctx, time.Millisecond, "pttl", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RandomKey(ctx context.Context) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "randomkey")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Rename(ctx context.Context, key, newkey string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "rename", key, newkey)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RenameNX(ctx context.Context, key, newkey string) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "renamenx", key, newkey)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Restore(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewStatusCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"restore",
|
2012-08-17 22:36:48 +04:00
|
|
|
key,
|
2020-07-18 09:04:36 +03:00
|
|
|
formatMs(ctx, ttl),
|
2012-07-26 19:16:17 +04:00
|
|
|
value,
|
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *StatusCmd {
|
2015-07-11 12:23:04 +03:00
|
|
|
cmd := NewStatusCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"restore",
|
2015-07-11 12:23:04 +03:00
|
|
|
key,
|
2020-07-18 09:04:36 +03:00
|
|
|
formatMs(ctx, ttl),
|
2015-07-11 12:23:04 +03:00
|
|
|
value,
|
2016-05-06 21:12:31 +03:00
|
|
|
"replace",
|
2015-07-11 12:23:04 +03:00
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2015-07-11 12:23:04 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2012-08-17 22:36:48 +04:00
|
|
|
type Sort struct {
|
|
|
|
By string
|
2018-02-13 17:08:11 +03:00
|
|
|
Offset, Count int64
|
2012-08-17 22:36:48 +04:00
|
|
|
Get []string
|
|
|
|
Order string
|
2018-02-13 17:08:11 +03:00
|
|
|
Alpha bool
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
|
2016-01-22 13:29:23 +03:00
|
|
|
func (sort *Sort) args(key string) []interface{} {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := []interface{}{"sort", key}
|
2012-08-17 22:36:48 +04:00
|
|
|
if sort.By != "" {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = append(args, "by", sort.By)
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
if sort.Offset != 0 || sort.Count != 0 {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = append(args, "limit", sort.Offset, sort.Count)
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
for _, get := range sort.Get {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = append(args, "get", get)
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
if sort.Order != "" {
|
|
|
|
args = append(args, sort.Order)
|
|
|
|
}
|
2018-02-13 17:08:11 +03:00
|
|
|
if sort.Alpha {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = append(args, "alpha")
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
2016-01-22 13:29:23 +03:00
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Sort(ctx context.Context, key string, sort *Sort) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, sort.args(key)...)
|
|
|
|
_ = c(ctx, cmd)
|
2016-01-22 13:29:23 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SortStore(ctx context.Context, key, store string, sort *Sort) *IntCmd {
|
2018-02-13 17:08:11 +03:00
|
|
|
args := sort.args(key)
|
|
|
|
if store != "" {
|
|
|
|
args = append(args, "store", store)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-02-13 17:08:11 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SortInterfaces(ctx context.Context, key string, sort *Sort) *SliceCmd {
|
|
|
|
cmd := NewSliceCmd(ctx, sort.args(key)...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Touch(ctx context.Context, keys ...string) *IntCmd {
|
2018-02-14 07:42:19 +03:00
|
|
|
args := make([]interface{}, len(keys)+1)
|
|
|
|
args[0] = "touch"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[i+1] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2017-01-03 13:44:06 +03:00
|
|
|
return cmd
|
2014-05-11 11:42:40 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) TTL(ctx context.Context, key string) *DurationCmd {
|
|
|
|
cmd := NewDurationCmd(ctx, time.Second, "ttl", key)
|
|
|
|
_ = c(ctx, cmd)
|
2017-01-03 13:44:06 +03:00
|
|
|
return cmd
|
2014-05-11 11:42:40 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Type(ctx context.Context, key string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "type", key)
|
|
|
|
_ = c(ctx, cmd)
|
2017-01-03 13:44:06 +03:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Append(ctx context.Context, key, value string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "append", key, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Decr(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "decr", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-19 16:57:58 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) DecrBy(ctx context.Context, key string, decrement int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "decrby", key, decrement)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// Get Redis `GET key` command. It returns redis.Nil error when key does not exist.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Get(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "get", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) GetRange(ctx context.Context, key string, start, end int64) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "getrange", key, start, end)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) GetSet(ctx context.Context, key string, value interface{}) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "getset", key, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// GetEx An expiration of zero removes the TTL associated with the key (i.e. GETEX key persist).
|
2021-03-27 18:22:10 +03:00
|
|
|
// Requires Redis >= 6.2.0.
|
|
|
|
func (c cmdable) GetEx(ctx context.Context, key string, expiration time.Duration) *StringCmd {
|
2021-03-27 05:37:44 +03:00
|
|
|
args := make([]interface{}, 0, 4)
|
2021-03-26 12:13:22 +03:00
|
|
|
args = append(args, "getex", key)
|
2021-03-27 05:37:44 +03:00
|
|
|
if expiration > 0 {
|
|
|
|
if usePrecise(expiration) {
|
|
|
|
args = append(args, "px", formatMs(ctx, expiration))
|
|
|
|
} else {
|
|
|
|
args = append(args, "ex", formatSec(ctx, expiration))
|
|
|
|
}
|
2021-03-27 12:49:55 +03:00
|
|
|
} else if expiration == 0 {
|
2021-03-27 05:37:44 +03:00
|
|
|
args = append(args, "persist")
|
|
|
|
}
|
|
|
|
|
2021-03-26 12:13:22 +03:00
|
|
|
cmd := NewStringCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// GetDel redis-server version >= 6.2.0.
|
2021-03-26 12:13:22 +03:00
|
|
|
func (c cmdable) GetDel(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "getdel", key)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Incr(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "incr", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) IncrBy(ctx context.Context, key string, value int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "incrby", key, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) IncrByFloat(ctx context.Context, key string, value float64) *FloatCmd {
|
|
|
|
cmd := NewFloatCmd(ctx, "incrbyfloat", key, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) MGet(ctx context.Context, keys ...string) *SliceCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "mget"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2019-12-18 11:52:49 +03:00
|
|
|
// MSet is like Set but accepts multiple values:
|
|
|
|
// - MSet("key1", "value1", "key2", "value2")
|
|
|
|
// - MSet([]string{"key1", "value1", "key2", "value2"})
|
|
|
|
// - MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) MSet(ctx context.Context, values ...interface{}) *StatusCmd {
|
2019-12-18 11:52:49 +03:00
|
|
|
args := make([]interface{}, 1, 1+len(values))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "mset"
|
2019-12-18 11:52:49 +03:00
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2019-12-18 11:52:49 +03:00
|
|
|
// MSetNX is like SetNX but accepts multiple values:
|
|
|
|
// - MSetNX("key1", "value1", "key2", "value2")
|
|
|
|
// - MSetNX([]string{"key1", "value1", "key2", "value2"})
|
|
|
|
// - MSetNX(map[string]interface{}{"key1": "value1", "key2": "value2"})
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) MSetNX(ctx context.Context, values ...interface{}) *BoolCmd {
|
2019-12-18 11:52:49 +03:00
|
|
|
args := make([]interface{}, 1, 1+len(values))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "msetnx"
|
2019-12-18 11:52:49 +03:00
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewBoolCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// Set Redis `SET key value [expiration]` command.
|
2021-06-28 12:40:38 +03:00
|
|
|
// Use expiration for `SETEx`-like behavior.
|
2020-09-18 14:57:59 +03:00
|
|
|
//
|
2015-08-07 17:02:17 +03:00
|
|
|
// Zero expiration means the key has no expiration time.
|
2021-06-28 12:40:38 +03:00
|
|
|
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
|
|
|
|
// otherwise you will receive an error: (error) ERR syntax error.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd {
|
2019-12-04 12:18:13 +03:00
|
|
|
args := make([]interface{}, 3, 5)
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "set"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
|
|
|
args[2] = value
|
2015-01-31 12:08:56 +03:00
|
|
|
if expiration > 0 {
|
|
|
|
if usePrecise(expiration) {
|
2020-07-18 09:04:36 +03:00
|
|
|
args = append(args, "px", formatMs(ctx, expiration))
|
2015-01-31 12:08:56 +03:00
|
|
|
} else {
|
2020-07-18 09:04:36 +03:00
|
|
|
args = append(args, "ex", formatSec(ctx, expiration))
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
2020-09-18 14:49:12 +03:00
|
|
|
} else if expiration == KeepTTL {
|
|
|
|
args = append(args, "keepttl")
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
2020-09-18 14:49:12 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2021-02-17 15:48:47 +03:00
|
|
|
// SetArgs provides arguments for the SetArgs function.
|
|
|
|
type SetArgs struct {
|
|
|
|
// Mode can be `NX` or `XX` or empty.
|
|
|
|
Mode string
|
|
|
|
|
|
|
|
// Zero `TTL` or `Expiration` means that the key has no expiration time.
|
|
|
|
TTL time.Duration
|
|
|
|
ExpireAt time.Time
|
|
|
|
|
|
|
|
// When Get is true, the command returns the old value stored at key, or nil when key did not exist.
|
|
|
|
Get bool
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
|
|
|
|
// otherwise you will receive an error: (error) ERR syntax error.
|
2021-02-17 15:48:47 +03:00
|
|
|
KeepTTL bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetArgs supports all the options that the SET command supports.
|
|
|
|
// It is the alternative to the Set function when you want
|
|
|
|
// to have more control over the options.
|
2021-02-17 16:12:10 +03:00
|
|
|
func (c cmdable) SetArgs(ctx context.Context, key string, value interface{}, a SetArgs) *StatusCmd {
|
2021-02-17 15:48:47 +03:00
|
|
|
args := []interface{}{"set", key, value}
|
|
|
|
|
|
|
|
if a.KeepTTL {
|
|
|
|
args = append(args, "keepttl")
|
|
|
|
}
|
|
|
|
|
2021-02-17 16:12:10 +03:00
|
|
|
if !a.ExpireAt.IsZero() {
|
2021-02-17 15:48:47 +03:00
|
|
|
args = append(args, "exat", a.ExpireAt.Unix())
|
2021-02-17 16:12:10 +03:00
|
|
|
}
|
|
|
|
if a.TTL > 0 {
|
2021-02-17 15:48:47 +03:00
|
|
|
if usePrecise(a.TTL) {
|
|
|
|
args = append(args, "px", formatMs(ctx, a.TTL))
|
|
|
|
} else {
|
|
|
|
args = append(args, "ex", formatSec(ctx, a.TTL))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Mode != "" {
|
|
|
|
args = append(args, a.Mode)
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Get {
|
|
|
|
args = append(args, "get")
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// SetEx Redis `SETEx key expiration value` command.
|
|
|
|
func (c cmdable) SetEx(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd {
|
2020-10-23 05:51:54 +03:00
|
|
|
cmd := NewStatusCmd(ctx, "setex", key, formatSec(ctx, expiration), value)
|
2020-10-22 21:38:36 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SetNX Redis `SET key value [expiration] NX` command.
|
2015-08-07 17:02:17 +03:00
|
|
|
//
|
|
|
|
// Zero expiration means the key has no expiration time.
|
2021-06-28 12:40:38 +03:00
|
|
|
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
|
|
|
|
// otherwise you will receive an error: (error) ERR syntax error.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd {
|
2015-01-31 12:08:56 +03:00
|
|
|
var cmd *BoolCmd
|
2020-09-18 14:57:59 +03:00
|
|
|
switch expiration {
|
|
|
|
case 0:
|
2015-01-31 12:08:56 +03:00
|
|
|
// Use old `SETNX` to support old Redis versions.
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "setnx", key, value)
|
2020-09-18 14:57:59 +03:00
|
|
|
case KeepTTL:
|
2020-09-18 14:49:12 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "keepttl", "nx")
|
|
|
|
default:
|
2015-01-31 12:08:56 +03:00
|
|
|
if usePrecise(expiration) {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "px", formatMs(ctx, expiration), "nx")
|
2015-01-31 12:08:56 +03:00
|
|
|
} else {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "ex", formatSec(ctx, expiration), "nx")
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
|
|
|
}
|
2020-09-18 14:49:12 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SetXX Redis `SET key value [expiration] XX` command.
|
2015-08-07 17:02:17 +03:00
|
|
|
//
|
|
|
|
// Zero expiration means the key has no expiration time.
|
2021-06-28 12:40:38 +03:00
|
|
|
// KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
|
|
|
|
// otherwise you will receive an error: (error) ERR syntax error.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd {
|
2015-01-31 12:08:56 +03:00
|
|
|
var cmd *BoolCmd
|
2020-09-18 14:57:59 +03:00
|
|
|
switch expiration {
|
|
|
|
case 0:
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "xx")
|
2020-09-18 14:57:59 +03:00
|
|
|
case KeepTTL:
|
2020-09-18 14:49:12 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "keepttl", "xx")
|
|
|
|
default:
|
2015-01-31 12:08:56 +03:00
|
|
|
if usePrecise(expiration) {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "px", formatMs(ctx, expiration), "xx")
|
2015-01-31 12:08:56 +03:00
|
|
|
} else {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd = NewBoolCmd(ctx, "set", key, value, "ex", formatSec(ctx, expiration), "xx")
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
|
|
|
}
|
2020-09-18 14:49:12 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) SetRange(ctx context.Context, key string, offset int64, value string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "setrange", key, offset, value)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) StrLen(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "strlen", key)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
func (c cmdable) Copy(ctx context.Context, sourceKey, destKey string, db int, replace bool) *IntCmd {
|
|
|
|
args := []interface{}{"copy", sourceKey, destKey, "DB", db}
|
|
|
|
if replace {
|
|
|
|
args = append(args, "REPLACE")
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
func (c cmdable) GetBit(ctx context.Context, key string, offset int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "getbit", key, offset)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) SetBit(ctx context.Context, key string, offset int64, value int) *IntCmd {
|
|
|
|
cmd := NewIntCmd(
|
|
|
|
ctx,
|
|
|
|
"setbit",
|
|
|
|
key,
|
|
|
|
offset,
|
|
|
|
value,
|
|
|
|
)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
type BitCount struct {
|
|
|
|
Start, End int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitCount(ctx context.Context, key string, bitCount *BitCount) *IntCmd {
|
|
|
|
args := []interface{}{"bitcount", key}
|
|
|
|
if bitCount != nil {
|
|
|
|
args = append(
|
|
|
|
args,
|
|
|
|
bitCount.Start,
|
|
|
|
bitCount.End,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) bitOp(ctx context.Context, op, destKey string, keys ...string) *IntCmd {
|
|
|
|
args := make([]interface{}, 3+len(keys))
|
|
|
|
args[0] = "bitop"
|
|
|
|
args[1] = op
|
|
|
|
args[2] = destKey
|
|
|
|
for i, key := range keys {
|
|
|
|
args[3+i] = key
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitOpAnd(ctx context.Context, destKey string, keys ...string) *IntCmd {
|
|
|
|
return c.bitOp(ctx, "and", destKey, keys...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitOpOr(ctx context.Context, destKey string, keys ...string) *IntCmd {
|
|
|
|
return c.bitOp(ctx, "or", destKey, keys...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitOpXor(ctx context.Context, destKey string, keys ...string) *IntCmd {
|
|
|
|
return c.bitOp(ctx, "xor", destKey, keys...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitOpNot(ctx context.Context, destKey string, key string) *IntCmd {
|
|
|
|
return c.bitOp(ctx, "not", destKey, key)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *IntCmd {
|
|
|
|
args := make([]interface{}, 3+len(pos))
|
|
|
|
args[0] = "bitpos"
|
|
|
|
args[1] = key
|
|
|
|
args[2] = bit
|
|
|
|
switch len(pos) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
args[3] = pos[0]
|
|
|
|
case 2:
|
|
|
|
args[3] = pos[0]
|
|
|
|
args[4] = pos[1]
|
|
|
|
default:
|
|
|
|
panic("too many arguments")
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) BitField(ctx context.Context, key string, args ...interface{}) *IntSliceCmd {
|
|
|
|
a := make([]interface{}, 0, 2+len(args))
|
|
|
|
a = append(a, "bitfield")
|
|
|
|
a = append(a, key)
|
|
|
|
a = append(a, args...)
|
|
|
|
cmd := NewIntSliceCmd(ctx, a...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
func (c cmdable) Scan(ctx context.Context, cursor uint64, match string, count int64) *ScanCmd {
|
|
|
|
args := []interface{}{"scan", cursor}
|
|
|
|
if match != "" {
|
|
|
|
args = append(args, "match", match)
|
|
|
|
}
|
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
cmd := NewScanCmd(ctx, c, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-31 12:08:56 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-01-08 22:36:20 +03:00
|
|
|
func (c cmdable) ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) *ScanCmd {
|
|
|
|
args := []interface{}{"scan", cursor}
|
|
|
|
if match != "" {
|
|
|
|
args = append(args, "match", match)
|
|
|
|
}
|
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
if keyType != "" {
|
|
|
|
args = append(args, "type", keyType)
|
|
|
|
}
|
|
|
|
cmd := NewScanCmd(ctx, c, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd {
|
|
|
|
args := []interface{}{"sscan", key, cursor}
|
|
|
|
if match != "" {
|
|
|
|
args = append(args, "match", match)
|
2015-01-31 12:08:56 +03:00
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
cmd := NewScanCmd(ctx, c, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd {
|
|
|
|
args := []interface{}{"hscan", key, cursor}
|
|
|
|
if match != "" {
|
|
|
|
args = append(args, "match", match)
|
|
|
|
}
|
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
cmd := NewScanCmd(ctx, c, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) *ScanCmd {
|
|
|
|
args := []interface{}{"zscan", key, cursor}
|
|
|
|
if match != "" {
|
|
|
|
args = append(args, "match", match)
|
|
|
|
}
|
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
cmd := NewScanCmd(ctx, c, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HDel(ctx context.Context, key string, fields ...string) *IntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(fields))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "hdel"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
|
|
|
for i, field := range fields {
|
|
|
|
args[2+i] = field
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HExists(ctx context.Context, key, field string) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "hexists", key, field)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HGet(ctx context.Context, key, field string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "hget", key, field)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) HGetAll(ctx context.Context, key string) *MapStringStringCmd {
|
|
|
|
cmd := NewMapStringStringCmd(ctx, "hgetall", key)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2013-02-02 16:17:01 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HIncrBy(ctx context.Context, key, field string, incr int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "hincrby", key, field, incr)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HIncrByFloat(ctx context.Context, key, field string, incr float64) *FloatCmd {
|
|
|
|
cmd := NewFloatCmd(ctx, "hincrbyfloat", key, field, incr)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
2012-07-25 17:00:50 +04:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HKeys(ctx context.Context, key string) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "hkeys", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HLen(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "hlen", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-01-12 13:03:21 +03:00
|
|
|
// HMGet returns the values for the specified fields in the hash stored at key.
|
|
|
|
// It returns an interface{} to distinguish between empty string and nil value.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HMGet(ctx context.Context, key string, fields ...string) *SliceCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(fields))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "hmget"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
|
|
|
for i, field := range fields {
|
|
|
|
args[2+i] = field
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
2012-07-25 17:00:50 +04:00
|
|
|
|
2020-02-19 16:14:18 +03:00
|
|
|
// HSet accepts values in following formats:
|
2020-06-08 05:50:34 +03:00
|
|
|
// - HSet("myhash", "key1", "value1", "key2", "value2")
|
|
|
|
// - HSet("myhash", []string{"key1", "value1", "key2", "value2"})
|
|
|
|
// - HSet("myhash", map[string]interface{}{"key1": "value1", "key2": "value2"})
|
2019-12-18 11:52:49 +03:00
|
|
|
//
|
2020-02-19 16:14:18 +03:00
|
|
|
// Note that it requires Redis v4 for multiple field/value pairs support.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HSet(ctx context.Context, key string, values ...interface{}) *IntCmd {
|
2019-12-24 13:23:32 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
2019-12-18 11:52:49 +03:00
|
|
|
args[0] = "hset"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2019-12-18 11:52:49 +03:00
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-02-19 16:14:18 +03:00
|
|
|
// HMSet is a deprecated version of HSet left for compatibility with Redis 3.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HMSet(ctx context.Context, key string, values ...interface{}) *BoolCmd {
|
2020-02-19 16:14:18 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
|
|
|
args[0] = "hmset"
|
|
|
|
args[1] = key
|
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewBoolCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HSetNX(ctx context.Context, key, field string, value interface{}) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "hsetnx", key, field, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) HVals(ctx context.Context, key string) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "hvals", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// HRandField redis-server version >= 6.2.0.
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) HRandField(ctx context.Context, key string, count int) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "hrandfield", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
2021-03-27 05:37:44 +03:00
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// HRandFieldWithValues redis-server version >= 6.2.0.
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) HRandFieldWithValues(ctx context.Context, key string, count int) *KeyValueSliceCmd {
|
|
|
|
cmd := NewKeyValueSliceCmd(ctx, "hrandfield", key, count, "withvalues")
|
2021-03-27 05:37:44 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2012-07-26 19:16:17 +04:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := make([]interface{}, 1+len(keys)+1)
|
|
|
|
args[0] = "blpop"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-07-18 09:04:36 +03:00
|
|
|
args[len(args)-1] = formatSec(ctx, timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
2018-07-22 08:49:48 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *StringSliceCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := make([]interface{}, 1+len(keys)+1)
|
|
|
|
args[0] = "brpop"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-07-18 09:04:36 +03:00
|
|
|
args[len(keys)+1] = formatSec(ctx, timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
2018-07-22 08:49:48 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BRPopLPush(ctx context.Context, source, destination string, timeout time.Duration) *StringCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewStringCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"brpoplpush",
|
2012-07-26 19:16:17 +04:00
|
|
|
source,
|
|
|
|
destination,
|
2020-07-18 09:04:36 +03:00
|
|
|
formatSec(ctx, timeout),
|
2012-07-26 19:16:17 +04:00
|
|
|
)
|
2018-07-22 08:49:48 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LIndex(ctx context.Context, key string, index int64) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "lindex", key, index)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LInsert(ctx context.Context, key, op string, pivot, value interface{}) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "linsert", key, op, pivot, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LInsertBefore(ctx context.Context, key string, pivot, value interface{}) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "linsert", key, "before", pivot, value)
|
|
|
|
_ = c(ctx, cmd)
|
2016-06-14 13:22:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LInsertAfter(ctx context.Context, key string, pivot, value interface{}) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "linsert", key, "after", pivot, value)
|
|
|
|
_ = c(ctx, cmd)
|
2016-06-14 13:22:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LLen(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "llen", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LPop(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "lpop", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-05-19 12:43:31 +03:00
|
|
|
func (c cmdable) LPopCount(ctx context.Context, key string, count int) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "lpop", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-11-17 09:48:46 +03:00
|
|
|
type LPosArgs struct {
|
|
|
|
Rank, MaxLen int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) LPos(ctx context.Context, key string, value string, a LPosArgs) *IntCmd {
|
|
|
|
args := []interface{}{"lpos", key, value}
|
|
|
|
if a.Rank != 0 {
|
|
|
|
args = append(args, "rank", a.Rank)
|
|
|
|
}
|
|
|
|
if a.MaxLen != 0 {
|
|
|
|
args = append(args, "maxlen", a.MaxLen)
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) LPosCount(ctx context.Context, key string, value string, count int64, a LPosArgs) *IntSliceCmd {
|
|
|
|
args := []interface{}{"lpos", key, value, "count", count}
|
|
|
|
if a.Rank != 0 {
|
|
|
|
args = append(args, "rank", a.Rank)
|
|
|
|
}
|
|
|
|
if a.MaxLen != 0 {
|
|
|
|
args = append(args, "maxlen", a.MaxLen)
|
|
|
|
}
|
|
|
|
cmd := NewIntSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LPush(ctx context.Context, key string, values ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "lpush"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LPushX(ctx context.Context, key string, values ...interface{}) *IntCmd {
|
2019-07-18 14:53:05 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
2019-07-18 14:18:09 +03:00
|
|
|
args[0] = "lpushx"
|
|
|
|
args[1] = key
|
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewStringSliceCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"lrange",
|
2012-07-26 19:16:17 +04:00
|
|
|
key,
|
2015-10-07 18:21:18 +03:00
|
|
|
start,
|
|
|
|
stop,
|
2012-07-26 19:16:17 +04:00
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LRem(ctx context.Context, key string, count int64, value interface{}) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "lrem", key, count, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LSet(ctx context.Context, key string, index int64, value interface{}) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "lset", key, index, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LTrim(ctx context.Context, key string, start, stop int64) *StatusCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewStatusCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"ltrim",
|
2012-07-26 19:16:17 +04:00
|
|
|
key,
|
2015-10-07 18:21:18 +03:00
|
|
|
start,
|
|
|
|
stop,
|
2012-07-26 19:16:17 +04:00
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RPop(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "rpop", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-07-11 13:27:48 +03:00
|
|
|
func (c cmdable) RPopCount(ctx context.Context, key string, count int) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "rpop", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RPopLPush(ctx context.Context, source, destination string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "rpoplpush", source, destination)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RPush(ctx context.Context, key string, values ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "rpush"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) RPushX(ctx context.Context, key string, values ...interface{}) *IntCmd {
|
2019-07-18 14:53:05 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(values))
|
2019-07-18 14:18:09 +03:00
|
|
|
args[0] = "rpushx"
|
|
|
|
args[1] = key
|
|
|
|
args = appendArgs(args, values)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-04-14 03:28:55 +03:00
|
|
|
func (c cmdable) LMove(ctx context.Context, source, destination, srcpos, destpos string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "lmove", source, destination, srcpos, destpos)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
func (c cmdable) BLMove(
|
|
|
|
ctx context.Context, source, destination, srcpos, destpos string, timeout time.Duration,
|
|
|
|
) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "blmove", source, destination, srcpos, destpos, formatSec(ctx, timeout))
|
|
|
|
cmd.setReadTimeout(timeout)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2012-07-26 19:16:17 +04:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SAdd(ctx context.Context, key string, members ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(members))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sadd"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, members)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-25 17:00:50 +04:00
|
|
|
}
|
2012-07-26 19:16:17 +04:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SCard(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "scard", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SDiff(ctx context.Context, keys ...string) *StringSliceCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sdiff"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sdiffstore"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = destination
|
|
|
|
for i, key := range keys {
|
|
|
|
args[2+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SInter(ctx context.Context, keys ...string) *StringSliceCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sinter"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SInterStore(ctx context.Context, destination string, keys ...string) *IntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sinterstore"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = destination
|
|
|
|
for i, key := range keys {
|
|
|
|
args[2+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SIsMember(ctx context.Context, key string, member interface{}) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "sismember", key, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SMIsMember Redis `SMISMEMBER key member [member ...]` command.
|
2021-04-28 08:56:44 +03:00
|
|
|
func (c cmdable) SMIsMember(ctx context.Context, key string, members ...interface{}) *BoolSliceCmd {
|
|
|
|
args := make([]interface{}, 2, 2+len(members))
|
|
|
|
args[0] = "smismember"
|
|
|
|
args[1] = key
|
|
|
|
args = appendArgs(args, members)
|
|
|
|
cmd := NewBoolSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SMembers Redis `SMEMBERS key` command output as a slice.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SMembers(ctx context.Context, key string) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "smembers", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SMembersMap Redis `SMEMBERS key` command output as a map.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SMembersMap(ctx context.Context, key string) *StringStructMapCmd {
|
|
|
|
cmd := NewStringStructMapCmd(ctx, "smembers", key)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-19 19:36:23 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SMove(ctx context.Context, source, destination string, member interface{}) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "smove", source, destination, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SPop Redis `SPOP key` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SPop(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "spop", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SPopN Redis `SPOP key count` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SPopN(ctx context.Context, key string, count int64) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "spop", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
2016-06-09 18:39:51 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SRandMember Redis `SRANDMEMBER key` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SRandMember(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "srandmember", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// SRandMemberN Redis `SRANDMEMBER key count` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SRandMemberN(ctx context.Context, key string, count int64) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "srandmember", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
2015-08-25 14:02:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SRem(ctx context.Context, key string, members ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(members))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "srem"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, members)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SUnion(ctx context.Context, keys ...string) *StringSliceCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sunion"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SUnionStore(ctx context.Context, destination string, keys ...string) *IntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "sunionstore"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = destination
|
|
|
|
for i, key := range keys {
|
|
|
|
args[2+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-26 19:16:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-06-28 13:01:21 +03:00
|
|
|
// XAddArgs accepts values in the following formats:
|
|
|
|
// - XAddArgs.Values = []interface{}{"key1", "value1", "key2", "value2"}
|
|
|
|
// - XAddArgs.Values = []string("key1", "value1", "key2", "value2")
|
|
|
|
// - XAddArgs.Values = map[string]interface{}{"key1": "value1", "key2": "value2"}
|
|
|
|
//
|
|
|
|
// Note that map will not preserve the order of key-value pairs.
|
2021-06-28 12:40:38 +03:00
|
|
|
// MaxLen/MaxLenApprox and MinID are in conflict, only one of them can be used.
|
2018-08-02 14:48:46 +03:00
|
|
|
type XAddArgs struct {
|
2021-06-28 12:40:38 +03:00
|
|
|
Stream string
|
|
|
|
NoMkStream bool
|
|
|
|
MaxLen int64 // MAXLEN N
|
|
|
|
MinID string
|
|
|
|
// Approx causes MaxLen and MinID to use "~" matcher (instead of "=").
|
|
|
|
Approx bool
|
|
|
|
Limit int64
|
|
|
|
ID string
|
|
|
|
Values interface{}
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// XAdd a.Limit has a bug, please confirm it and use it.
|
|
|
|
// issue: https://github.com/redis/redis/issues/9046
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XAdd(ctx context.Context, a *XAddArgs) *StringCmd {
|
2021-06-28 12:40:38 +03:00
|
|
|
args := make([]interface{}, 0, 11)
|
|
|
|
args = append(args, "xadd", a.Stream)
|
|
|
|
if a.NoMkStream {
|
|
|
|
args = append(args, "nomkstream")
|
|
|
|
}
|
|
|
|
switch {
|
|
|
|
case a.MaxLen > 0:
|
|
|
|
if a.Approx {
|
|
|
|
args = append(args, "maxlen", "~", a.MaxLen)
|
|
|
|
} else {
|
|
|
|
args = append(args, "maxlen", a.MaxLen)
|
|
|
|
}
|
|
|
|
case a.MinID != "":
|
|
|
|
if a.Approx {
|
|
|
|
args = append(args, "minid", "~", a.MinID)
|
|
|
|
} else {
|
|
|
|
args = append(args, "minid", a.MinID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if a.Limit > 0 {
|
|
|
|
args = append(args, "limit", a.Limit)
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
2018-08-02 14:48:46 +03:00
|
|
|
if a.ID != "" {
|
|
|
|
args = append(args, a.ID)
|
2017-11-25 05:06:13 +03:00
|
|
|
} else {
|
2018-08-02 14:48:46 +03:00
|
|
|
args = append(args, "*")
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
2020-06-29 17:48:57 +03:00
|
|
|
args = appendArg(args, a.Values)
|
2017-11-25 05:06:13 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XDel(ctx context.Context, stream string, ids ...string) *IntCmd {
|
2018-11-13 15:22:50 +03:00
|
|
|
args := []interface{}{"xdel", stream}
|
|
|
|
for _, id := range ids {
|
|
|
|
args = append(args, id)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-11-13 15:22:50 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XLen(ctx context.Context, stream string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "xlen", stream)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd {
|
|
|
|
cmd := NewXMessageSliceCmd(ctx, "xrange", stream, start, stop)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd {
|
|
|
|
cmd := NewXMessageSliceCmd(ctx, "xrange", stream, start, stop, "count", count)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XRevRange(ctx context.Context, stream, start, stop string) *XMessageSliceCmd {
|
|
|
|
cmd := NewXMessageSliceCmd(ctx, "xrevrange", stream, start, stop)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XRevRangeN(ctx context.Context, stream, start, stop string, count int64) *XMessageSliceCmd {
|
|
|
|
cmd := NewXMessageSliceCmd(ctx, "xrevrange", stream, start, stop, "count", count)
|
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2018-08-02 14:48:46 +03:00
|
|
|
type XReadArgs struct {
|
2020-01-12 13:14:22 +03:00
|
|
|
Streams []string // list of streams and ids, e.g. stream1 stream2 id1 id2
|
2017-11-25 05:06:13 +03:00
|
|
|
Count int64
|
|
|
|
Block time.Duration
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XRead(ctx context.Context, a *XReadArgs) *XStreamSliceCmd {
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
args := make([]interface{}, 0, 6+len(a.Streams))
|
2018-08-02 14:48:46 +03:00
|
|
|
args = append(args, "xread")
|
2020-09-23 10:22:11 +03:00
|
|
|
|
2020-09-23 10:29:13 +03:00
|
|
|
keyPos := int8(1)
|
2018-08-02 14:48:46 +03:00
|
|
|
if a.Count > 0 {
|
|
|
|
args = append(args, "count")
|
|
|
|
args = append(args, a.Count)
|
2020-09-23 10:29:13 +03:00
|
|
|
keyPos += 2
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
2018-08-02 14:48:46 +03:00
|
|
|
if a.Block >= 0 {
|
|
|
|
args = append(args, "block")
|
|
|
|
args = append(args, int64(a.Block/time.Millisecond))
|
2020-09-23 10:29:13 +03:00
|
|
|
keyPos += 2
|
2018-08-02 14:48:46 +03:00
|
|
|
}
|
|
|
|
args = append(args, "streams")
|
2020-09-23 11:00:34 +03:00
|
|
|
keyPos++
|
2018-08-02 14:48:46 +03:00
|
|
|
for _, s := range a.Streams {
|
|
|
|
args = append(args, s)
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewXStreamSliceCmd(ctx, args...)
|
2018-09-13 09:14:52 +03:00
|
|
|
if a.Block >= 0 {
|
|
|
|
cmd.setReadTimeout(a.Block)
|
|
|
|
}
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(keyPos)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2017-11-25 05:06:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XReadStreams(ctx context.Context, streams ...string) *XStreamSliceCmd {
|
|
|
|
return c.XRead(ctx, &XReadArgs{
|
2017-11-25 05:06:13 +03:00
|
|
|
Streams: streams,
|
2018-07-18 12:08:43 +03:00
|
|
|
Block: -1,
|
2017-11-25 05:06:13 +03:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XGroupCreate(ctx context.Context, stream, group, start string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "xgroup", "create", stream, group, start)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XGroupCreateMkStream(ctx context.Context, stream, group, start string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "xgroup", "create", stream, group, start, "mkstream")
|
|
|
|
_ = c(ctx, cmd)
|
2018-12-11 17:52:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XGroupSetID(ctx context.Context, stream, group, start string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "xgroup", "setid", stream, group, start)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XGroupDestroy(ctx context.Context, stream, group string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "xgroup", "destroy", stream, group)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) XGroupCreateConsumer(ctx context.Context, stream, group, consumer string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "xgroup", "createconsumer", stream, group, consumer)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XGroupDelConsumer(ctx context.Context, stream, group, consumer string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "xgroup", "delconsumer", stream, group, consumer)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
type XReadGroupArgs struct {
|
|
|
|
Group string
|
|
|
|
Consumer string
|
2019-05-16 16:27:19 +03:00
|
|
|
Streams []string // list of streams and ids, e.g. stream1 stream2 id1 id2
|
|
|
|
Count int64
|
|
|
|
Block time.Duration
|
|
|
|
NoAck bool
|
2018-08-02 14:48:46 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XReadGroup(ctx context.Context, a *XReadGroupArgs) *XStreamSliceCmd {
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
args := make([]interface{}, 0, 10+len(a.Streams))
|
2018-08-02 14:48:46 +03:00
|
|
|
args = append(args, "xreadgroup", "group", a.Group, a.Consumer)
|
2020-09-23 10:22:11 +03:00
|
|
|
|
2021-05-27 06:24:24 +03:00
|
|
|
keyPos := int8(4)
|
2018-08-02 14:48:46 +03:00
|
|
|
if a.Count > 0 {
|
|
|
|
args = append(args, "count", a.Count)
|
2020-09-23 10:29:13 +03:00
|
|
|
keyPos += 2
|
2018-08-02 14:48:46 +03:00
|
|
|
}
|
|
|
|
if a.Block >= 0 {
|
|
|
|
args = append(args, "block", int64(a.Block/time.Millisecond))
|
2020-09-23 10:29:13 +03:00
|
|
|
keyPos += 2
|
2018-08-02 14:48:46 +03:00
|
|
|
}
|
2018-11-21 12:09:21 +03:00
|
|
|
if a.NoAck {
|
|
|
|
args = append(args, "noack")
|
2020-09-23 11:00:34 +03:00
|
|
|
keyPos++
|
2018-11-21 12:09:21 +03:00
|
|
|
}
|
2018-08-02 14:48:46 +03:00
|
|
|
args = append(args, "streams")
|
2020-09-23 11:00:34 +03:00
|
|
|
keyPos++
|
2018-08-02 14:48:46 +03:00
|
|
|
for _, s := range a.Streams {
|
|
|
|
args = append(args, s)
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewXStreamSliceCmd(ctx, args...)
|
2018-09-13 09:14:52 +03:00
|
|
|
if a.Block >= 0 {
|
|
|
|
cmd.setReadTimeout(a.Block)
|
|
|
|
}
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(keyPos)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XAck(ctx context.Context, stream, group string, ids ...string) *IntCmd {
|
2018-08-02 14:48:46 +03:00
|
|
|
args := []interface{}{"xack", stream, group}
|
|
|
|
for _, id := range ids {
|
|
|
|
args = append(args, id)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XPending(ctx context.Context, stream, group string) *XPendingCmd {
|
|
|
|
cmd := NewXPendingCmd(ctx, "xpending", stream, group)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
type XPendingExtArgs struct {
|
|
|
|
Stream string
|
|
|
|
Group string
|
2021-05-19 12:43:31 +03:00
|
|
|
Idle time.Duration
|
2018-08-02 14:48:46 +03:00
|
|
|
Start string
|
|
|
|
End string
|
|
|
|
Count int64
|
|
|
|
Consumer string
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XPendingExt(ctx context.Context, a *XPendingExtArgs) *XPendingExtCmd {
|
2021-05-19 12:43:31 +03:00
|
|
|
args := make([]interface{}, 0, 9)
|
|
|
|
args = append(args, "xpending", a.Stream, a.Group)
|
|
|
|
if a.Idle != 0 {
|
|
|
|
args = append(args, "idle", formatMs(ctx, a.Idle))
|
|
|
|
}
|
|
|
|
args = append(args, a.Start, a.End, a.Count)
|
2018-08-02 14:48:46 +03:00
|
|
|
if a.Consumer != "" {
|
|
|
|
args = append(args, a.Consumer)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewXPendingExtCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
type XAutoClaimArgs struct {
|
|
|
|
Stream string
|
|
|
|
Group string
|
|
|
|
MinIdle time.Duration
|
|
|
|
Start string
|
|
|
|
Count int64
|
|
|
|
Consumer string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) XAutoClaim(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimCmd {
|
|
|
|
args := xAutoClaimArgs(ctx, a)
|
|
|
|
cmd := NewXAutoClaimCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) XAutoClaimJustID(ctx context.Context, a *XAutoClaimArgs) *XAutoClaimJustIDCmd {
|
|
|
|
args := xAutoClaimArgs(ctx, a)
|
|
|
|
args = append(args, "justid")
|
|
|
|
cmd := NewXAutoClaimJustIDCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func xAutoClaimArgs(ctx context.Context, a *XAutoClaimArgs) []interface{} {
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
args := make([]interface{}, 0, 8)
|
2021-06-28 12:40:38 +03:00
|
|
|
args = append(args, "xautoclaim", a.Stream, a.Group, a.Consumer, formatMs(ctx, a.MinIdle), a.Start)
|
|
|
|
if a.Count > 0 {
|
|
|
|
args = append(args, "count", a.Count)
|
|
|
|
}
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
2018-08-02 14:48:46 +03:00
|
|
|
type XClaimArgs struct {
|
|
|
|
Stream string
|
|
|
|
Group string
|
|
|
|
Consumer string
|
|
|
|
MinIdle time.Duration
|
|
|
|
Messages []string
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XClaim(ctx context.Context, a *XClaimArgs) *XMessageSliceCmd {
|
2018-08-02 14:48:46 +03:00
|
|
|
args := xClaimArgs(a)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewXMessageSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XClaimJustID(ctx context.Context, a *XClaimArgs) *StringSliceCmd {
|
2018-08-02 14:48:46 +03:00
|
|
|
args := xClaimArgs(a)
|
|
|
|
args = append(args, "justid")
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func xClaimArgs(a *XClaimArgs) []interface{} {
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
args := make([]interface{}, 0, 5+len(a.Messages))
|
2018-08-02 14:48:46 +03:00
|
|
|
args = append(args,
|
|
|
|
"xclaim",
|
|
|
|
a.Stream,
|
|
|
|
a.Group, a.Consumer,
|
|
|
|
int64(a.MinIdle/time.Millisecond))
|
|
|
|
for _, id := range a.Messages {
|
|
|
|
args = append(args, id)
|
|
|
|
}
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// xTrim If approx is true, add the "~" parameter, otherwise it is the default "=" (redis default).
|
|
|
|
// example:
|
|
|
|
// XTRIM key MAXLEN/MINID threshold LIMIT limit.
|
|
|
|
// XTRIM key MAXLEN/MINID ~ threshold LIMIT limit.
|
|
|
|
// The redis-server version is lower than 6.2, please set limit to 0.
|
|
|
|
func (c cmdable) xTrim(
|
|
|
|
ctx context.Context, key, strategy string,
|
|
|
|
approx bool, threshold interface{}, limit int64,
|
|
|
|
) *IntCmd {
|
|
|
|
args := make([]interface{}, 0, 7)
|
|
|
|
args = append(args, "xtrim", key, strategy)
|
|
|
|
if approx {
|
|
|
|
args = append(args, "~")
|
|
|
|
}
|
|
|
|
args = append(args, threshold)
|
|
|
|
if limit > 0 {
|
|
|
|
args = append(args, "limit", limit)
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2018-08-02 14:48:46 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// XTrimMaxLen No `~` rules are used, `limit` cannot be used.
|
|
|
|
// cmd: XTRIM key MAXLEN maxLen
|
|
|
|
func (c cmdable) XTrimMaxLen(ctx context.Context, key string, maxLen int64) *IntCmd {
|
|
|
|
return c.xTrim(ctx, key, "maxlen", false, maxLen, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
// XTrimMaxLenApprox LIMIT has a bug, please confirm it and use it.
|
|
|
|
// issue: https://github.com/redis/redis/issues/9046
|
|
|
|
// cmd: XTRIM key MAXLEN ~ maxLen LIMIT limit
|
|
|
|
func (c cmdable) XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limit int64) *IntCmd {
|
|
|
|
return c.xTrim(ctx, key, "maxlen", true, maxLen, limit)
|
|
|
|
}
|
|
|
|
|
|
|
|
// XTrimMinID No `~` rules are used, `limit` cannot be used.
|
|
|
|
// cmd: XTRIM key MINID minID
|
|
|
|
func (c cmdable) XTrimMinID(ctx context.Context, key string, minID string) *IntCmd {
|
|
|
|
return c.xTrim(ctx, key, "minid", false, minID, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
// XTrimMinIDApprox LIMIT has a bug, please confirm it and use it.
|
|
|
|
// issue: https://github.com/redis/redis/issues/9046
|
|
|
|
// cmd: XTRIM key MINID ~ minID LIMIT limit
|
|
|
|
func (c cmdable) XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *IntCmd {
|
|
|
|
return c.xTrim(ctx, key, "minid", true, minID, limit)
|
2017-11-25 05:06:13 +03:00
|
|
|
}
|
|
|
|
|
2021-02-09 15:46:26 +03:00
|
|
|
func (c cmdable) XInfoConsumers(ctx context.Context, key string, group string) *XInfoConsumersCmd {
|
|
|
|
cmd := NewXInfoConsumersCmd(ctx, key, group)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) XInfoGroups(ctx context.Context, key string) *XInfoGroupsCmd {
|
|
|
|
cmd := NewXInfoGroupsCmd(ctx, key)
|
|
|
|
_ = c(ctx, cmd)
|
2019-10-08 12:48:24 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-09-22 20:45:23 +03:00
|
|
|
func (c cmdable) XInfoStream(ctx context.Context, key string) *XInfoStreamCmd {
|
|
|
|
cmd := NewXInfoStreamCmd(ctx, key)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-05-19 12:43:31 +03:00
|
|
|
// XInfoStreamFull XINFO STREAM FULL [COUNT count]
|
|
|
|
// redis-server >= 6.0.
|
|
|
|
func (c cmdable) XInfoStreamFull(ctx context.Context, key string, count int) *XInfoStreamFullCmd {
|
|
|
|
args := make([]interface{}, 0, 6)
|
|
|
|
args = append(args, "xinfo", "stream", key, "full")
|
|
|
|
if count > 0 {
|
|
|
|
args = append(args, "count", count)
|
|
|
|
}
|
|
|
|
cmd := NewXInfoStreamFullCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2017-11-25 05:06:13 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2015-12-01 17:28:41 +03:00
|
|
|
// Z represents sorted set member.
|
2012-08-17 22:36:48 +04:00
|
|
|
type Z struct {
|
2012-07-27 18:21:50 +04:00
|
|
|
Score float64
|
2015-07-16 17:30:16 +03:00
|
|
|
Member interface{}
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2018-10-31 16:35:23 +03:00
|
|
|
// ZWithKey represents sorted set member including the name of the key where it was popped.
|
|
|
|
type ZWithKey struct {
|
2018-11-03 13:07:25 +03:00
|
|
|
Z
|
|
|
|
Key string
|
2018-10-31 16:35:23 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZStore is used as an arg to ZInter/ZInterStore and ZUnion/ZUnionStore.
|
2012-08-17 22:36:48 +04:00
|
|
|
type ZStore struct {
|
2019-08-09 16:23:56 +03:00
|
|
|
Keys []string
|
2015-12-01 17:28:41 +03:00
|
|
|
Weights []float64
|
2015-07-16 17:30:16 +03:00
|
|
|
// Can be SUM, MIN or MAX.
|
2012-08-17 22:36:48 +04:00
|
|
|
Aggregate string
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (z ZStore) len() (n int) {
|
2021-05-29 16:11:47 +03:00
|
|
|
n = len(z.Keys)
|
|
|
|
if len(z.Weights) > 0 {
|
|
|
|
n += 1 + len(z.Weights)
|
|
|
|
}
|
|
|
|
if z.Aggregate != "" {
|
|
|
|
n += 2
|
|
|
|
}
|
|
|
|
return n
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (z ZStore) appendArgs(args []interface{}) []interface{} {
|
|
|
|
for _, key := range z.Keys {
|
|
|
|
args = append(args, key)
|
|
|
|
}
|
|
|
|
if len(z.Weights) > 0 {
|
|
|
|
args = append(args, "weights")
|
|
|
|
for _, weights := range z.Weights {
|
|
|
|
args = append(args, weights)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if z.Aggregate != "" {
|
|
|
|
args = append(args, "aggregate", z.Aggregate)
|
|
|
|
}
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// BZPopMax Redis `BZPOPMAX key [key ...] timeout` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd {
|
2018-10-31 16:35:23 +03:00
|
|
|
args := make([]interface{}, 1+len(keys)+1)
|
|
|
|
args[0] = "bzpopmax"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-07-18 09:04:36 +03:00
|
|
|
args[len(args)-1] = formatSec(ctx, timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZWithKeyCmd(ctx, args...)
|
2018-10-31 16:35:23 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2018-10-31 16:35:23 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// BZPopMin Redis `BZPOPMIN key [key ...] timeout` command.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *ZWithKeyCmd {
|
2018-10-31 16:35:23 +03:00
|
|
|
args := make([]interface{}, 1+len(keys)+1)
|
|
|
|
args[0] = "bzpopmin"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-07-18 09:04:36 +03:00
|
|
|
args[len(args)-1] = formatSec(ctx, timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZWithKeyCmd(ctx, args...)
|
2018-10-31 16:35:23 +03:00
|
|
|
cmd.setReadTimeout(timeout)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2018-10-31 16:35:23 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZAddArgs WARN: The GT, LT and NX options are mutually exclusive.
|
|
|
|
type ZAddArgs struct {
|
|
|
|
NX bool
|
|
|
|
XX bool
|
|
|
|
LT bool
|
|
|
|
GT bool
|
|
|
|
Ch bool
|
|
|
|
Members []Z
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) zAddArgs(key string, args ZAddArgs, incr bool) []interface{} {
|
|
|
|
a := make([]interface{}, 0, 6+2*len(args.Members))
|
|
|
|
a = append(a, "zadd", key)
|
2015-08-29 13:08:27 +03:00
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// The GT, LT and NX options are mutually exclusive.
|
|
|
|
if args.NX {
|
|
|
|
a = append(a, "nx")
|
|
|
|
} else {
|
|
|
|
if args.XX {
|
|
|
|
a = append(a, "xx")
|
|
|
|
}
|
|
|
|
if args.GT {
|
|
|
|
a = append(a, "gt")
|
|
|
|
} else if args.LT {
|
|
|
|
a = append(a, "lt")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if args.Ch {
|
|
|
|
a = append(a, "ch")
|
|
|
|
}
|
|
|
|
if incr {
|
|
|
|
a = append(a, "incr")
|
|
|
|
}
|
|
|
|
for _, m := range args.Members {
|
|
|
|
a = append(a, m.Score)
|
|
|
|
a = append(a, m.Member)
|
|
|
|
}
|
|
|
|
return a
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) ZAddArgs(ctx context.Context, key string, args ZAddArgs) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, c.zAddArgs(key, args, false)...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) ZAddArgsIncr(ctx context.Context, key string, args ZAddArgs) *FloatCmd {
|
|
|
|
cmd := NewFloatCmd(ctx, c.zAddArgs(key, args, true)...)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZAdd Redis `ZADD key score member [score member ...]` command.
|
|
|
|
func (c cmdable) ZAdd(ctx context.Context, key string, members ...Z) *IntCmd {
|
|
|
|
return c.ZAddArgs(ctx, key, ZAddArgs{
|
|
|
|
Members: members,
|
|
|
|
})
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZAddNX Redis `ZADD key NX score member [score member ...]` command.
|
|
|
|
func (c cmdable) ZAddNX(ctx context.Context, key string, members ...Z) *IntCmd {
|
|
|
|
return c.ZAddArgs(ctx, key, ZAddArgs{
|
|
|
|
NX: true,
|
|
|
|
Members: members,
|
|
|
|
})
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZAddXX Redis `ZADD key XX score member [score member ...]` command.
|
|
|
|
func (c cmdable) ZAddXX(ctx context.Context, key string, members ...Z) *IntCmd {
|
|
|
|
return c.ZAddArgs(ctx, key, ZAddArgs{
|
|
|
|
XX: true,
|
|
|
|
Members: members,
|
|
|
|
})
|
2015-08-29 13:08:27 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZCard(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zcard", key)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZCount(ctx context.Context, key, min, max string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zcount", key, min, max)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZLexCount(ctx context.Context, key, min, max string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zlexcount", key, min, max)
|
|
|
|
_ = c(ctx, cmd)
|
2017-08-15 09:49:23 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZIncrBy(ctx context.Context, key string, increment float64, member string) *FloatCmd {
|
|
|
|
cmd := NewFloatCmd(ctx, "zincrby", key, increment, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZInterStore(ctx context.Context, destination string, store *ZStore) *IntCmd {
|
2021-05-29 16:11:47 +03:00
|
|
|
args := make([]interface{}, 0, 3+store.len())
|
2021-03-23 11:55:14 +03:00
|
|
|
args = append(args, "zinterstore", destination, len(store.Keys))
|
2021-06-28 12:40:38 +03:00
|
|
|
args = store.appendArgs(args)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(3)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2021-05-29 16:11:47 +03:00
|
|
|
func (c cmdable) ZInter(ctx context.Context, store *ZStore) *StringSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 2+store.len())
|
|
|
|
args = append(args, "zinter", len(store.Keys))
|
2021-06-28 12:40:38 +03:00
|
|
|
args = store.appendArgs(args)
|
2021-05-29 16:11:47 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-05-29 16:11:47 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 3+store.len())
|
|
|
|
args = append(args, "zinter", len(store.Keys))
|
2021-06-28 12:40:38 +03:00
|
|
|
args = store.appendArgs(args)
|
2021-05-29 16:11:47 +03:00
|
|
|
args = append(args, "withscores")
|
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-05-29 16:11:47 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-03-05 21:02:53 +03:00
|
|
|
func (c cmdable) ZMScore(ctx context.Context, key string, members ...string) *FloatSliceCmd {
|
|
|
|
args := make([]interface{}, 2+len(members))
|
|
|
|
args[0] = "zmscore"
|
|
|
|
args[1] = key
|
|
|
|
for i, member := range members {
|
|
|
|
args[2+i] = member
|
|
|
|
}
|
|
|
|
cmd := NewFloatSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZPopMax(ctx context.Context, key string, count ...int64) *ZSliceCmd {
|
2018-09-03 11:45:32 +03:00
|
|
|
args := []interface{}{
|
|
|
|
"zpopmax",
|
|
|
|
key,
|
|
|
|
}
|
|
|
|
|
|
|
|
switch len(count) {
|
|
|
|
case 0:
|
|
|
|
break
|
|
|
|
case 1:
|
|
|
|
args = append(args, count[0])
|
|
|
|
default:
|
|
|
|
panic("too many arguments")
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-09-03 11:45:32 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZPopMin(ctx context.Context, key string, count ...int64) *ZSliceCmd {
|
2018-09-03 11:45:32 +03:00
|
|
|
args := []interface{}{
|
|
|
|
"zpopmin",
|
|
|
|
key,
|
|
|
|
}
|
|
|
|
|
|
|
|
switch len(count) {
|
|
|
|
case 0:
|
|
|
|
break
|
|
|
|
case 1:
|
|
|
|
args = append(args, count[0])
|
|
|
|
default:
|
|
|
|
panic("too many arguments")
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2018-09-03 11:45:32 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
// ZRangeArgs is all the options of the ZRange command.
|
|
|
|
// In version> 6.2.0, you can replace the(cmd):
|
|
|
|
// ZREVRANGE,
|
|
|
|
// ZRANGEBYSCORE,
|
|
|
|
// ZREVRANGEBYSCORE,
|
|
|
|
// ZRANGEBYLEX,
|
|
|
|
// ZREVRANGEBYLEX.
|
|
|
|
// Please pay attention to your redis-server version.
|
|
|
|
//
|
|
|
|
// Rev, ByScore, ByLex and Offset+Count options require redis-server 6.2.0 and higher.
|
|
|
|
type ZRangeArgs struct {
|
|
|
|
Key string
|
|
|
|
|
|
|
|
// When the ByScore option is provided, the open interval(exclusive) can be set.
|
|
|
|
// By default, the score intervals specified by <Start> and <Stop> are closed (inclusive).
|
|
|
|
// It is similar to the deprecated(6.2.0+) ZRangeByScore command.
|
|
|
|
// For example:
|
|
|
|
// ZRangeArgs{
|
|
|
|
// Key: "example-key",
|
|
|
|
// Start: "(3",
|
|
|
|
// Stop: 8,
|
|
|
|
// ByScore: true,
|
|
|
|
// }
|
|
|
|
// cmd: "ZRange example-key (3 8 ByScore" (3 < score <= 8).
|
|
|
|
//
|
|
|
|
// For the ByLex option, it is similar to the deprecated(6.2.0+) ZRangeByLex command.
|
|
|
|
// You can set the <Start> and <Stop> options as follows:
|
|
|
|
// ZRangeArgs{
|
|
|
|
// Key: "example-key",
|
|
|
|
// Start: "[abc",
|
|
|
|
// Stop: "(def",
|
|
|
|
// ByLex: true,
|
|
|
|
// }
|
|
|
|
// cmd: "ZRange example-key [abc (def ByLex"
|
|
|
|
//
|
|
|
|
// For normal cases (ByScore==false && ByLex==false), <Start> and <Stop> should be set to the index range (int).
|
|
|
|
// You can read the documentation for more information: https://redis.io/commands/zrange
|
|
|
|
Start interface{}
|
|
|
|
Stop interface{}
|
|
|
|
|
|
|
|
// The ByScore and ByLex options are mutually exclusive.
|
|
|
|
ByScore bool
|
|
|
|
ByLex bool
|
|
|
|
|
|
|
|
Rev bool
|
|
|
|
|
|
|
|
// limit offset count.
|
|
|
|
Offset int64
|
|
|
|
Count int64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (z ZRangeArgs) appendArgs(args []interface{}) []interface{} {
|
|
|
|
// For Rev+ByScore/ByLex, we need to adjust the position of <Start> and <Stop>.
|
|
|
|
if z.Rev && (z.ByScore || z.ByLex) {
|
|
|
|
args = append(args, z.Key, z.Stop, z.Start)
|
|
|
|
} else {
|
|
|
|
args = append(args, z.Key, z.Start, z.Stop)
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
2021-06-28 12:40:38 +03:00
|
|
|
|
|
|
|
if z.ByScore {
|
|
|
|
args = append(args, "byscore")
|
|
|
|
} else if z.ByLex {
|
|
|
|
args = append(args, "bylex")
|
|
|
|
}
|
|
|
|
if z.Rev {
|
|
|
|
args = append(args, "rev")
|
|
|
|
}
|
|
|
|
if z.Offset != 0 || z.Count != 0 {
|
|
|
|
args = append(args, "limit", z.Offset, z.Count)
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
2021-06-28 12:40:38 +03:00
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ZRangeArgs(ctx context.Context, z ZRangeArgs) *StringSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 9)
|
|
|
|
args = append(args, "zrange")
|
|
|
|
args = z.appendArgs(args)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) ZRangeArgsWithScores(ctx context.Context, z ZRangeArgs) *ZSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 10)
|
|
|
|
args = append(args, "zrange")
|
|
|
|
args = z.appendArgs(args)
|
|
|
|
args = append(args, "withscores")
|
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd {
|
2021-06-28 12:40:38 +03:00
|
|
|
return c.ZRangeArgs(ctx, ZRangeArgs{
|
|
|
|
Key: key,
|
|
|
|
Start: start,
|
|
|
|
Stop: stop,
|
|
|
|
})
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd {
|
2021-06-28 12:40:38 +03:00
|
|
|
return c.ZRangeArgsWithScores(ctx, ZRangeArgs{
|
|
|
|
Key: key,
|
|
|
|
Start: start,
|
|
|
|
Stop: stop,
|
|
|
|
})
|
2013-02-02 16:17:01 +04:00
|
|
|
}
|
|
|
|
|
2016-04-09 13:15:33 +03:00
|
|
|
type ZRangeBy struct {
|
2015-03-30 16:14:21 +03:00
|
|
|
Min, Max string
|
2014-05-11 11:42:40 +04:00
|
|
|
Offset, Count int64
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) zRangeBy(ctx context.Context, zcmd, key string, opt *ZRangeBy, withScores bool) *StringSliceCmd {
|
2015-08-25 22:15:01 +03:00
|
|
|
args := []interface{}{zcmd, key, opt.Min, opt.Max}
|
2012-07-27 18:21:50 +04:00
|
|
|
if withScores {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = append(args, "withscores")
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
2014-05-11 11:42:40 +04:00
|
|
|
if opt.Offset != 0 || opt.Count != 0 {
|
2012-07-27 18:21:50 +04:00
|
|
|
args = append(
|
|
|
|
args,
|
2016-05-06 21:12:31 +03:00
|
|
|
"limit",
|
2015-10-07 18:21:18 +03:00
|
|
|
opt.Offset,
|
|
|
|
opt.Count,
|
2012-07-27 18:21:50 +04:00
|
|
|
)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd {
|
|
|
|
return c.zRangeBy(ctx, "zrangebyscore", key, opt, false)
|
2015-08-23 06:38:37 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd {
|
|
|
|
return c.zRangeBy(ctx, "zrangebylex", key, opt, false)
|
2012-08-17 22:36:48 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := []interface{}{"zrangebyscore", key, opt.Min, opt.Max, "withscores"}
|
2014-05-11 11:42:40 +04:00
|
|
|
if opt.Offset != 0 || opt.Count != 0 {
|
2013-02-02 16:17:01 +04:00
|
|
|
args = append(
|
|
|
|
args,
|
2016-05-06 21:12:31 +03:00
|
|
|
"limit",
|
2015-10-07 18:21:18 +03:00
|
|
|
opt.Offset,
|
|
|
|
opt.Count,
|
2013-02-02 16:17:01 +04:00
|
|
|
)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2013-02-02 16:17:01 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) ZRangeStore(ctx context.Context, dst string, z ZRangeArgs) *IntCmd {
|
|
|
|
args := make([]interface{}, 0, 10)
|
|
|
|
args = append(args, "zrangestore", dst)
|
|
|
|
args = z.appendArgs(args)
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRank(ctx context.Context, key, member string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zrank", key, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRem(ctx context.Context, key string, members ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(members))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "zrem"
|
2015-05-28 15:51:19 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, members)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) *IntCmd {
|
2014-06-25 11:40:56 +04:00
|
|
|
cmd := NewIntCmd(
|
2020-03-11 17:26:42 +03:00
|
|
|
ctx,
|
2016-05-06 21:12:31 +03:00
|
|
|
"zremrangebyrank",
|
2012-07-27 18:21:50 +04:00
|
|
|
key,
|
2015-10-07 18:21:18 +03:00
|
|
|
start,
|
|
|
|
stop,
|
2012-07-27 18:21:50 +04:00
|
|
|
)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRemRangeByScore(ctx context.Context, key, min, max string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zremrangebyscore", key, min, max)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRemRangeByLex(ctx context.Context, key, min, max string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zremrangebylex", key, min, max)
|
|
|
|
_ = c(ctx, cmd)
|
2017-01-26 16:51:34 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRange(ctx context.Context, key string, start, stop int64) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "zrevrange", key, start, stop)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) *ZSliceCmd {
|
|
|
|
cmd := NewZSliceCmd(ctx, "zrevrange", key, start, stop, "withscores")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2013-02-02 16:17:01 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) zRevRangeBy(ctx context.Context, zcmd, key string, opt *ZRangeBy) *StringSliceCmd {
|
2015-08-25 22:15:01 +03:00
|
|
|
args := []interface{}{zcmd, key, opt.Max, opt.Min}
|
2014-05-11 11:42:40 +04:00
|
|
|
if opt.Offset != 0 || opt.Count != 0 {
|
2012-07-27 18:21:50 +04:00
|
|
|
args = append(
|
|
|
|
args,
|
2016-05-06 21:12:31 +03:00
|
|
|
"limit",
|
2015-10-07 18:21:18 +03:00
|
|
|
opt.Offset,
|
|
|
|
opt.Count,
|
2012-07-27 18:21:50 +04:00
|
|
|
)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRangeByScore(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd {
|
|
|
|
return c.zRevRangeBy(ctx, "zrevrangebyscore", key, opt)
|
2015-08-25 22:15:01 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRangeByLex(ctx context.Context, key string, opt *ZRangeBy) *StringSliceCmd {
|
|
|
|
return c.zRevRangeBy(ctx, "zrevrangebylex", key, opt)
|
2015-08-25 22:15:01 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRangeByScoreWithScores(ctx context.Context, key string, opt *ZRangeBy) *ZSliceCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := []interface{}{"zrevrangebyscore", key, opt.Max, opt.Min, "withscores"}
|
2014-05-11 11:42:40 +04:00
|
|
|
if opt.Offset != 0 || opt.Count != 0 {
|
2013-02-02 16:17:01 +04:00
|
|
|
args = append(
|
|
|
|
args,
|
2016-05-06 21:12:31 +03:00
|
|
|
"limit",
|
2015-10-07 18:21:18 +03:00
|
|
|
opt.Offset,
|
|
|
|
opt.Count,
|
2013-02-02 16:17:01 +04:00
|
|
|
)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2013-02-02 16:17:01 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZRevRank(ctx context.Context, key, member string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "zrevrank", key, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZScore(ctx context.Context, key, member string) *FloatCmd {
|
|
|
|
cmd := NewFloatCmd(ctx, "zscore", key, member)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
|
|
|
|
2021-06-28 12:40:38 +03:00
|
|
|
func (c cmdable) ZUnion(ctx context.Context, store ZStore) *StringSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 2+store.len())
|
|
|
|
args = append(args, "zunion", len(store.Keys))
|
|
|
|
args = store.appendArgs(args)
|
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-06-28 12:40:38 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ZUnionWithScores(ctx context.Context, store ZStore) *ZSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 3+store.len())
|
|
|
|
args = append(args, "zunion", len(store.Keys))
|
|
|
|
args = store.appendArgs(args)
|
|
|
|
args = append(args, "withscores")
|
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-06-28 12:40:38 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ZUnionStore(ctx context.Context, dest string, store *ZStore) *IntCmd {
|
2021-05-29 16:11:47 +03:00
|
|
|
args := make([]interface{}, 0, 3+store.len())
|
2021-03-23 11:55:14 +03:00
|
|
|
args = append(args, "zunionstore", dest, len(store.Keys))
|
2021-06-28 12:40:38 +03:00
|
|
|
args = store.appendArgs(args)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(3)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-07-27 18:21:50 +04:00
|
|
|
}
|
2012-08-12 22:41:44 +04:00
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
// ZRandMember redis-server version >= 6.2.0.
|
|
|
|
func (c cmdable) ZRandMember(ctx context.Context, key string, count int) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "zrandmember", key, count)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
2021-03-27 05:37:44 +03:00
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
// ZRandMemberWithScores redis-server version >= 6.2.0.
|
|
|
|
func (c cmdable) ZRandMemberWithScores(ctx context.Context, key string, count int) *ZSliceCmd {
|
|
|
|
cmd := NewZSliceCmd(ctx, "zrandmember", key, count, "withscores")
|
2021-03-27 05:37:44 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// ZDiff redis-server version >= 6.2.0.
|
2021-05-23 11:55:03 +03:00
|
|
|
func (c cmdable) ZDiff(ctx context.Context, keys ...string) *StringSliceCmd {
|
|
|
|
args := make([]interface{}, 2+len(keys))
|
|
|
|
args[0] = "zdiff"
|
|
|
|
args[1] = len(keys)
|
|
|
|
for i, key := range keys {
|
|
|
|
args[i+2] = key
|
|
|
|
}
|
|
|
|
|
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-05-23 11:55:03 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// ZDiffWithScores redis-server version >= 6.2.0.
|
2021-05-23 11:55:03 +03:00
|
|
|
func (c cmdable) ZDiffWithScores(ctx context.Context, keys ...string) *ZSliceCmd {
|
|
|
|
args := make([]interface{}, 3+len(keys))
|
|
|
|
args[0] = "zdiff"
|
|
|
|
args[1] = len(keys)
|
|
|
|
for i, key := range keys {
|
|
|
|
args[i+2] = key
|
|
|
|
}
|
|
|
|
args[len(keys)+2] = "withscores"
|
|
|
|
|
|
|
|
cmd := NewZSliceCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2021-05-23 11:55:03 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// ZDiffStore redis-server version >=6.2.0.
|
2021-06-01 05:02:09 +03:00
|
|
|
func (c cmdable) ZDiffStore(ctx context.Context, destination string, keys ...string) *IntCmd {
|
|
|
|
args := make([]interface{}, 0, 3+len(keys))
|
|
|
|
args = append(args, "zdiffstore", destination, len(keys))
|
|
|
|
for _, key := range keys {
|
|
|
|
args = append(args, key)
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2012-08-12 22:41:44 +04:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PFAdd(ctx context.Context, key string, els ...interface{}) *IntCmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
args := make([]interface{}, 2, 2+len(els))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "pfadd"
|
2015-11-04 10:34:58 +03:00
|
|
|
args[1] = key
|
2018-03-08 15:30:27 +03:00
|
|
|
args = appendArgs(args, els)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-11-04 10:34:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PFCount(ctx context.Context, keys ...string) *IntCmd {
|
2015-12-24 01:24:42 +03:00
|
|
|
args := make([]interface{}, 1+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "pfcount"
|
2015-12-24 01:24:42 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
args[1+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-11-04 10:34:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PFMerge(ctx context.Context, dest string, keys ...string) *StatusCmd {
|
2015-11-04 10:34:58 +03:00
|
|
|
args := make([]interface{}, 2+len(keys))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "pfmerge"
|
2015-11-04 10:34:58 +03:00
|
|
|
args[1] = dest
|
|
|
|
for i, key := range keys {
|
|
|
|
args[2+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-11-04 10:34:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BgRewriteAOF(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "bgrewriteaof")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) BgSave(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "bgsave")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientKill(ctx context.Context, ipPort string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "client", "kill", ipPort)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
// ClientKillByFilter is new style syntax, while the ClientKill is old
|
2020-07-16 10:01:27 +03:00
|
|
|
//
|
|
|
|
// CLIENT KILL <option> [value] ... <option> [value]
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd {
|
2018-07-23 14:12:20 +03:00
|
|
|
args := make([]interface{}, 2+len(keys))
|
|
|
|
args[0] = "client"
|
|
|
|
args[1] = "kill"
|
|
|
|
for i, key := range keys {
|
|
|
|
args[2+i] = key
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-05-15 15:11:22 +03:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientList(ctx context.Context) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "client", "list")
|
|
|
|
_ = c(ctx, cmd)
|
2018-12-11 13:43:54 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientPause(ctx context.Context, dur time.Duration) *BoolCmd {
|
2020-07-18 09:04:36 +03:00
|
|
|
cmd := NewBoolCmd(ctx, "client", "pause", formatMs(ctx, dur))
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2018-12-14 17:46:15 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2022-06-04 15:02:53 +03:00
|
|
|
func (c cmdable) ClientUnpause(ctx context.Context) *BoolCmd {
|
|
|
|
cmd := NewBoolCmd(ctx, "client", "unpause")
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientID(ctx context.Context) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "client", "id")
|
|
|
|
_ = c(ctx, cmd)
|
2018-12-11 23:26:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientUnblock(ctx context.Context, id int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "client", "unblock", id)
|
|
|
|
_ = c(ctx, cmd)
|
2015-10-20 22:21:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClientUnblockWithError(ctx context.Context, id int64) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "client", "unblock", id, "error")
|
|
|
|
_ = c(ctx, cmd)
|
2015-10-20 22:21:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) ConfigGet(ctx context.Context, parameter string) *MapStringStringCmd {
|
|
|
|
cmd := NewMapStringStringCmd(ctx, "config", "get", parameter)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ConfigResetStat(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "config", "resetstat")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ConfigSet(ctx context.Context, parameter, value string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "config", "set", parameter, value)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ConfigRewrite(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "config", "rewrite")
|
|
|
|
_ = c(ctx, cmd)
|
2018-03-01 11:37:51 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) DBSize(ctx context.Context) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "dbsize")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) FlushAll(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "flushall")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) FlushAllAsync(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "flushall", "async")
|
|
|
|
_ = c(ctx, cmd)
|
2017-06-17 12:53:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) FlushDB(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "flushdb")
|
|
|
|
_ = c(ctx, cmd)
|
2017-06-17 12:53:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) FlushDBAsync(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "flushdb", "async")
|
|
|
|
_ = c(ctx, cmd)
|
2017-06-17 12:53:16 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Info(ctx context.Context, section ...string) *StringCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := []interface{}{"info"}
|
2016-01-08 16:03:34 +03:00
|
|
|
if len(section) > 0 {
|
|
|
|
args = append(args, section[0])
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) LastSave(ctx context.Context) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "lastsave")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Save(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "save")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) shutdown(ctx context.Context, modifier string) *StatusCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
var args []interface{}
|
2012-08-25 16:35:39 +04:00
|
|
|
if modifier == "" {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = []interface{}{"shutdown"}
|
2012-08-25 16:35:39 +04:00
|
|
|
} else {
|
2016-05-06 21:12:31 +03:00
|
|
|
args = []interface{}{"shutdown", modifier}
|
2012-08-25 16:35:39 +04:00
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-11-13 15:26:14 +03:00
|
|
|
if err := cmd.Err(); err != nil {
|
|
|
|
if err == io.EOF {
|
|
|
|
// Server quit as expected.
|
|
|
|
cmd.err = nil
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Server did not quit. String reply contains the reason.
|
2018-02-22 15:14:30 +03:00
|
|
|
cmd.err = errors.New(cmd.val)
|
2014-11-13 15:26:14 +03:00
|
|
|
cmd.val = ""
|
|
|
|
}
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-25 16:35:39 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Shutdown(ctx context.Context) *StatusCmd {
|
|
|
|
return c.shutdown(ctx, "")
|
2012-08-25 16:35:39 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ShutdownSave(ctx context.Context) *StatusCmd {
|
|
|
|
return c.shutdown(ctx, "save")
|
2012-08-25 16:35:39 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ShutdownNoSave(ctx context.Context) *StatusCmd {
|
|
|
|
return c.shutdown(ctx, "nosave")
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) SlaveOf(ctx context.Context, host, port string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "slaveof", host, port)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2020-09-09 17:42:05 +03:00
|
|
|
func (c cmdable) SlowLogGet(ctx context.Context, num int64) *SlowLogCmd {
|
2020-09-11 09:32:39 +03:00
|
|
|
cmd := NewSlowLogCmd(context.Background(), "slowlog", "get", num)
|
2020-06-11 10:24:04 +03:00
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
|
|
|
|
2021-04-27 10:04:46 +03:00
|
|
|
func (c cmdable) Sync(_ context.Context) {
|
2012-08-12 22:41:44 +04:00
|
|
|
panic("not implemented")
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Time(ctx context.Context) *TimeCmd {
|
|
|
|
cmd := NewTimeCmd(ctx, "time")
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) DebugObject(ctx context.Context, key string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "debug", "object", key)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ReadOnly(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "readonly")
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) ReadWrite(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "readwrite")
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) MemoryUsage(ctx context.Context, key string, samples ...int) *IntCmd {
|
|
|
|
args := []interface{}{"memory", "usage", key}
|
|
|
|
if len(samples) > 0 {
|
|
|
|
if len(samples) != 1 {
|
|
|
|
panic("MemoryUsage expects single sample count")
|
|
|
|
}
|
|
|
|
args = append(args, "SAMPLES", samples[0])
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(2)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-12 22:41:44 +04:00
|
|
|
}
|
2012-08-20 14:42:33 +04:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *Cmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
cmdArgs := make([]interface{}, 3+len(keys), 3+len(keys)+len(args))
|
2016-05-06 21:12:31 +03:00
|
|
|
cmdArgs[0] = "eval"
|
2015-05-28 15:51:19 +03:00
|
|
|
cmdArgs[1] = script
|
2017-03-24 13:48:32 +03:00
|
|
|
cmdArgs[2] = len(keys)
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
cmdArgs[3+i] = key
|
|
|
|
}
|
2018-03-08 15:30:27 +03:00
|
|
|
cmdArgs = appendArgs(cmdArgs, args)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewCmd(ctx, cmdArgs...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(3)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) EvalSha(ctx context.Context, sha1 string, keys []string, args ...interface{}) *Cmd {
|
2018-03-08 15:30:27 +03:00
|
|
|
cmdArgs := make([]interface{}, 3+len(keys), 3+len(keys)+len(args))
|
2016-05-06 21:12:31 +03:00
|
|
|
cmdArgs[0] = "evalsha"
|
2015-05-28 15:51:19 +03:00
|
|
|
cmdArgs[1] = sha1
|
2017-03-24 13:48:32 +03:00
|
|
|
cmdArgs[2] = len(keys)
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, key := range keys {
|
|
|
|
cmdArgs[3+i] = key
|
|
|
|
}
|
2018-03-08 15:30:27 +03:00
|
|
|
cmdArgs = appendArgs(cmdArgs, args)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewCmd(ctx, cmdArgs...)
|
chore: sync master (#2051)
* Upgrade redis-server version (#1833)
* Upgrade redis-server version
Signed-off-by: monkey <golang@88.com>
* XAutoClaim changed the return value
Signed-off-by: monkey <golang@88.com>
* add cmd: geosearch, geosearchstore (#1836)
* add cmd: geosearch, geosearchstore
Signed-off-by: monkey92t <golang@88.com>
* GeoSearchQuery and GeoSearchLocationQuery changed to pointer passing
Signed-off-by: monkey92t <golang@88.com>
* Added missing method XInfoStreamFull to Cmdable interface
* Run go mod tidy in redisotel
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
* Revert "ConnPool check fd for bad conns (#1824)" (#1849)
This reverts commit 346bfafddd36dd52d51b064033048de5552ee91e.
* Automate release process (#1852)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0 (#1832)
* Bump github.com/onsi/gomega from 1.10.5 to 1.14.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.10.5 to 1.14.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.10.5...v1.14.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Upgrade gomega to v1.15.0
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: monkey92t <golang@88.com>
* Add version.go
* Fix otel example
* Fix package name in release script
* More fixes for otel example
* And more
* Fix release.sh
* Release v8.11.3 (release.sh)
* Create an annotated tag to give release.yml chance to run
* Tweak tag.sh
* Add Cmd.Slice helper to cast to []interface{} (#1859)
* after the connection pool is closed, no new connections should be added (#1863)
* after the connection pool is closed, no new connections should be added
Signed-off-by: monkey92t <golang@88.com>
* remove runGoroutine
Signed-off-by: monkey92t <golang@88.com>
* pool.popIdle add p.closed check
Signed-off-by: monkey92t <golang@88.com>
* upgrade golangci-lint v1.42.0
Signed-off-by: monkey92t <golang@88.com>
* Bump github.com/onsi/gomega from 1.15.0 to 1.16.0 (#1865)
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.15.0 to 1.16.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.15.0...v1.16.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add go 1.17 to the build matrix
* Remove go 1.15 from build matrix
* Add scan struct example (#1870)
* Replace release job
* Bump github.com/cespare/xxhash/v2 from 2.1.1 to 2.1.2 (#1872)
Bumps [github.com/cespare/xxhash/v2](https://github.com/cespare/xxhash) from 2.1.1 to 2.1.2.
- [Release notes](https://github.com/cespare/xxhash/releases)
- [Commits](https://github.com/cespare/xxhash/compare/v2.1.1...v2.1.2)
---
updated-dependencies:
- dependency-name: github.com/cespare/xxhash/v2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix tag script to push tag by tag
* Fix releasing.md
* Fix/pubsub ping mutex (#1878)
* Fix PubSub.Ping to hold the lock
* Fix PubSub.Ping to hold the lock
* add write cmd data-race test
Signed-off-by: monkey92t <golang@88.com>
Co-authored-by: monkey92t <golang@88.com>
* chore: cleanup OpenTelemetry example
* chore: gofmt all code
* Refactor TestParseURL
This is in preparation for supporting query parameters
in ParseURL:
- use an expected *Options instance to execute assertions on
- extract assertions into helper function
- enable parallel testing
- condense test table
* Add query parameter parsing to ParseURL()
Before this change, ParseURL would only accept a very restricted
set of URLs (it returned an error, if it encountered any parameter).
This commit introduces the ability to process URLs like
redis://localhost/1?dial_timeout=10s
and similar.
Go programs which were providing a configuration tunable (e.g.
CLI flag, config entry or environment variable) to configure
the Redis connection now don't need to perform this task
themselves.
* chore: add links to readme
* chore: fix discussions link
* empty hooks.withContext removed
* chore: gofmt
* chore: use conventional commits and auto-generate changelog
* feat: add acl auth support for sentinels
* chore: swap to acl auth at the test-level
* Add support for BLMove command
* chore: update dependencies
* chore: update link
* feat: add SetVal method for each command
* feat: add Cmd.{String,Int,Float,Bool}Slice helpers and an example
* chore: tweak GH actions to run all jobs
* chore: add Lua scripting example
* Fix Redis Cluster issue during roll outs of new nodes with same addr (#1914)
* fix: recycle connections in some Redis Cluster scenarios
This issue was surfaced in a Cloud Provider solution that used for
rolling out new nodes using the same address (hostname) of the nodes
that will be replaced in a Redis Cluster, while the former ones once
depromoted as Slaves would continue in service during some mintues
for redirecting traffic.
The solution basically identifies when the connection could be stale
since a MOVED response will be returned using the same address (hostname)
that is being used by the connection. At that moment we consider the
connection as no longer usable forcing to recycle the connection.
* chore: lazy reload when moved or ask
* chore: use conv commit message
* chore: release v8.11.4 (release.sh)
* fix: add whitespace for avoid unlikely colisions
* fix: format
* chore: fix links
* chore: use ctx parameter in cmdInfo
* Bump github.com/onsi/ginkgo from 1.16.4 to 1.16.5 (#1925)
Bumps [github.com/onsi/ginkgo](https://github.com/onsi/ginkgo) from 1.16.4 to 1.16.5.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v1.16.4...v1.16.5)
---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add support for time.Duration write and scan
* test: add test case for setting and scanning durations
* chore: fix linter
* fix(extra/redisotel): set span.kind attribute to client
According to the opentelemetry specification this should always be set to client for database client
libraries.
I've also removed the SetAttributes call and instead set the attributes during creation of the span.
This is what the library SHOULD be doing according to the opentelemetry api specification.
* chore: update otel example
* fix: update some argument counts in pre-allocs
In some cases number of pre-allocated places in
argument array is missing 1 or 2 elements,
which results in re-allocation of twice as large array
* chore: add example how to delete keys without a ttl
* chore: don't enable all lints
* chore(deps): bump github.com/onsi/gomega from 1.16.0 to 1.17.0
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.16.0...v1.17.0)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* feat: Add redis v7's NX, XX, GT, LT expire variants
* chore: add missing readme
* chore: tweak feature links
* chore: remove Discord
* fix: set timeout for WAIT command. Fixes #1963
* build: update `go` directive in `go.mod` to 1.17
This commit enables support for module graph pruning and lazy module
loading for projects that are at Go 1.17 or higher.
Reference: https://go.dev/ref/mod#go-mod-file-go
Reference: https://go.dev/ref/mod#graph-pruning
Reference: https://go.dev/ref/mod#lazy-loading
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
* chore: update link
* chore: export cmder.SetFirstKeyPos to support build module commands
* feat(redisotel): ability to override TracerProvider (#1998)
* fix: add missing Expire methods to Cmdable
This is a followup to https://github.com/go-redis/redis/pull/1928
* chore(deps): bump github.com/onsi/gomega from 1.17.0 to 1.18.1
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.17.0 to 1.18.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.17.0...v1.18.1)
---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update README.md (#2011)
chore: add fmt library in example code
* chore: instrumentation name and version (#2012)
* fix: invalid type assert in stringArg
* chore: cleanup
* fix: example/otel compile error (#2028)
* fix: rename Golang to Go (#2030)
https://go.dev/doc/faq#go_or_golang
* feat: add support for passing extra attributes added to spans
* feat: set net.peer.name and net.peer.port in otel example
* chore: tweak Uptrace copy
* feat: add support for COPY command (#2016)
* feat: add support for acl sentinel auth in universal client
* chore(deps): bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* chore: add hll example
* chore: tweak release script
* chore: release v8.11.5 (release.sh)
* chore: add discord back
Co-authored-by: Eugene Ponizovsky <ponizovsky@gmail.com>
Co-authored-by: Bogdan Drutu <bogdandrutu@gmail.com>
Co-authored-by: Vladimir Mihailenco <vladimir.webdev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kishan B <kishancs46@gmail.com>
Co-authored-by: Dominik Menke <dom@digineo.de>
Co-authored-by: Gökhan Özeloğlu <gozeloglu@gmail.com>
Co-authored-by: Justin Sievenpiper <justin@sievenpiper.co>
Co-authored-by: Алексей Романовский <aromanovsky@epiphan.com>
Co-authored-by: Stavros Panakakakis <stavrospanakakis@gmail.com>
Co-authored-by: Pau Freixes <pfreixes@gmail.com>
Co-authored-by: Ethan Hur <ethan0311@gmail.com>
Co-authored-by: Jackie <18378976+Pyrodash@users.noreply.github.com>
Co-authored-by: Kristinn Björgvin Árdal <kristinnardalsecondary@gmail.com>
Co-authored-by: ffenix113 <razerer@bigmir.net>
Co-authored-by: Bastien Penavayre <bastienPenava@gmail.com>
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
Co-authored-by: Eng Zer Jun <engzerjun@gmail.com>
Co-authored-by: gzjiangtao2014 <gzjiangtao2014@corp.netease.com>
Co-authored-by: Nelz <nelz9999@users.noreply.github.com>
Co-authored-by: Daniel Richter <Nexyz9@gmail.com>
Co-authored-by: Seyed Ali Ghaffari <ali.ghaffari@outlook.com>
Co-authored-by: lintanghui <lintanghui@bilibili.com>
Co-authored-by: hidu <duv123+github@gmail.com>
Co-authored-by: Jonas Lergell <jonas.lergell@volvocars.com>
Co-authored-by: Alex Kahn <alexanderkahn@gmail.com>
2022-03-19 07:40:31 +03:00
|
|
|
cmd.SetFirstKeyPos(3)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ScriptExists(ctx context.Context, hashes ...string) *BoolSliceCmd {
|
2018-03-05 11:54:11 +03:00
|
|
|
args := make([]interface{}, 2+len(hashes))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "script"
|
|
|
|
args[1] = "exists"
|
2018-03-05 11:54:11 +03:00
|
|
|
for i, hash := range hashes {
|
|
|
|
args[2+i] = hash
|
2015-05-28 15:51:19 +03:00
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewBoolSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ScriptFlush(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "script", "flush")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ScriptKill(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "script", "kill")
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ScriptLoad(ctx context.Context, script string) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "script", "load", script)
|
|
|
|
_ = c(ctx, cmd)
|
2014-06-25 11:40:56 +04:00
|
|
|
return cmd
|
2012-08-20 14:42:33 +04:00
|
|
|
}
|
2014-10-07 14:06:41 +04:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2016-07-21 16:04:40 +03:00
|
|
|
// Publish posts the message to the channel.
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) Publish(ctx context.Context, channel string, message interface{}) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "publish", channel, message)
|
|
|
|
_ = c(ctx, cmd)
|
2016-07-21 16:04:40 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PubSubChannels(ctx context.Context, pattern string) *StringSliceCmd {
|
2016-05-06 21:12:31 +03:00
|
|
|
args := []interface{}{"pubsub", "channels"}
|
2014-10-07 16:40:00 +04:00
|
|
|
if pattern != "*" {
|
|
|
|
args = append(args, pattern)
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2014-10-07 14:06:41 +04:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2022-08-08 10:28:46 +03:00
|
|
|
func (c cmdable) PubSubNumSub(ctx context.Context, channels ...string) *MapStringIntCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(channels))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "pubsub"
|
|
|
|
args[1] = "numsub"
|
2015-05-28 15:51:19 +03:00
|
|
|
for i, channel := range channels {
|
|
|
|
args[2+i] = channel
|
|
|
|
}
|
2022-08-08 10:28:46 +03:00
|
|
|
cmd := NewMapStringIntCmd(ctx, args...)
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2014-10-07 14:06:41 +04:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) PubSubNumPat(ctx context.Context) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "pubsub", "numpat")
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterSlots(ctx context.Context) *ClusterSlotsCmd {
|
|
|
|
cmd := NewClusterSlotsCmd(ctx, "cluster", "slots")
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterNodes(ctx context.Context) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "cluster", "nodes")
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterMeet(ctx context.Context, host, port string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "meet", host, port)
|
|
|
|
_ = c(ctx, cmd)
|
2014-10-07 14:06:41 +04:00
|
|
|
return cmd
|
|
|
|
}
|
2015-01-24 15:12:48 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterForget(ctx context.Context, nodeID string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "forget", nodeID)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-09 12:33:37 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterReplicate(ctx context.Context, nodeID string) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "replicate", nodeID)
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterResetSoft(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "reset", "soft")
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-21 19:53:02 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterResetHard(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "reset", "hard")
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-21 19:53:02 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterInfo(ctx context.Context) *StringCmd {
|
|
|
|
cmd := NewStringCmd(ctx, "cluster", "info")
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterKeySlot(ctx context.Context, key string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "cluster", "keyslot", key)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-28 19:58:04 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "cluster", "getkeysinslot", slot, count)
|
|
|
|
_ = c(ctx, cmd)
|
2019-01-29 21:39:58 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterCountFailureReports(ctx context.Context, nodeID string) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "cluster", "count-failure-reports", nodeID)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-29 19:16:14 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterCountKeysInSlot(ctx context.Context, slot int) *IntCmd {
|
|
|
|
cmd := NewIntCmd(ctx, "cluster", "countkeysinslot", slot)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-29 19:16:14 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterDelSlots(ctx context.Context, slots ...int) *StatusCmd {
|
2015-12-29 19:16:14 +03:00
|
|
|
args := make([]interface{}, 2+len(slots))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "cluster"
|
|
|
|
args[1] = "delslots"
|
2015-12-29 19:16:14 +03:00
|
|
|
for i, slot := range slots {
|
|
|
|
args[2+i] = slot
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-29 19:16:14 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterDelSlotsRange(ctx context.Context, min, max int) *StatusCmd {
|
2015-12-29 19:16:14 +03:00
|
|
|
size := max - min + 1
|
|
|
|
slots := make([]int, size)
|
|
|
|
for i := 0; i < size; i++ {
|
|
|
|
slots[i] = min + i
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
return c.ClusterDelSlots(ctx, slots...)
|
2015-12-29 19:16:14 +03:00
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterSaveConfig(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "saveconfig")
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-29 19:16:14 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterSlaves(ctx context.Context, nodeID string) *StringSliceCmd {
|
|
|
|
cmd := NewStringSliceCmd(ctx, "cluster", "slaves", nodeID)
|
|
|
|
_ = c(ctx, cmd)
|
2015-12-29 19:16:14 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterFailover(ctx context.Context) *StatusCmd {
|
|
|
|
cmd := NewStatusCmd(ctx, "cluster", "failover")
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterAddSlots(ctx context.Context, slots ...int) *StatusCmd {
|
2015-05-28 15:51:19 +03:00
|
|
|
args := make([]interface{}, 2+len(slots))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "cluster"
|
|
|
|
args[1] = "addslots"
|
2015-01-24 15:12:48 +03:00
|
|
|
for i, num := range slots {
|
2017-03-24 13:48:32 +03:00
|
|
|
args[2+i] = num
|
2015-01-24 15:12:48 +03:00
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStatusCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-01-24 15:12:48 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) ClusterAddSlotsRange(ctx context.Context, min, max int) *StatusCmd {
|
2015-01-24 15:12:48 +03:00
|
|
|
size := max - min + 1
|
|
|
|
slots := make([]int, size)
|
|
|
|
for i := 0; i < size; i++ {
|
|
|
|
slots[i] = min + i
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
return c.ClusterAddSlots(ctx, slots...)
|
2015-01-24 15:12:48 +03:00
|
|
|
}
|
2015-09-20 16:13:13 +03:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) GeoAdd(ctx context.Context, key string, geoLocation ...*GeoLocation) *IntCmd {
|
2015-09-20 16:13:13 +03:00
|
|
|
args := make([]interface{}, 2+3*len(geoLocation))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "geoadd"
|
2015-09-20 16:13:13 +03:00
|
|
|
args[1] = key
|
|
|
|
for i, eachLoc := range geoLocation {
|
|
|
|
args[2+3*i] = eachLoc.Longitude
|
|
|
|
args[2+3*i+1] = eachLoc.Latitude
|
|
|
|
args[2+3*i+2] = eachLoc.Name
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-09-20 16:13:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2019-08-09 15:04:56 +03:00
|
|
|
// GeoRadius is a read-only GEORADIUS_RO command.
|
2020-04-19 16:40:26 +03:00
|
|
|
func (c cmdable) GeoRadius(
|
|
|
|
ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
|
|
|
|
) *GeoLocationCmd {
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewGeoLocationCmd(ctx, query, "georadius_ro", key, longitude, latitude)
|
2019-08-09 15:04:56 +03:00
|
|
|
if query.Store != "" || query.StoreDist != "" {
|
2020-02-03 12:53:47 +03:00
|
|
|
cmd.SetErr(errors.New("GeoRadius does not support Store or StoreDist"))
|
2019-08-09 15:04:56 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2015-09-20 16:13:13 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2015-10-15 00:39:39 +03:00
|
|
|
|
2019-08-09 15:04:56 +03:00
|
|
|
// GeoRadiusStore is a writing GEORADIUS command.
|
2020-04-19 16:40:26 +03:00
|
|
|
func (c cmdable) GeoRadiusStore(
|
|
|
|
ctx context.Context, key string, longitude, latitude float64, query *GeoRadiusQuery,
|
|
|
|
) *IntCmd {
|
2019-08-09 15:04:56 +03:00
|
|
|
args := geoLocationArgs(query, "georadius", key, longitude, latitude)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
2019-08-09 15:04:56 +03:00
|
|
|
if query.Store == "" && query.StoreDist == "" {
|
2020-02-03 12:53:47 +03:00
|
|
|
cmd.SetErr(errors.New("GeoRadiusStore requires Store or StoreDist"))
|
2019-08-09 15:04:56 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2017-07-19 15:32:50 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-06-01 06:21:13 +03:00
|
|
|
// GeoRadiusByMember is a read-only GEORADIUSBYMEMBER_RO command.
|
2020-04-19 16:40:26 +03:00
|
|
|
func (c cmdable) GeoRadiusByMember(
|
|
|
|
ctx context.Context, key, member string, query *GeoRadiusQuery,
|
|
|
|
) *GeoLocationCmd {
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewGeoLocationCmd(ctx, query, "georadiusbymember_ro", key, member)
|
2019-08-09 15:04:56 +03:00
|
|
|
if query.Store != "" || query.StoreDist != "" {
|
2020-02-03 12:53:47 +03:00
|
|
|
cmd.SetErr(errors.New("GeoRadiusByMember does not support Store or StoreDist"))
|
2019-08-09 15:04:56 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2015-11-14 17:36:21 +03:00
|
|
|
return cmd
|
2015-10-15 00:39:39 +03:00
|
|
|
}
|
|
|
|
|
2019-08-09 15:04:56 +03:00
|
|
|
// GeoRadiusByMemberStore is a writing GEORADIUSBYMEMBER command.
|
2020-04-19 16:40:26 +03:00
|
|
|
func (c cmdable) GeoRadiusByMemberStore(
|
|
|
|
ctx context.Context, key, member string, query *GeoRadiusQuery,
|
|
|
|
) *IntCmd {
|
2019-08-09 15:04:56 +03:00
|
|
|
args := geoLocationArgs(query, "georadiusbymember", key, member)
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewIntCmd(ctx, args...)
|
2019-08-09 15:04:56 +03:00
|
|
|
if query.Store == "" && query.StoreDist == "" {
|
2020-02-03 12:53:47 +03:00
|
|
|
cmd.SetErr(errors.New("GeoRadiusByMemberStore requires Store or StoreDist"))
|
2019-08-09 15:04:56 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
_ = c(ctx, cmd)
|
2017-07-19 15:32:50 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2021-08-02 14:01:01 +03:00
|
|
|
func (c cmdable) GeoSearch(ctx context.Context, key string, q *GeoSearchQuery) *StringSliceCmd {
|
|
|
|
args := make([]interface{}, 0, 13)
|
|
|
|
args = append(args, "geosearch", key)
|
|
|
|
args = geoSearchArgs(q, args)
|
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) GeoSearchLocation(
|
|
|
|
ctx context.Context, key string, q *GeoSearchLocationQuery,
|
|
|
|
) *GeoSearchLocationCmd {
|
|
|
|
args := make([]interface{}, 0, 16)
|
|
|
|
args = append(args, "geosearch", key)
|
|
|
|
args = geoSearchLocationArgs(q, args)
|
|
|
|
cmd := NewGeoSearchLocationCmd(ctx, q, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c cmdable) GeoSearchStore(ctx context.Context, key, store string, q *GeoSearchStoreQuery) *IntCmd {
|
|
|
|
args := make([]interface{}, 0, 15)
|
|
|
|
args = append(args, "geosearchstore", store, key)
|
|
|
|
args = geoSearchArgs(&q.GeoSearchQuery, args)
|
|
|
|
if q.StoreDist {
|
|
|
|
args = append(args, "storedist")
|
|
|
|
}
|
|
|
|
cmd := NewIntCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-04-19 16:40:26 +03:00
|
|
|
func (c cmdable) GeoDist(
|
|
|
|
ctx context.Context, key string, member1, member2, unit string,
|
|
|
|
) *FloatCmd {
|
2015-10-15 00:39:39 +03:00
|
|
|
if unit == "" {
|
|
|
|
unit = "km"
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewFloatCmd(ctx, "geodist", key, member1, member2, unit)
|
|
|
|
_ = c(ctx, cmd)
|
2015-10-15 00:39:39 +03:00
|
|
|
return cmd
|
|
|
|
}
|
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) GeoHash(ctx context.Context, key string, members ...string) *StringSliceCmd {
|
2015-10-15 00:39:39 +03:00
|
|
|
args := make([]interface{}, 2+len(members))
|
2016-05-06 21:12:31 +03:00
|
|
|
args[0] = "geohash"
|
2015-10-15 00:39:39 +03:00
|
|
|
args[1] = key
|
|
|
|
for i, member := range members {
|
|
|
|
args[2+i] = member
|
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewStringSliceCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2015-10-15 00:39:39 +03:00
|
|
|
return cmd
|
|
|
|
}
|
2016-05-06 21:12:31 +03:00
|
|
|
|
2020-03-11 17:26:42 +03:00
|
|
|
func (c cmdable) GeoPos(ctx context.Context, key string, members ...string) *GeoPosCmd {
|
2016-08-22 12:39:22 +03:00
|
|
|
args := make([]interface{}, 2+len(members))
|
2016-08-22 00:32:06 +03:00
|
|
|
args[0] = "geopos"
|
|
|
|
args[1] = key
|
2016-08-22 12:39:22 +03:00
|
|
|
for i, member := range members {
|
|
|
|
args[2+i] = member
|
2016-08-22 00:32:06 +03:00
|
|
|
}
|
2020-03-11 17:26:42 +03:00
|
|
|
cmd := NewGeoPosCmd(ctx, args...)
|
|
|
|
_ = c(ctx, cmd)
|
2016-05-06 21:12:31 +03:00
|
|
|
return cmd
|
|
|
|
}
|