The ZCard function returns the size of the dictionary of the sorted set stored at key in the database. It takes a string key as an argument.
(key string)
| 850 | // The ZCard function returns the size of the dictionary of the sorted set stored at key in the database. |
| 851 | // It takes a string key as an argument. |
| 852 | func (zs *ZSetStructure) ZCard(key string) (int, error) { |
| 853 | if err := checkKey(key); err != nil { |
| 854 | return 0, err |
| 855 | } |
| 856 | keyBytes := stringToBytesWithKey(key) |
| 857 | |
| 858 | zSet, err := zs.getZSetFromDB(keyBytes) |
| 859 | if err != nil { |
| 860 | return 0, err |
| 861 | } |
| 862 | // get the size of the dictionary |
| 863 | return zSet.size, nil |
| 864 | } |
| 865 | |
| 866 | // ZIncrBy increases the score of an existing member in a sorted set stored at specified key by |
| 867 | // the increment `incBy` provided. If member does not exist, ErrKeyNotFound error is returned. |
nothing calls this directly
no test coverage detected