From 04060d8ce156170f932c0d9f89a68844c6d22378 Mon Sep 17 00:00:00 2001 From: TJ Zhang Date: Wed, 12 Feb 2025 16:47:01 -0800 Subject: [PATCH] add cluster example Signed-off-by: TJ Zhang --- go/api/sorted_set_commands_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/go/api/sorted_set_commands_test.go b/go/api/sorted_set_commands_test.go index 8438edd153..10ccc85b17 100644 --- a/go/api/sorted_set_commands_test.go +++ b/go/api/sorted_set_commands_test.go @@ -546,3 +546,23 @@ func ExampleGlideClient_ZLexCount() { // Output: // 2 } + +func ExampleGlideClusterClient_ZLexCount() { + var client *GlideClusterClient = getExampleGlideClusterClient() // example helper function + + client.ZAdd("key1", map[string]float64{"a": 1.0, "b": 2.0, "c": 3.0, "d": 4.0}) + + result, err := client.ZLexCount("key1", + options.NewRangeByLexQuery( + options.NewLexBoundary("a", false), + options.NewLexBoundary("c", true), + ), + ) + if err != nil { + fmt.Println("Glide example failed with an error: ", err) + } + fmt.Println(result) + + // Output: + // 2 +}