Skip to main content

ZRANK

Syntax​

ZRANK key member [WITHSCORE]

Module​

sortedset

Categories​

read slow sortedset

Description​

Returns the rank of the specified member in the sorted set. WITHSCORE modifies the result to also return the score.

Options​

  • WITHSCORE - Determines whether to return the score along with the member value.

Examples​

Get the rank of the specified member in the sorted set:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
member, err := db.ZRank("key", "member", true)