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)
| 600 | // |
| 601 | // The function will return an error if it fails at any point, if not it will return nil indicating a successful operation. |
| 602 | func (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 |
| 622 | func (zs *ZSetStructure) ZScore(key string, member string) (int, error) { |
nothing calls this directly
no test coverage detected