Skip to content

Commit

Permalink
add cluster example
Browse files Browse the repository at this point in the history
Signed-off-by: TJ Zhang <tj.zhang@improving.com>
  • Loading branch information
TJ Zhang committed Feb 13, 2025
1 parent 62dc2fc commit 04060d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions go/api/sorted_set_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 04060d8

Please sign in to comment.