Compare commits

...

12 Commits
master ... v8

Author SHA1 Message Date
re 742df17fb8 Merge remote-tracking branch 'upstream/v8' into v8 2023-01-10 14:16:04 +03:00
Monkey 6c688c7e9f
Merge pull request #2341 from monkey92t/v8
test(action): add tests to the v8 branch
2023-01-06 01:50:19 +08:00
monkey92t 57918584b8 test(github-action): update v8 test services-redis version, to redis6
Signed-off-by: monkey92t <golang@88.com>
2023-01-06 01:35:23 +08:00
monkey92t 92fb134b81 test: update the go version of the v8 branch test
Signed-off-by: monkey92t <golang@88.com>
2023-01-05 19:20:57 +08:00
monkey92t 2556b76824 test(action): add tests to the v8 branch
Signed-off-by: monkey92t <golang@88.com>
2023-01-05 19:19:08 +08:00
Monkey 6a0c42198f
Merge pull request #2340 from monkey92t/v8
feat: v8 remove redis7 command
2023-01-05 19:17:35 +08:00
monkey92t 0a57079ece feat: v8 remove redis7 command
Signed-off-by: monkey92t <golang@88.com>
2023-01-05 19:14:20 +08:00
Monkey 5c486cf98a
Merge pull request #2335 from monkey92t/issue_2319
fix: hook.process.fn should return error instead of cmd.SetErr().
2022-12-29 19:22:29 +08:00
monkey92t 0358ca4bfe fix: hook.process.fn should return error instead of cmd.SetErr()
Signed-off-by: monkey92t <golang@88.com>
2022-12-29 17:04:57 +08:00
re f8f4a2fad9 rm weight 2022-12-21 14:39:04 +03:00
re b756cc3792 upd 2022-12-21 14:38:43 +03:00
re a337be9066 fix repo 2022-12-12 15:55:49 +03:00
70 changed files with 189 additions and 193 deletions

View File

@ -2,9 +2,9 @@ name: Go
on:
push:
branches: [master]
branches: [master, v8]
pull_request:
branches: [master]
branches: [master, v8]
jobs:
build:
@ -13,11 +13,11 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [1.17.x, 1.18.x]
go-version: [1.18.x, 1.19.x]
services:
redis:
image: redis
image: redis:6.2.8
options: >-
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
ports:

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
*.rdb
testdata/*/
testdata/*
.idea/

View File

@ -1,7 +1,7 @@
# Redis client for Go
![build workflow](https://github.com/go-redis/redis/actions/workflows/build.yml/badge.svg)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/go-redis/redis/v8)](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc)
[![PkgGoDev](https://pkg.go.dev/badge/git.internal/re/redis/v8)](https://pkg.go.dev/git.internal/re/redis/v8?tab=doc)
[![Documentation](https://img.shields.io/badge/redis-documentation-informational)](https://redis.uptrace.dev/)
[![Chat](https://discordapp.com/api/guilds/752070105847955518/widget.png)](https://discord.gg/rWtp5Aj)
@ -28,8 +28,8 @@ for your applications thanks to its per request pricing and low latency data.
- [Documentation](https://redis.uptrace.dev)
- [Discussions](https://github.com/go-redis/redis/discussions)
- [Chat](https://discord.gg/rWtp5Aj)
- [Reference](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc)
- [Examples](https://pkg.go.dev/github.com/go-redis/redis/v8?tab=doc#pkg-examples)
- [Reference](https://pkg.go.dev/git.internal/re/redis/v8?tab=doc)
- [Examples](https://pkg.go.dev/git.internal/re/redis/v8?tab=doc#pkg-examples)
## Ecosystem
@ -66,7 +66,7 @@ go mod init github.com/my/repo
And then install go-redis/v8 (note _v8_ in the import; omitting it is a popular mistake):
```shell
go get github.com/go-redis/redis/v8
go get git.internal/re/redis/v8
```
## Quickstart
@ -74,7 +74,7 @@ go get github.com/go-redis/redis/v8
```go
import (
"context"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
"fmt"
)

View File

@ -8,7 +8,7 @@ import (
"testing"
"time"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/proto"
)
var ctx = context.TODO()

View File

@ -10,7 +10,7 @@ import (
"testing"
"time"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func benchmarkRedisClient(ctx context.Context, poolSize int) *redis.Client {

View File

@ -12,11 +12,11 @@ import (
"sync/atomic"
"time"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/hashtag"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/hashtag"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/rand"
)
var errClusterNoNodes = fmt.Errorf("redis: cluster has no nodes")

View File

@ -18,11 +18,12 @@ func (c *ClusterClient) DBSize(ctx context.Context) *IntCmd {
atomic.AddInt64(&size, n)
return nil
})
if err != nil {
cmd.SetErr(err)
} else {
cmd.val = size
return err
}
cmd.val = size
return nil
})
return cmd
@ -46,10 +47,8 @@ func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCm
return nil
})
if err != nil {
cmd.SetErr(err)
}
return nil
return err
})
return cmd
}
@ -60,10 +59,8 @@ func (c *ClusterClient) ScriptFlush(ctx context.Context) *StatusCmd {
err := c.ForEachShard(ctx, func(ctx context.Context, shard *Client) error {
return shard.ScriptFlush(ctx).Err()
})
if err != nil {
cmd.SetErr(err)
}
return nil
return err
})
return cmd
}
@ -98,11 +95,12 @@ func (c *ClusterClient) ScriptExists(ctx context.Context, hashes ...string) *Boo
return nil
})
if err != nil {
cmd.SetErr(err)
} else {
cmd.val = result
return err
}
cmd.val = result
return nil
})
return cmd

View File

@ -12,8 +12,8 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"github.com/go-redis/redis/v8/internal/hashtag"
"git.internal/re/redis/v8"
"git.internal/re/redis/v8/internal/hashtag"
)
type clusterScenario struct {

View File

@ -7,10 +7,10 @@ import (
"strconv"
"time"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/hscan"
"github.com/go-redis/redis/v8/internal/proto"
"github.com/go-redis/redis/v8/internal/util"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/hscan"
"git.internal/re/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/util"
)
type Cmder interface {

View File

@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
redis "github.com/go-redis/redis/v8"
redis "git.internal/re/redis/v8"
)
var _ = Describe("Cmd", func() {

View File

@ -6,14 +6,14 @@ import (
"io"
"time"
"github.com/go-redis/redis/v8/internal"
"git.internal/re/redis/v8/internal"
)
// 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.
// For example:
//
// rdb.Set(ctx, key, value, redis.KeepTTL)
// rdb.Set(ctx, key, value, redis.KeepTTL)
const KeepTTL = -1
func usePrecise(dur time.Duration) bool {
@ -96,10 +96,6 @@ type Cmdable interface {
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
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
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
@ -534,22 +530,6 @@ func (c cmdable) Expire(ctx context.Context, key string, expiration time.Duratio
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 {
@ -2049,8 +2029,10 @@ func xClaimArgs(a *XClaimArgs) []interface{} {
// 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.
//
// 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,
@ -2298,6 +2280,7 @@ func (c cmdable) ZAddXX(ctx context.Context, key string, members ...*Z) *IntCmd
// ZAddCh Redis `ZADD key CH score member [score member ...]` command.
// Deprecated: Use
//
// client.ZAddArgs(ctx, ZAddArgs{
// Ch: true,
// Members: []Z,
@ -2311,6 +2294,7 @@ func (c cmdable) ZAddCh(ctx context.Context, key string, members ...*Z) *IntCmd
// ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.
// Deprecated: Use
//
// client.ZAddArgs(ctx, ZAddArgs{
// NX: true,
// Ch: true,
@ -2326,6 +2310,7 @@ func (c cmdable) ZAddNXCh(ctx context.Context, key string, members ...*Z) *IntCm
// ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.
// Deprecated: Use
//
// client.ZAddArgs(ctx, ZAddArgs{
// XX: true,
// Ch: true,
@ -2341,6 +2326,7 @@ func (c cmdable) ZAddXXCh(ctx context.Context, key string, members ...*Z) *IntCm
// ZIncr Redis `ZADD key INCR score member` command.
// Deprecated: Use
//
// client.ZAddArgsIncr(ctx, ZAddArgs{
// Members: []Z,
// })
@ -2353,6 +2339,7 @@ func (c cmdable) ZIncr(ctx context.Context, key string, member *Z) *FloatCmd {
// ZIncrNX Redis `ZADD key NX INCR score member` command.
// Deprecated: Use
//
// client.ZAddArgsIncr(ctx, ZAddArgs{
// NX: true,
// Members: []Z,
@ -2367,6 +2354,7 @@ func (c cmdable) ZIncrNX(ctx context.Context, key string, member *Z) *FloatCmd {
// ZIncrXX Redis `ZADD key XX INCR score member` command.
// Deprecated: Use
//
// client.ZAddArgsIncr(ctx, ZAddArgs{
// XX: true,
// Members: []Z,
@ -2488,11 +2476,13 @@ func (c cmdable) ZPopMin(ctx context.Context, key string, count ...int64) *ZSlic
// ZRangeArgs is all the options of the ZRange command.
// In version> 6.2.0, you can replace the(cmd):
// ZREVRANGE,
// ZRANGEBYSCORE,
// ZREVRANGEBYSCORE,
// ZRANGEBYLEX,
// ZREVRANGEBYLEX.
//
// 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.
@ -2897,7 +2887,7 @@ func (c cmdable) ClientKill(ctx context.Context, ipPort string) *StatusCmd {
// ClientKillByFilter is new style syntax, while the ClientKill is old
//
// CLIENT KILL <option> [value] ... <option> [value]
// CLIENT KILL <option> [value] ... <option> [value]
func (c cmdable) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd {
args := make([]interface{}, 2+len(keys))
args[0] = "client"

View File

@ -10,8 +10,8 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8"
"git.internal/re/redis/v8/internal/proto"
)
var _ = Describe("Commands", func() {

View File

@ -6,8 +6,8 @@ import (
"net"
"strings"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/proto"
)
// ErrClosed performs any operation on the closed client will return this error.

View File

@ -2,6 +2,6 @@ module github.com/go-redis/redis/example/del-keys-without-ttl
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require github.com/go-redis/redis/v8 v8.11.5
require git.internal/re/redis/v8 v8.11.5

View File

@ -5,7 +5,7 @@ import (
"fmt"
"sync"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func main() {

View File

@ -2,6 +2,6 @@ module github.com/go-redis/redis/example/hll
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require github.com/go-redis/redis/v8 v8.11.5
require git.internal/re/redis/v8 v8.11.5

View File

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func main() {

View File

@ -2,6 +2,6 @@ module github.com/go-redis/redis/example/redis-bloom
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require github.com/go-redis/redis/v8 v8.11.5
require git.internal/re/redis/v8 v8.11.5

View File

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func main() {

View File

@ -2,7 +2,7 @@ module github.com/go-redis/redis/example/otel
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
replace github.com/go-redis/redis/extra/redisotel/v8 => ../../extra/redisotel
@ -10,7 +10,7 @@ replace github.com/go-redis/redis/extra/rediscmd/v8 => ../../extra/rediscmd
require (
github.com/go-redis/redis/extra/redisotel/v8 v8.11.5
github.com/go-redis/redis/v8 v8.11.5
git.internal/re/redis/v8 v8.11.5
github.com/uptrace/opentelemetry-go-extra/otelplay v0.1.10
go.opentelemetry.io/otel v1.5.0
go.opentelemetry.io/otel/exporters/jaeger v1.5.0 // indirect

View File

@ -10,8 +10,8 @@ import (
"go.opentelemetry.io/otel/codes"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"git.internal/re/redis/v8"
"github.com/go-redis/redis/extra/redisotel/v8"
"github.com/go-redis/redis/v8"
)
var tracer = otel.Tracer("redisexample")

View File

@ -2,6 +2,6 @@ module github.com/go-redis/redis/example/redis-bloom
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require github.com/go-redis/redis/v8 v8.11.5
require git.internal/re/redis/v8 v8.11.5

View File

@ -5,7 +5,7 @@ import (
"fmt"
"math/rand"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func main() {

View File

@ -2,9 +2,9 @@ module github.com/go-redis/redis/example/scan-struct
go 1.14
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require (
github.com/davecgh/go-spew v1.1.1
github.com/go-redis/redis/v8 v8.11.5
git.internal/re/redis/v8 v8.11.5
)

View File

@ -5,7 +5,7 @@ import (
"github.com/davecgh/go-spew/spew"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
type Model struct {

View File

@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
type redisHook struct{}

View File

@ -7,7 +7,7 @@ import (
"sync"
"time"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var (

View File

@ -6,9 +6,9 @@ import (
"net"
"strings"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/hashtag"
"github.com/go-redis/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/hashtag"
"git.internal/re/redis/v8/internal/pool"
)
func (c *baseClient) Pool() pool.Pooler {

View File

@ -2,13 +2,13 @@ module github.com/go-redis/redis/extra/rediscensus/v8
go 1.15
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
replace github.com/go-redis/redis/extra/rediscmd/v8 => ../rediscmd
require (
github.com/go-redis/redis/extra/rediscmd/v8 v8.11.5
github.com/go-redis/redis/v8 v8.11.5
git.internal/re/redis/v8 v8.11.5
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
go.opencensus.io v0.23.0
)

View File

@ -5,8 +5,8 @@ import (
"go.opencensus.io/trace"
"git.internal/re/redis/v8"
"github.com/go-redis/redis/extra/rediscmd/v8"
"github.com/go-redis/redis/v8"
)
type TracingHook struct{}

View File

@ -2,10 +2,10 @@ module github.com/go-redis/redis/extra/rediscmd/v8
go 1.15
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
require (
github.com/go-redis/redis/v8 v8.11.5
git.internal/re/redis/v8 v8.11.5
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.18.1
)

View File

@ -7,7 +7,7 @@ import (
"strings"
"time"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
func CmdString(cmd redis.Cmder) string {

View File

@ -12,7 +12,7 @@ Tracing is enabled by adding a hook:
```go
import (
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
"github.com/go-redis/redis/extra/redisotel"
)

View File

@ -2,13 +2,13 @@ module github.com/go-redis/redis/extra/redisotel/v8
go 1.15
replace github.com/go-redis/redis/v8 => ../..
replace git.internal/re/redis/v8 => ../..
replace github.com/go-redis/redis/extra/rediscmd/v8 => ../rediscmd
require (
github.com/go-redis/redis/extra/rediscmd/v8 v8.11.5
github.com/go-redis/redis/v8 v8.11.5
git.internal/re/redis/v8 v8.11.5
go.opentelemetry.io/otel v1.5.0
go.opentelemetry.io/otel/sdk v1.4.1
go.opentelemetry.io/otel/trace v1.5.0

View File

@ -9,8 +9,8 @@ import (
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"go.opentelemetry.io/otel/trace"
"git.internal/re/redis/v8"
"github.com/go-redis/redis/extra/rediscmd/v8"
"github.com/go-redis/redis/v8"
)
const (

View File

@ -2,11 +2,12 @@ package redisotel_test
import (
"context"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"testing"
semconv "go.opentelemetry.io/otel/semconv/v1.7.0"
"git.internal/re/redis/v8"
"github.com/go-redis/redis/extra/redisotel/v8"
"github.com/go-redis/redis/v8"
"go.opentelemetry.io/otel"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
"go.opentelemetry.io/otel/trace"

View File

@ -7,7 +7,7 @@ import (
"context"
"time"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var (

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/go-redis/redis/v8
module git.internal/re/redis/v8
go 1.17

View File

@ -3,7 +3,7 @@ package hashtag
import (
"strings"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal/rand"
)
const slotNumber = 16384

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal/rand"
)
func TestGinkgoSuite(t *testing.T) {

View File

@ -3,7 +3,7 @@ package internal
import (
"time"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal/rand"
)
func RetryBackoff(retry int, minBackoff, maxBackoff time.Duration) time.Duration {

View File

@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/go-redis/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/pool"
)
type poolGetPutBenchmark struct {

View File

@ -7,7 +7,7 @@ import (
"sync/atomic"
"time"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/proto"
)
var noDeadline = time.Time{}

View File

@ -8,7 +8,7 @@ import (
"sync/atomic"
"time"
"github.com/go-redis/redis/v8/internal"
"git.internal/re/redis/v8/internal"
)
var (

View File

@ -10,7 +10,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/pool"
)
var _ = Describe("ConnPool", func() {

View File

@ -5,7 +5,7 @@ import (
"fmt"
"io"
"github.com/go-redis/redis/v8/internal/util"
"git.internal/re/redis/v8/internal/util"
)
// redis resp protocol data type.

View File

@ -5,7 +5,7 @@ import (
"io"
"testing"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/proto"
)
func BenchmarkReader_ParseReply_Status(b *testing.B) {

View File

@ -7,10 +7,11 @@ import (
"reflect"
"time"
"github.com/go-redis/redis/v8/internal/util"
"git.internal/re/redis/v8/internal/util"
)
// Scan parses bytes `b` to `v` with appropriate type.
//
//nolint:gocyclo
func Scan(b []byte, v interface{}) error {
switch v := v.(type) {

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/proto"
)
type testScanSliceStruct struct {

View File

@ -8,7 +8,7 @@ import (
"strconv"
"time"
"github.com/go-redis/redis/v8/internal/util"
"git.internal/re/redis/v8/internal/util"
)
type writer interface {

View File

@ -11,7 +11,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/proto"
)
type MyType struct{}

View File

@ -4,7 +4,7 @@ import (
"context"
"time"
"github.com/go-redis/redis/v8/internal/util"
"git.internal/re/redis/v8/internal/util"
)
func Sleep(ctx context.Context, dur time.Duration) error {

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("ScanIterator", func() {

View File

@ -15,7 +15,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
const (

View File

@ -13,7 +13,7 @@ import (
"strings"
"time"
"github.com/go-redis/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/pool"
)
// Limiter is the interface of a rate limiter or a circuit breaker.
@ -196,32 +196,38 @@ func (opt *Options) clone() *Options {
// Scheme is required.
// There are two connection types: by tcp socket and by unix socket.
// Tcp connection:
// redis://<user>:<password>@<host>:<port>/<db_number>
//
// redis://<user>:<password>@<host>:<port>/<db_number>
//
// Unix connection:
// unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
//
// unix://<user>:<password>@</path/to/redis.sock>?db=<db_number>
//
// Most Option fields can be set using query parameters, with the following restrictions:
// - field names are mapped using snake-case conversion: to set MaxRetries, use max_retries
// - only scalar type fields are supported (bool, int, time.Duration)
// - for time.Duration fields, values must be a valid input for time.ParseDuration();
// additionally a plain integer as value (i.e. without unit) is intepreted as seconds
// - to disable a duration field, use value less than or equal to 0; to use the default
// value, leave the value blank or remove the parameter
// - only the last value is interpreted if a parameter is given multiple times
// - fields "network", "addr", "username" and "password" can only be set using other
// URL attributes (scheme, host, userinfo, resp.), query paremeters using these
// names will be treated as unknown parameters
// - unknown parameter names will result in an error
// - field names are mapped using snake-case conversion: to set MaxRetries, use max_retries
// - only scalar type fields are supported (bool, int, time.Duration)
// - for time.Duration fields, values must be a valid input for time.ParseDuration();
// additionally a plain integer as value (i.e. without unit) is intepreted as seconds
// - to disable a duration field, use value less than or equal to 0; to use the default
// value, leave the value blank or remove the parameter
// - only the last value is interpreted if a parameter is given multiple times
// - fields "network", "addr", "username" and "password" can only be set using other
// URL attributes (scheme, host, userinfo, resp.), query paremeters using these
// names will be treated as unknown parameters
// - unknown parameter names will result in an error
//
// Examples:
// redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
// is equivalent to:
// &Options{
// Network: "tcp",
// Addr: "localhost:6789",
// DB: 1, // path "/3" was overridden by "&db=1"
// DialTimeout: 3 * time.Second, // no time unit = seconds
// ReadTimeout: 6 * time.Second,
// MaxRetries: 2,
// }
//
// redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
// is equivalent to:
// &Options{
// Network: "tcp",
// Addr: "localhost:6789",
// DB: 1, // path "/3" was overridden by "&db=1"
// DialTimeout: 3 * time.Second, // no time unit = seconds
// ReadTimeout: 6 * time.Second,
// MaxRetries: 2,
// }
func ParseURL(redisURL string) (*Options, error) {
u, err := url.Parse(redisURL)
if err != nil {

View File

@ -4,7 +4,7 @@ import (
"context"
"sync"
"github.com/go-redis/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/pool"
)
type pipelineExecer func(context.Context, []Cmder) error

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("pipelining", func() {

View File

@ -7,7 +7,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("pool", func() {

View File

@ -7,9 +7,9 @@ import (
"sync"
"time"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/proto"
)
// PubSub implements Pub/Sub commands as described in

View File

@ -10,7 +10,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("PubSub", func() {

View File

@ -13,7 +13,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("races", func() {

View File

@ -7,9 +7,9 @@ import (
"sync/atomic"
"time"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/proto"
)
// Nil reply returned by Redis when key does not exist.
@ -668,26 +668,26 @@ func (c *Client) pubSub() *PubSub {
// subscription may not be active immediately. To force the connection to wait,
// you may call the Receive() method on the returned *PubSub like so:
//
// sub := client.Subscribe(queryResp)
// iface, err := sub.Receive()
// if err != nil {
// // handle error
// }
// sub := client.Subscribe(queryResp)
// iface, err := sub.Receive()
// if err != nil {
// // handle error
// }
//
// // Should be *Subscription, but others are possible if other actions have been
// // taken on sub since it was created.
// switch iface.(type) {
// case *Subscription:
// // subscribe succeeded
// case *Message:
// // received first message
// case *Pong:
// // pong received
// default:
// // handle error
// }
// // Should be *Subscription, but others are possible if other actions have been
// // taken on sub since it was created.
// switch iface.(type) {
// case *Subscription:
// // subscribe succeeded
// case *Message:
// // received first message
// case *Pong:
// // pong received
// default:
// // handle error
// }
//
// ch := sub.Channel()
// ch := sub.Channel()
func (c *Client) Subscribe(ctx context.Context, channels ...string) *PubSub {
pubsub := c.pubSub()
if len(channels) > 0 {

View File

@ -11,7 +11,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
type redisHookError struct {

View File

@ -14,10 +14,10 @@ import (
"github.com/cespare/xxhash/v2"
rendezvous "github.com/dgryski/go-rendezvous" //nolint
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/hashtag"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/hashtag"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/rand"
)
var errRingShardsDown = errors.New("redis: all ring shards are down")

View File

@ -12,7 +12,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("Redis Ring", func() {

View File

@ -9,9 +9,9 @@ import (
"sync"
"time"
"github.com/go-redis/redis/v8/internal"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/rand"
"git.internal/re/redis/v8/internal"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/rand"
)
//------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("Sentinel", func() {
@ -221,7 +221,7 @@ var _ = Describe("SentinelAclAuth", func() {
var client *redis.Client
var sentinel *redis.SentinelClient
var sentinels = func() []*redisProcess {
sentinels := func() []*redisProcess {
return []*redisProcess{sentinel1, sentinel2, sentinel3}
}

4
tx.go
View File

@ -3,8 +3,8 @@ package redis
import (
"context"
"github.com/go-redis/redis/v8/internal/pool"
"github.com/go-redis/redis/v8/internal/proto"
"git.internal/re/redis/v8/internal/pool"
"git.internal/re/redis/v8/internal/proto"
)
// TxFailedErr transaction redis failed.

View File

@ -8,7 +8,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("Tx", func() {

View File

@ -4,7 +4,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/go-redis/redis/v8"
"git.internal/re/redis/v8"
)
var _ = Describe("UniversalClient", func() {