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

Method ZRems

structure/zset.go:602–619  ·  view source on GitHub ↗

ZRems method removes one or more specified members from the sorted set that's stored under the provided key. Params: - key string: the identifier for storing the sorted set in the database. - member ...string: a variadic parameter where each argument is a member string to remove. Returns: error Th

(key string, member ...string)

Source from the content-addressed store, hash-verified

600//
601// The function will return an error if it fails at any point, if not it will return nil indicating a successful operation.
602func (zs *ZSetStructure) ZRems(key string, member ...string) error {
603 if err := checkKey(key); err != nil {
604 return err
605 }
606 keyBytes := stringToBytesWithKey(key)
607
608 zSet, err := zs.getZSetFromDB(keyBytes)
609
610 if err != nil {
611 return fmt.Errorf("failed to get or create ZSet from DB with key '%v': %w", key, err)
612 }
613 for _, s := range member {
614 if err = zSet.RemoveNode(s); err != nil {
615 return err
616 }
617 }
618 return zs.setZSetToDB(keyBytes, zSet)
619}
620
621// ZScore method retrieves the score associated with the member in a sorted set stored at the key
622func (zs *ZSetStructure) ZScore(key string, member string) (int, error) {

Callers

nothing calls this directly

Calls 5

getZSetFromDBMethod · 0.95
setZSetToDBMethod · 0.95
checkKeyFunction · 0.85
stringToBytesWithKeyFunction · 0.85
RemoveNodeMethod · 0.80

Tested by

no test coverage detected