mirror of https://github.com/go-redis/redis.git
Rename flag to UnstableResp3
This commit is contained in:
parent
7141e19e9e
commit
92ba1d7a28
|
@ -155,7 +155,7 @@ type Options struct {
|
|||
IdentitySuffix string
|
||||
|
||||
// Enable Unstable mode for Redis Search module with RESP3.
|
||||
UnstableResp3SearchModule bool
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *Options) init() {
|
||||
|
|
4
redis.go
4
redis.go
|
@ -415,10 +415,10 @@ func (c *baseClient) process(ctx context.Context, cmd Cmder) error {
|
|||
func (c *baseClient) assertUnstableCommand(cmd Cmder) bool {
|
||||
switch cmd.(type) {
|
||||
case *AggregateCmd, *FTInfoCmd, *FTSpellCheckCmd, *FTSearchCmd, *FTSynDumpCmd:
|
||||
if c.opt.UnstableResp3SearchModule {
|
||||
if c.opt.UnstableResp3 {
|
||||
return true
|
||||
} else {
|
||||
panic("RESP3 responses for this command are disabled because they may still change. Please set the flag UnstableResp3SearchModule . See the [README](https://github.com/redis/go-redis/blob/master/README.md) and the release notes for guidance.")
|
||||
panic("RESP3 responses for this command are disabled because they may still change. Please set the flag UnstableResp3 . See the [README](https://github.com/redis/go-redis/blob/master/README.md) and the release notes for guidance.")
|
||||
}
|
||||
default:
|
||||
return false
|
||||
|
|
4
ring.go
4
ring.go
|
@ -100,7 +100,7 @@ type RingOptions struct {
|
|||
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3SearchModule bool
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *RingOptions) init() {
|
||||
|
@ -169,7 +169,7 @@ func (opt *RingOptions) clientOptions() *Options {
|
|||
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1424,7 +1424,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
var client2 *redis.Client
|
||||
|
||||
BeforeEach(func() {
|
||||
client = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 3, UnstableResp3SearchModule: true})
|
||||
client = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 3, UnstableResp3: true})
|
||||
client2 = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 3})
|
||||
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
@ -1456,7 +1456,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
Expect(results[1].(map[interface{}]interface{})["extra_attributes"].(map[interface{}]interface{})["CreatedDateTimeUTC"]).
|
||||
To(Or(BeEquivalentTo("6373878785249699840"), BeEquivalentTo("6373878758592700416")))
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
options = &redis.FTAggregateOptions{Apply: []redis.FTAggregateApply{{Field: "@CreatedDateTimeUTC * 10", As: "CreatedDateTimeUTC"}}}
|
||||
rawRes, _ := client2.FTAggregateWithArgs(ctx, "idx1", "*", options).RawResult()
|
||||
|
@ -1484,7 +1484,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
flags = attributes[0].(map[interface{}]interface{})["flags"].([]interface{})
|
||||
Expect(flags).To(ConsistOf("SORTABLE", "NOSTEM"))
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
rawResInfo, _ := client2.FTInfo(ctx, "idx1").RawResult()
|
||||
rawValInfo := client2.FTInfo(ctx, "idx1").RawVal()
|
||||
|
@ -1511,7 +1511,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
results := resSpellCheck.(map[interface{}]interface{})["results"].(map[interface{}]interface{})
|
||||
Expect(results["impornant"].([]interface{})[0].(map[interface{}]interface{})["important"]).To(BeEquivalentTo(0.5))
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
rawResSpellCheck, _ := client2.FTSpellCheck(ctx, "idx1", "impornant").RawResult()
|
||||
rawValSpellCheck := client2.FTSpellCheck(ctx, "idx1", "impornant").RawVal()
|
||||
|
@ -1538,7 +1538,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
totalResults2 := res2.(map[interface{}]interface{})["total_results"]
|
||||
Expect(totalResults2).To(BeEquivalentTo(int64(1)))
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
rawRes2, _ := client2.FTSearchWithArgs(ctx, "txt", "foo bar hello world", &redis.FTSearchOptions{NoContent: true}).RawResult()
|
||||
rawVal2 := client2.FTSearchWithArgs(ctx, "txt", "foo bar hello world", &redis.FTSearchOptions{NoContent: true}).RawVal()
|
||||
|
@ -1572,7 +1572,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
Expect(valSynDump).To(BeEquivalentTo(resSynDump))
|
||||
Expect(resSynDump.(map[interface{}]interface{})["baby"]).To(BeEquivalentTo([]interface{}{"id1"}))
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
rawResSynDump, _ := client2.FTSynDump(ctx, "idx1").RawResult()
|
||||
rawValSynDump := client2.FTSynDump(ctx, "idx1").RawVal()
|
||||
|
@ -1593,7 +1593,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
|||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(res1).ToNot(BeEmpty())
|
||||
|
||||
// Test with UnstableResp3SearchModule false
|
||||
// Test with UnstableResp3 false
|
||||
Expect(func() {
|
||||
res2, err := client2.FTExplain(ctx, "txt", "@f3:f3_val @f2:f2_val @f1:f1_val").Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
|
|
@ -82,7 +82,7 @@ type FailoverOptions struct {
|
|||
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3SearchModule bool
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
func (opt *FailoverOptions) clientOptions() *Options {
|
||||
|
@ -120,7 +120,7 @@ func (opt *FailoverOptions) clientOptions() *Options {
|
|||
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {
|
|||
|
||||
DisableIndentity: opt.DisableIndentity,
|
||||
IdentitySuffix: opt.IdentitySuffix,
|
||||
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
|
||||
UnstableResp3: opt.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ type UniversalOptions struct {
|
|||
|
||||
DisableIndentity bool
|
||||
IdentitySuffix string
|
||||
UnstableResp3SearchModule bool
|
||||
UnstableResp3 bool
|
||||
}
|
||||
|
||||
// Cluster returns cluster options created from the universal options.
|
||||
|
@ -161,7 +161,7 @@ func (o *UniversalOptions) Failover() *FailoverOptions {
|
|||
|
||||
DisableIndentity: o.DisableIndentity,
|
||||
IdentitySuffix: o.IdentitySuffix,
|
||||
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
|
||||
UnstableResp3: o.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ func (o *UniversalOptions) Simple() *Options {
|
|||
|
||||
DisableIndentity: o.DisableIndentity,
|
||||
IdentitySuffix: o.IdentitySuffix,
|
||||
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
|
||||
UnstableResp3: o.UnstableResp3,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue