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
|
IdentitySuffix string
|
||||||
|
|
||||||
// Enable Unstable mode for Redis Search module with RESP3.
|
// Enable Unstable mode for Redis Search module with RESP3.
|
||||||
UnstableResp3SearchModule bool
|
UnstableResp3 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opt *Options) init() {
|
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 {
|
func (c *baseClient) assertUnstableCommand(cmd Cmder) bool {
|
||||||
switch cmd.(type) {
|
switch cmd.(type) {
|
||||||
case *AggregateCmd, *FTInfoCmd, *FTSpellCheckCmd, *FTSearchCmd, *FTSynDumpCmd:
|
case *AggregateCmd, *FTInfoCmd, *FTSpellCheckCmd, *FTSearchCmd, *FTSynDumpCmd:
|
||||||
if c.opt.UnstableResp3SearchModule {
|
if c.opt.UnstableResp3 {
|
||||||
return true
|
return true
|
||||||
} else {
|
} 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:
|
default:
|
||||||
return false
|
return false
|
||||||
|
|
4
ring.go
4
ring.go
|
@ -100,7 +100,7 @@ type RingOptions struct {
|
||||||
|
|
||||||
DisableIndentity bool
|
DisableIndentity bool
|
||||||
IdentitySuffix string
|
IdentitySuffix string
|
||||||
UnstableResp3SearchModule bool
|
UnstableResp3 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opt *RingOptions) init() {
|
func (opt *RingOptions) init() {
|
||||||
|
@ -169,7 +169,7 @@ func (opt *RingOptions) clientOptions() *Options {
|
||||||
|
|
||||||
DisableIndentity: opt.DisableIndentity,
|
DisableIndentity: opt.DisableIndentity,
|
||||||
IdentitySuffix: opt.IdentitySuffix,
|
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
|
var client2 *redis.Client
|
||||||
|
|
||||||
BeforeEach(func() {
|
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})
|
client2 = redis.NewClient(&redis.Options{Addr: ":6379", Protocol: 3})
|
||||||
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
|
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"]).
|
Expect(results[1].(map[interface{}]interface{})["extra_attributes"].(map[interface{}]interface{})["CreatedDateTimeUTC"]).
|
||||||
To(Or(BeEquivalentTo("6373878785249699840"), BeEquivalentTo("6373878758592700416")))
|
To(Or(BeEquivalentTo("6373878785249699840"), BeEquivalentTo("6373878758592700416")))
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
options = &redis.FTAggregateOptions{Apply: []redis.FTAggregateApply{{Field: "@CreatedDateTimeUTC * 10", As: "CreatedDateTimeUTC"}}}
|
options = &redis.FTAggregateOptions{Apply: []redis.FTAggregateApply{{Field: "@CreatedDateTimeUTC * 10", As: "CreatedDateTimeUTC"}}}
|
||||||
rawRes, _ := client2.FTAggregateWithArgs(ctx, "idx1", "*", options).RawResult()
|
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{})
|
flags = attributes[0].(map[interface{}]interface{})["flags"].([]interface{})
|
||||||
Expect(flags).To(ConsistOf("SORTABLE", "NOSTEM"))
|
Expect(flags).To(ConsistOf("SORTABLE", "NOSTEM"))
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
rawResInfo, _ := client2.FTInfo(ctx, "idx1").RawResult()
|
rawResInfo, _ := client2.FTInfo(ctx, "idx1").RawResult()
|
||||||
rawValInfo := client2.FTInfo(ctx, "idx1").RawVal()
|
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{})
|
results := resSpellCheck.(map[interface{}]interface{})["results"].(map[interface{}]interface{})
|
||||||
Expect(results["impornant"].([]interface{})[0].(map[interface{}]interface{})["important"]).To(BeEquivalentTo(0.5))
|
Expect(results["impornant"].([]interface{})[0].(map[interface{}]interface{})["important"]).To(BeEquivalentTo(0.5))
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
rawResSpellCheck, _ := client2.FTSpellCheck(ctx, "idx1", "impornant").RawResult()
|
rawResSpellCheck, _ := client2.FTSpellCheck(ctx, "idx1", "impornant").RawResult()
|
||||||
rawValSpellCheck := client2.FTSpellCheck(ctx, "idx1", "impornant").RawVal()
|
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"]
|
totalResults2 := res2.(map[interface{}]interface{})["total_results"]
|
||||||
Expect(totalResults2).To(BeEquivalentTo(int64(1)))
|
Expect(totalResults2).To(BeEquivalentTo(int64(1)))
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
rawRes2, _ := client2.FTSearchWithArgs(ctx, "txt", "foo bar hello world", &redis.FTSearchOptions{NoContent: true}).RawResult()
|
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()
|
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(valSynDump).To(BeEquivalentTo(resSynDump))
|
||||||
Expect(resSynDump.(map[interface{}]interface{})["baby"]).To(BeEquivalentTo([]interface{}{"id1"}))
|
Expect(resSynDump.(map[interface{}]interface{})["baby"]).To(BeEquivalentTo([]interface{}{"id1"}))
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
rawResSynDump, _ := client2.FTSynDump(ctx, "idx1").RawResult()
|
rawResSynDump, _ := client2.FTSynDump(ctx, "idx1").RawResult()
|
||||||
rawValSynDump := client2.FTSynDump(ctx, "idx1").RawVal()
|
rawValSynDump := client2.FTSynDump(ctx, "idx1").RawVal()
|
||||||
|
@ -1593,7 +1593,7 @@ var _ = Describe("RediSearch commands Resp 3", Label("search"), func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(res1).ToNot(BeEmpty())
|
Expect(res1).ToNot(BeEmpty())
|
||||||
|
|
||||||
// Test with UnstableResp3SearchModule false
|
// Test with UnstableResp3 false
|
||||||
Expect(func() {
|
Expect(func() {
|
||||||
res2, err := client2.FTExplain(ctx, "txt", "@f3:f3_val @f2:f2_val @f1:f1_val").Result()
|
res2, err := client2.FTExplain(ctx, "txt", "@f3:f3_val @f2:f2_val @f1:f1_val").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
|
@ -82,7 +82,7 @@ type FailoverOptions struct {
|
||||||
|
|
||||||
DisableIndentity bool
|
DisableIndentity bool
|
||||||
IdentitySuffix string
|
IdentitySuffix string
|
||||||
UnstableResp3SearchModule bool
|
UnstableResp3 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opt *FailoverOptions) clientOptions() *Options {
|
func (opt *FailoverOptions) clientOptions() *Options {
|
||||||
|
@ -120,7 +120,7 @@ func (opt *FailoverOptions) clientOptions() *Options {
|
||||||
|
|
||||||
DisableIndentity: opt.DisableIndentity,
|
DisableIndentity: opt.DisableIndentity,
|
||||||
IdentitySuffix: opt.IdentitySuffix,
|
IdentitySuffix: opt.IdentitySuffix,
|
||||||
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
|
UnstableResp3: opt.UnstableResp3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ func (opt *FailoverOptions) sentinelOptions(addr string) *Options {
|
||||||
|
|
||||||
DisableIndentity: opt.DisableIndentity,
|
DisableIndentity: opt.DisableIndentity,
|
||||||
IdentitySuffix: opt.IdentitySuffix,
|
IdentitySuffix: opt.IdentitySuffix,
|
||||||
UnstableResp3SearchModule: opt.UnstableResp3SearchModule,
|
UnstableResp3: opt.UnstableResp3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ type UniversalOptions struct {
|
||||||
|
|
||||||
DisableIndentity bool
|
DisableIndentity bool
|
||||||
IdentitySuffix string
|
IdentitySuffix string
|
||||||
UnstableResp3SearchModule bool
|
UnstableResp3 bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cluster returns cluster options created from the universal options.
|
// Cluster returns cluster options created from the universal options.
|
||||||
|
@ -161,7 +161,7 @@ func (o *UniversalOptions) Failover() *FailoverOptions {
|
||||||
|
|
||||||
DisableIndentity: o.DisableIndentity,
|
DisableIndentity: o.DisableIndentity,
|
||||||
IdentitySuffix: o.IdentitySuffix,
|
IdentitySuffix: o.IdentitySuffix,
|
||||||
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
|
UnstableResp3: o.UnstableResp3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ func (o *UniversalOptions) Simple() *Options {
|
||||||
|
|
||||||
DisableIndentity: o.DisableIndentity,
|
DisableIndentity: o.DisableIndentity,
|
||||||
IdentitySuffix: o.IdentitySuffix,
|
IdentitySuffix: o.IdentitySuffix,
|
||||||
UnstableResp3SearchModule: o.UnstableResp3SearchModule,
|
UnstableResp3: o.UnstableResp3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue