MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / SRem

Method SRem

internal/data/set.go:65–84  ·  view source on GitHub ↗

SRem removes the specified members from the set stored at key.

(key string, values ...[]byte)

Source from the content-addressed store, hash-verified

63
64// SRem removes the specified members from the set stored at key.
65func (s *Set) SRem(key string, values ...[]byte) error {
66 set, ok := s.M[key]
67 if !ok {
68 return ErrSetNotExist
69 }
70
71 if len(values) == 0 || values[0] == nil {
72 return ErrMemberEmpty
73 }
74
75 for _, value := range values {
76 hash, err := utils.GetFnv32(value)
77 if err != nil {
78 return err
79 }
80 delete(set, hash)
81 }
82
83 return nil
84}
85
86// SHasKey returns whether it has the set at given key.
87func (s *Set) SHasKey(key string) bool {

Callers 2

SMoveMethod · 0.95
TestSet_SRemFunction · 0.95

Calls 2

GetFnv32Function · 0.92
deleteFunction · 0.85

Tested by 1

TestSet_SRemFunction · 0.76