MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / ZCard

Method ZCard

structure/zset.go:852–864  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
852func (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.

Callers

nothing calls this directly

Calls 3

getZSetFromDBMethod · 0.95
checkKeyFunction · 0.85
stringToBytesWithKeyFunction · 0.85

Tested by

no test coverage detected