From 92ba1d7a28e12bf8b0bbc0d04387a5cdde9e6640 Mon Sep 17 00:00:00 2001 From: vladvildanov Date: Thu, 12 Sep 2024 10:35:07 +0300 Subject: [PATCH] Rename flag to UnstableResp3 --- options.go | 2 +- redis.go | 4 ++-- ring.go | 12 ++++++------ search_test.go | 14 +++++++------- sentinel.go | 18 +++++++++--------- universal.go | 18 +++++++++--------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/options.go b/options.go index f7fd4c16..8ba74ccd 100644 --- a/options.go +++ b/options.go @@ -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() { diff --git a/redis.go b/redis.go index c5e2e698..c8b50080 100644 --- a/redis.go +++ b/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 diff --git a/ring.go b/ring.go index 5768e90b..b4022173 100644 --- a/ring.go +++ b/ring.go @@ -98,9 +98,9 @@ type RingOptions struct { TLSConfig *tls.Config Limiter Limiter - DisableIndentity bool - IdentitySuffix string - UnstableResp3SearchModule bool + DisableIndentity bool + IdentitySuffix string + UnstableResp3 bool } func (opt *RingOptions) init() { @@ -167,9 +167,9 @@ func (opt *RingOptions) clientOptions() *Options { TLSConfig: opt.TLSConfig, Limiter: opt.Limiter, - DisableIndentity: opt.DisableIndentity, - IdentitySuffix: opt.IdentitySuffix, - UnstableResp3SearchModule: opt.UnstableResp3SearchModule, + DisableIndentity: opt.DisableIndentity, + IdentitySuffix: opt.IdentitySuffix, + UnstableResp3: opt.UnstableResp3, } } diff --git a/search_test.go b/search_test.go index b4617a54..93859a4e 100644 --- a/search_test.go +++ b/search_test.go @@ -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()) diff --git a/sentinel.go b/sentinel.go index 925d7606..31569554 100644 --- a/sentinel.go +++ b/sentinel.go @@ -80,9 +80,9 @@ type FailoverOptions struct { TLSConfig *tls.Config - DisableIndentity bool - IdentitySuffix string - UnstableResp3SearchModule bool + DisableIndentity bool + IdentitySuffix string + UnstableResp3 bool } func (opt *FailoverOptions) clientOptions() *Options { @@ -118,9 +118,9 @@ func (opt *FailoverOptions) clientOptions() *Options { TLSConfig: opt.TLSConfig, - DisableIndentity: opt.DisableIndentity, - IdentitySuffix: opt.IdentitySuffix, - UnstableResp3SearchModule: opt.UnstableResp3SearchModule, + DisableIndentity: opt.DisableIndentity, + IdentitySuffix: opt.IdentitySuffix, + UnstableResp3: opt.UnstableResp3, } } @@ -156,9 +156,9 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options { TLSConfig: opt.TLSConfig, - DisableIndentity: opt.DisableIndentity, - IdentitySuffix: opt.IdentitySuffix, - UnstableResp3SearchModule: opt.UnstableResp3SearchModule, + DisableIndentity: opt.DisableIndentity, + IdentitySuffix: opt.IdentitySuffix, + UnstableResp3: opt.UnstableResp3, } } diff --git a/universal.go b/universal.go index eae365e5..f4d2d759 100644 --- a/universal.go +++ b/universal.go @@ -66,9 +66,9 @@ type UniversalOptions struct { MasterName string - DisableIndentity bool - IdentitySuffix string - UnstableResp3SearchModule bool + DisableIndentity bool + IdentitySuffix string + UnstableResp3 bool } // Cluster returns cluster options created from the universal options. @@ -159,9 +159,9 @@ func (o *UniversalOptions) Failover() *FailoverOptions { TLSConfig: o.TLSConfig, - DisableIndentity: o.DisableIndentity, - IdentitySuffix: o.IdentitySuffix, - UnstableResp3SearchModule: o.UnstableResp3SearchModule, + DisableIndentity: o.DisableIndentity, + IdentitySuffix: o.IdentitySuffix, + UnstableResp3: o.UnstableResp3, } } @@ -203,9 +203,9 @@ func (o *UniversalOptions) Simple() *Options { TLSConfig: o.TLSConfig, - DisableIndentity: o.DisableIndentity, - IdentitySuffix: o.IdentitySuffix, - UnstableResp3SearchModule: o.UnstableResp3SearchModule, + DisableIndentity: o.DisableIndentity, + IdentitySuffix: o.IdentitySuffix, + UnstableResp3: o.UnstableResp3, } }