Merge pull request #1915 from umputun/dependabot/go_modules/backend/github.com/redis/go-redis/v9-9.7.3
Bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3 in /backend
This commit is contained in:
+1
-1
@@ -60,7 +60,7 @@ require (
|
||||
github.com/klauspost/compress v1.17.11 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/redis/go-redis/v9 v9.7.0 // indirect
|
||||
github.com/redis/go-redis/v9 v9.7.3 // indirect
|
||||
github.com/rrivera/identicon v0.0.0-20240116195454-d5ba35832c0d // indirect
|
||||
github.com/slack-go/slack v0.15.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
|
||||
+2
-2
@@ -162,8 +162,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E=
|
||||
github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw=
|
||||
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
|
||||
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rrivera/identicon v0.0.0-20240116195454-d5ba35832c0d h1:l3+2LWCbVxn5itfvXAfH9n4YL9jh8l1g5zcncbIc1cs=
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
run:
|
||||
concurrency: 8
|
||||
deadline: 5m
|
||||
timeout: 5m
|
||||
tests: false
|
||||
|
||||
+20
-3
@@ -170,22 +170,39 @@ By default, go-redis automatically sends the client library name and version dur
|
||||
|
||||
#### Disabling Identity Verification
|
||||
|
||||
When connection identity verification is not required or needs to be explicitly disabled, a `DisableIndentity` configuration option exists. In V10 of this library, `DisableIndentity` will become `DisableIdentity` in order to fix the associated typo.
|
||||
When connection identity verification is not required or needs to be explicitly disabled, a `DisableIdentity` configuration option exists.
|
||||
Initially there was a typo and the option was named `DisableIndentity` instead of `DisableIdentity`. The misspelled option is marked as Deprecated and will be removed in V10 of this library.
|
||||
Although both options will work at the moment, the correct option is `DisableIdentity`. The deprecated option will be removed in V10 of this library, so please use the correct option name to avoid any issues.
|
||||
|
||||
To disable verification, set the `DisableIndentity` option to `true` in the Redis client options:
|
||||
To disable verification, set the `DisableIdentity` option to `true` in the Redis client options:
|
||||
|
||||
```go
|
||||
rdb := redis.NewClient(&redis.Options{
|
||||
Addr: "localhost:6379",
|
||||
Password: "",
|
||||
DB: 0,
|
||||
DisableIndentity: true, // Disable set-info on connect
|
||||
DisableIdentity: true, // Disable set-info on connect
|
||||
})
|
||||
```
|
||||
|
||||
#### Unstable RESP3 Structures for RediSearch Commands
|
||||
When integrating Redis with application functionalities using RESP3, it's important to note that some response structures aren't final yet. This is especially true for more complex structures like search and query results. We recommend using RESP2 when using the search and query capabilities, but we plan to stabilize the RESP3-based API-s in the coming versions. You can find more guidance in the upcoming release notes.
|
||||
|
||||
To enable unstable RESP3, set the option in your client configuration:
|
||||
|
||||
```go
|
||||
redis.NewClient(&redis.Options{
|
||||
UnstableResp3: true,
|
||||
})
|
||||
```
|
||||
**Note:** When UnstableResp3 mode is enabled, it's necessary to use RawResult() and RawVal() to retrieve a raw data.
|
||||
Since, raw response is the only option for unstable search commands Val() and Result() calls wouldn't have any affect on them:
|
||||
|
||||
```go
|
||||
res1, err := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawResult()
|
||||
val1 := client.FTSearchWithArgs(ctx, "txt", "foo bar", &redis.FTSearchOptions{}).RawVal()
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Please see [out contributing guidelines](CONTRIBUTING.md) to help us improve this library!
|
||||
|
||||
+2
@@ -167,6 +167,8 @@ func (cmd *baseCmd) stringArg(pos int) string {
|
||||
switch v := arg.(type) {
|
||||
case string:
|
||||
return v
|
||||
case []byte:
|
||||
return string(v)
|
||||
default:
|
||||
// TODO: consider using appendArg
|
||||
return fmt.Sprint(v)
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ func (c cmdable) HExpire(ctx context.Context, key string, expiration time.Durati
|
||||
return cmd
|
||||
}
|
||||
|
||||
// HExpire - Sets the expiration time for specified fields in a hash in seconds.
|
||||
// HExpireWithArgs - Sets the expiration time for specified fields in a hash in seconds.
|
||||
// It requires a key, an expiration duration, a struct with boolean flags for conditional expiration settings (NX, XX, GT, LT), and a list of fields.
|
||||
// The command constructs an argument list starting with "HEXPIRE", followed by the key, duration, any conditional flags, and the specified fields.
|
||||
// For more information - https://redis.io/commands/hexpire/
|
||||
|
||||
+11
-2
@@ -148,13 +148,22 @@ type Options struct {
|
||||
// Enables read only queries on slave/follower nodes.
|
||||
readOnly bool
|
||||
|
||||
// Disable set-lib on connect. Default is false.
|
||||
// DisableIndentity - Disable set-lib on connect.
|
||||
//
|
||||
// default: false
|
||||
//
|
||||
// Deprecated: Use DisableIdentity instead.
|
||||
DisableIndentity bool
|
||||
|
||||
// DisableIdentity is used to disable CLIENT SETINFO command on connect.
|
||||
//
|
||||
// default: false
|
||||
DisableIdentity bool
|
||||
|
||||
// Add suffix to client name. Default is empty.
|
||||
IdentitySuffix string
|
||||
|
||||
// Enable Unstable mode for Redis Search module with RESP3.
|
||||
// UnstableResp3 enables Unstable mode for Redis Search module with RESP3.
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
|
||||
+24
-6
@@ -86,10 +86,24 @@ type ClusterOptions struct {
|
||||
ConnMaxIdleTime time.Duration
|
||||
ConnMaxLifetime time.Duration
|
||||
|
||||
TLSConfig *tls.Config
|
||||
DisableIndentity bool // Disable set-lib on connect. Default is false.
|
||||
TLSConfig *tls.Config
|
||||
|
||||
// DisableIndentity - Disable set-lib on connect.
|
||||
//
|
||||
// default: false
|
||||
//
|
||||
// Deprecated: Use DisableIdentity instead.
|
||||
DisableIndentity bool
|
||||
|
||||
// DisableIdentity is used to disable CLIENT SETINFO command on connect.
|
||||
//
|
||||
// default: false
|
||||
DisableIdentity bool
|
||||
|
||||
IdentitySuffix string // Add suffix to client name. Default is empty.
|
||||
|
||||
// UnstableResp3 enables Unstable mode for Redis Search module with RESP3.
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *ClusterOptions) init() {
|
||||
@@ -296,7 +310,8 @@ func (opt *ClusterOptions) clientOptions() *Options {
|
||||
MaxActiveConns: opt.MaxActiveConns,
|
||||
ConnMaxIdleTime: opt.ConnMaxIdleTime,
|
||||
ConnMaxLifetime: opt.ConnMaxLifetime,
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
DisableIdentity: opt.DisableIdentity,
|
||||
DisableIndentity: opt.DisableIdentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
TLSConfig: opt.TLSConfig,
|
||||
// If ClusterSlots is populated, then we probably have an artificial
|
||||
@@ -304,7 +319,8 @@ func (opt *ClusterOptions) clientOptions() *Options {
|
||||
// much use for ClusterSlots config). This means we cannot execute the
|
||||
// READONLY command against that node -- setting readOnly to false in such
|
||||
// situations in the options below will prevent that from happening.
|
||||
readOnly: opt.ReadOnly && opt.ClusterSlots == nil,
|
||||
readOnly: opt.ReadOnly && opt.ClusterSlots == nil,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,9 +481,11 @@ func (c *clusterNodes) Addrs() ([]string, error) {
|
||||
closed := c.closed //nolint:ifshort
|
||||
if !closed {
|
||||
if len(c.activeAddrs) > 0 {
|
||||
addrs = c.activeAddrs
|
||||
addrs = make([]string, len(c.activeAddrs))
|
||||
copy(addrs, c.activeAddrs)
|
||||
} else {
|
||||
addrs = c.addrs
|
||||
addrs = make([]string, len(c.addrs))
|
||||
copy(addrs, c.addrs)
|
||||
}
|
||||
}
|
||||
c.mu.RUnlock()
|
||||
|
||||
+17
-8
@@ -41,7 +41,7 @@ type (
|
||||
)
|
||||
|
||||
type hooksMixin struct {
|
||||
hooksMu *sync.Mutex
|
||||
hooksMu *sync.RWMutex
|
||||
|
||||
slice []Hook
|
||||
initial hooks
|
||||
@@ -49,7 +49,7 @@ type hooksMixin struct {
|
||||
}
|
||||
|
||||
func (hs *hooksMixin) initHooks(hooks hooks) {
|
||||
hs.hooksMu = new(sync.Mutex)
|
||||
hs.hooksMu = new(sync.RWMutex)
|
||||
hs.initial = hooks
|
||||
hs.chain()
|
||||
}
|
||||
@@ -151,7 +151,7 @@ func (hs *hooksMixin) clone() hooksMixin {
|
||||
clone := *hs
|
||||
l := len(clone.slice)
|
||||
clone.slice = clone.slice[:l:l]
|
||||
clone.hooksMu = new(sync.Mutex)
|
||||
clone.hooksMu = new(sync.RWMutex)
|
||||
return clone
|
||||
}
|
||||
|
||||
@@ -176,9 +176,14 @@ func (hs *hooksMixin) withProcessPipelineHook(
|
||||
}
|
||||
|
||||
func (hs *hooksMixin) dialHook(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
hs.hooksMu.Lock()
|
||||
defer hs.hooksMu.Unlock()
|
||||
return hs.current.dial(ctx, network, addr)
|
||||
// Access to hs.current is guarded by a read-only lock since it may be mutated by AddHook(...)
|
||||
// while this dialer is concurrently accessed by the background connection pool population
|
||||
// routine when MinIdleConns > 0.
|
||||
hs.hooksMu.RLock()
|
||||
current := hs.current
|
||||
hs.hooksMu.RUnlock()
|
||||
|
||||
return current.dial(ctx, network, addr)
|
||||
}
|
||||
|
||||
func (hs *hooksMixin) processHook(ctx context.Context, cmd Cmder) error {
|
||||
@@ -345,7 +350,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !c.opt.DisableIndentity {
|
||||
if !c.opt.DisableIdentity && !c.opt.DisableIndentity {
|
||||
libName := ""
|
||||
libVer := Version()
|
||||
if c.opt.IdentitySuffix != "" {
|
||||
@@ -354,7 +359,11 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error {
|
||||
p := conn.Pipeline()
|
||||
p.ClientSetInfo(ctx, WithLibraryName(libName))
|
||||
p.ClientSetInfo(ctx, WithLibraryVersion(libVer))
|
||||
_, _ = p.Exec(ctx)
|
||||
// Handle network errors (e.g. timeouts) in CLIENT SETINFO to avoid
|
||||
// out of order responses later on.
|
||||
if _, err = p.Exec(ctx); err != nil && !isRedisError(err) {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if c.opt.OnConnect != nil {
|
||||
|
||||
+16
-4
@@ -98,9 +98,19 @@ type RingOptions struct {
|
||||
TLSConfig *tls.Config
|
||||
Limiter Limiter
|
||||
|
||||
// DisableIndentity - Disable set-lib on connect.
|
||||
//
|
||||
// default: false
|
||||
//
|
||||
// Deprecated: Use DisableIdentity instead.
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
|
||||
// DisableIdentity is used to disable CLIENT SETINFO command on connect.
|
||||
//
|
||||
// default: false
|
||||
DisableIdentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *RingOptions) init() {
|
||||
@@ -167,9 +177,11 @@ func (opt *RingOptions) clientOptions() *Options {
|
||||
TLSConfig: opt.TLSConfig,
|
||||
Limiter: opt.Limiter,
|
||||
|
||||
DisableIdentity: opt.DisableIdentity,
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+64
-36
@@ -247,6 +247,8 @@ type FTAggregateOptions struct {
|
||||
GroupBy []FTAggregateGroupBy
|
||||
SortBy []FTAggregateSortBy
|
||||
SortByMax int
|
||||
Scorer string
|
||||
AddScores bool
|
||||
Apply []FTAggregateApply
|
||||
LimitOffset int
|
||||
Limit int
|
||||
@@ -483,6 +485,15 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
|
||||
if options.Verbatim {
|
||||
queryArgs = append(queryArgs, "VERBATIM")
|
||||
}
|
||||
|
||||
if options.Scorer != "" {
|
||||
queryArgs = append(queryArgs, "SCORER", options.Scorer)
|
||||
}
|
||||
|
||||
if options.AddScores {
|
||||
queryArgs = append(queryArgs, "ADDSCORES")
|
||||
}
|
||||
|
||||
if options.LoadAll && options.Load != nil {
|
||||
panic("FT.AGGREGATE: LOADALL and LOAD are mutually exclusive")
|
||||
}
|
||||
@@ -491,16 +502,29 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
|
||||
}
|
||||
if options.Load != nil {
|
||||
queryArgs = append(queryArgs, "LOAD", len(options.Load))
|
||||
index, count := len(queryArgs)-1, 0
|
||||
for _, load := range options.Load {
|
||||
queryArgs = append(queryArgs, load.Field)
|
||||
count++
|
||||
if load.As != "" {
|
||||
queryArgs = append(queryArgs, "AS", load.As)
|
||||
count += 2
|
||||
}
|
||||
}
|
||||
queryArgs[index] = count
|
||||
}
|
||||
|
||||
if options.Timeout > 0 {
|
||||
queryArgs = append(queryArgs, "TIMEOUT", options.Timeout)
|
||||
}
|
||||
|
||||
for _, apply := range options.Apply {
|
||||
queryArgs = append(queryArgs, "APPLY", apply.Field)
|
||||
if apply.As != "" {
|
||||
queryArgs = append(queryArgs, "AS", apply.As)
|
||||
}
|
||||
}
|
||||
|
||||
if options.GroupBy != nil {
|
||||
for _, groupBy := range options.GroupBy {
|
||||
queryArgs = append(queryArgs, "GROUPBY", len(groupBy.Fields))
|
||||
@@ -542,17 +566,8 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
|
||||
if options.SortByMax > 0 {
|
||||
queryArgs = append(queryArgs, "MAX", options.SortByMax)
|
||||
}
|
||||
for _, apply := range options.Apply {
|
||||
queryArgs = append(queryArgs, "APPLY", apply.Field)
|
||||
if apply.As != "" {
|
||||
queryArgs = append(queryArgs, "AS", apply.As)
|
||||
}
|
||||
}
|
||||
if options.LimitOffset > 0 {
|
||||
queryArgs = append(queryArgs, "LIMIT", options.LimitOffset)
|
||||
}
|
||||
if options.Limit > 0 {
|
||||
queryArgs = append(queryArgs, options.Limit)
|
||||
if options.LimitOffset >= 0 && options.Limit > 0 {
|
||||
queryArgs = append(queryArgs, "LIMIT", options.LimitOffset, options.Limit)
|
||||
}
|
||||
if options.Filter != "" {
|
||||
queryArgs = append(queryArgs, "FILTER", options.Filter)
|
||||
@@ -574,6 +589,7 @@ func FTAggregateQuery(query string, options *FTAggregateOptions) AggregateQuery
|
||||
queryArgs = append(queryArgs, key, value)
|
||||
}
|
||||
}
|
||||
|
||||
if options.DialectVersion > 0 {
|
||||
queryArgs = append(queryArgs, "DIALECT", options.DialectVersion)
|
||||
}
|
||||
@@ -653,12 +669,11 @@ func (cmd *AggregateCmd) String() string {
|
||||
func (cmd *AggregateCmd) readReply(rd *proto.Reader) (err error) {
|
||||
data, err := rd.ReadSlice()
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
cmd.val, err = ProcessAggregateResult(data)
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -674,6 +689,12 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
|
||||
if options.Verbatim {
|
||||
args = append(args, "VERBATIM")
|
||||
}
|
||||
if options.Scorer != "" {
|
||||
args = append(args, "SCORER", options.Scorer)
|
||||
}
|
||||
if options.AddScores {
|
||||
args = append(args, "ADDSCORES")
|
||||
}
|
||||
if options.LoadAll && options.Load != nil {
|
||||
panic("FT.AGGREGATE: LOADALL and LOAD are mutually exclusive")
|
||||
}
|
||||
@@ -682,16 +703,26 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
|
||||
}
|
||||
if options.Load != nil {
|
||||
args = append(args, "LOAD", len(options.Load))
|
||||
index, count := len(args)-1, 0
|
||||
for _, load := range options.Load {
|
||||
args = append(args, load.Field)
|
||||
count++
|
||||
if load.As != "" {
|
||||
args = append(args, "AS", load.As)
|
||||
count += 2
|
||||
}
|
||||
}
|
||||
args[index] = count
|
||||
}
|
||||
if options.Timeout > 0 {
|
||||
args = append(args, "TIMEOUT", options.Timeout)
|
||||
}
|
||||
for _, apply := range options.Apply {
|
||||
args = append(args, "APPLY", apply.Field)
|
||||
if apply.As != "" {
|
||||
args = append(args, "AS", apply.As)
|
||||
}
|
||||
}
|
||||
if options.GroupBy != nil {
|
||||
for _, groupBy := range options.GroupBy {
|
||||
args = append(args, "GROUPBY", len(groupBy.Fields))
|
||||
@@ -733,17 +764,8 @@ func (c cmdable) FTAggregateWithArgs(ctx context.Context, index string, query st
|
||||
if options.SortByMax > 0 {
|
||||
args = append(args, "MAX", options.SortByMax)
|
||||
}
|
||||
for _, apply := range options.Apply {
|
||||
args = append(args, "APPLY", apply.Field)
|
||||
if apply.As != "" {
|
||||
args = append(args, "AS", apply.As)
|
||||
}
|
||||
}
|
||||
if options.LimitOffset > 0 {
|
||||
args = append(args, "LIMIT", options.LimitOffset)
|
||||
}
|
||||
if options.Limit > 0 {
|
||||
args = append(args, options.Limit)
|
||||
if options.LimitOffset >= 0 && options.Limit > 0 {
|
||||
args = append(args, "LIMIT", options.LimitOffset, options.Limit)
|
||||
}
|
||||
if options.Filter != "" {
|
||||
args = append(args, "FILTER", options.Filter)
|
||||
@@ -1380,7 +1402,7 @@ func (cmd *FTInfoCmd) readReply(rd *proto.Reader) (err error) {
|
||||
}
|
||||
cmd.val, err = parseFTInfo(data)
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -1473,12 +1495,11 @@ func (cmd *FTSpellCheckCmd) RawResult() (interface{}, error) {
|
||||
func (cmd *FTSpellCheckCmd) readReply(rd *proto.Reader) (err error) {
|
||||
data, err := rd.ReadSlice()
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
cmd.val, err = parseFTSpellCheck(data)
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1662,19 +1683,19 @@ func (cmd *FTSearchCmd) RawResult() (interface{}, error) {
|
||||
func (cmd *FTSearchCmd) readReply(rd *proto.Reader) (err error) {
|
||||
data, err := rd.ReadSlice()
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
cmd.val, err = parseFTSearch(data, cmd.options.NoContent, cmd.options.WithScores, cmd.options.WithPayloads, cmd.options.WithSortKeys)
|
||||
if err != nil {
|
||||
cmd.err = err
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FTSearch - Executes a search query on an index.
|
||||
// The 'index' parameter specifies the index to search, and the 'query' parameter specifies the search query.
|
||||
// For more information, please refer to the Redis documentation:
|
||||
// For more information, please refer to the Redis documentation about [FT.SEARCH].
|
||||
//
|
||||
// [FT.SEARCH]: (https://redis.io/commands/ft.search/)
|
||||
func (c cmdable) FTSearch(ctx context.Context, index string, query string) *FTSearchCmd {
|
||||
args := []interface{}{"FT.SEARCH", index, query}
|
||||
@@ -1685,6 +1706,12 @@ func (c cmdable) FTSearch(ctx context.Context, index string, query string) *FTSe
|
||||
|
||||
type SearchQuery []interface{}
|
||||
|
||||
// FTSearchQuery - Executes a search query on an index with additional options.
|
||||
// The 'index' parameter specifies the index to search, the 'query' parameter specifies the search query,
|
||||
// and the 'options' parameter specifies additional options for the search.
|
||||
// For more information, please refer to the Redis documentation about [FT.SEARCH].
|
||||
//
|
||||
// [FT.SEARCH]: (https://redis.io/commands/ft.search/)
|
||||
func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
|
||||
queryArgs := []interface{}{query}
|
||||
if options != nil {
|
||||
@@ -1775,7 +1802,7 @@ func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
|
||||
}
|
||||
}
|
||||
if options.SortByWithCount {
|
||||
queryArgs = append(queryArgs, "WITHCOUT")
|
||||
queryArgs = append(queryArgs, "WITHCOUNT")
|
||||
}
|
||||
}
|
||||
if options.LimitOffset >= 0 && options.Limit > 0 {
|
||||
@@ -1797,7 +1824,8 @@ func FTSearchQuery(query string, options *FTSearchOptions) SearchQuery {
|
||||
// FTSearchWithArgs - Executes a search query on an index with additional options.
|
||||
// The 'index' parameter specifies the index to search, the 'query' parameter specifies the search query,
|
||||
// and the 'options' parameter specifies additional options for the search.
|
||||
// For more information, please refer to the Redis documentation:
|
||||
// For more information, please refer to the Redis documentation about [FT.SEARCH].
|
||||
//
|
||||
// [FT.SEARCH]: (https://redis.io/commands/ft.search/)
|
||||
func (c cmdable) FTSearchWithArgs(ctx context.Context, index string, query string, options *FTSearchOptions) *FTSearchCmd {
|
||||
args := []interface{}{"FT.SEARCH", index, query}
|
||||
@@ -1889,7 +1917,7 @@ func (c cmdable) FTSearchWithArgs(ctx context.Context, index string, query strin
|
||||
}
|
||||
}
|
||||
if options.SortByWithCount {
|
||||
args = append(args, "WITHCOUT")
|
||||
args = append(args, "WITHCOUNT")
|
||||
}
|
||||
}
|
||||
if options.LimitOffset >= 0 && options.Limit > 0 {
|
||||
|
||||
+24
-7
@@ -80,9 +80,20 @@ type FailoverOptions struct {
|
||||
|
||||
TLSConfig *tls.Config
|
||||
|
||||
// DisableIndentity - Disable set-lib on connect.
|
||||
//
|
||||
// default: false
|
||||
//
|
||||
// Deprecated: Use DisableIdentity instead.
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
|
||||
// DisableIdentity is used to disable CLIENT SETINFO command on connect.
|
||||
//
|
||||
// default: false
|
||||
DisableIdentity bool
|
||||
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *FailoverOptions) clientOptions() *Options {
|
||||
@@ -118,9 +129,11 @@ func (opt *FailoverOptions) clientOptions() *Options {
|
||||
|
||||
TLSConfig: opt.TLSConfig,
|
||||
|
||||
DisableIdentity: opt.DisableIdentity,
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,9 +169,11 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {
|
||||
|
||||
TLSConfig: opt.TLSConfig,
|
||||
|
||||
DisableIdentity: opt.DisableIdentity,
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +212,10 @@ func (opt *FailoverOptions) clusterOptions() *ClusterOptions {
|
||||
|
||||
TLSConfig: opt.TLSConfig,
|
||||
|
||||
DisableIdentity: opt.DisableIdentity,
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+20
-5
@@ -61,14 +61,25 @@ type UniversalOptions struct {
|
||||
RouteByLatency bool
|
||||
RouteRandomly bool
|
||||
|
||||
// The sentinel master name.
|
||||
// Only failover clients.
|
||||
|
||||
// MasterName is the sentinel master name.
|
||||
// Only for failover clients.
|
||||
MasterName string
|
||||
|
||||
// DisableIndentity - Disable set-lib on connect.
|
||||
//
|
||||
// default: false
|
||||
//
|
||||
// Deprecated: Use DisableIdentity instead.
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
|
||||
// DisableIdentity is used to disable CLIENT SETINFO command on connect.
|
||||
//
|
||||
// default: false
|
||||
DisableIdentity bool
|
||||
|
||||
IdentitySuffix string
|
||||
UnstableResp3 bool
|
||||
|
||||
}
|
||||
|
||||
// Cluster returns cluster options created from the universal options.
|
||||
@@ -113,8 +124,10 @@ func (o *UniversalOptions) Cluster() *ClusterOptions {
|
||||
|
||||
TLSConfig: o.TLSConfig,
|
||||
|
||||
DisableIdentity: o.DisableIdentity,
|
||||
DisableIndentity: o.DisableIndentity,
|
||||
IdentitySuffix: o.IdentitySuffix,
|
||||
UnstableResp3: o.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,6 +172,7 @@ func (o *UniversalOptions) Failover() *FailoverOptions {
|
||||
|
||||
TLSConfig: o.TLSConfig,
|
||||
|
||||
DisableIdentity: o.DisableIdentity,
|
||||
DisableIndentity: o.DisableIndentity,
|
||||
IdentitySuffix: o.IdentitySuffix,
|
||||
UnstableResp3: o.UnstableResp3,
|
||||
@@ -203,6 +217,7 @@ func (o *UniversalOptions) Simple() *Options {
|
||||
|
||||
TLSConfig: o.TLSConfig,
|
||||
|
||||
DisableIdentity: o.DisableIdentity,
|
||||
DisableIndentity: o.DisableIndentity,
|
||||
IdentitySuffix: o.IdentitySuffix,
|
||||
UnstableResp3: o.UnstableResp3,
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@ package redis
|
||||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "9.7.0"
|
||||
return "9.7.3"
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -167,7 +167,7 @@ github.com/montanaflynn/stats
|
||||
# github.com/pmezard/go-difflib v1.0.0
|
||||
## explicit
|
||||
github.com/pmezard/go-difflib/difflib
|
||||
# github.com/redis/go-redis/v9 v9.7.0
|
||||
# github.com/redis/go-redis/v9 v9.7.3
|
||||
## explicit; go 1.18
|
||||
github.com/redis/go-redis/v9
|
||||
github.com/redis/go-redis/v9/internal
|
||||
|
||||
Reference in New Issue
Block a user