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

Method SCard

internal/data/set.go:109–115  ·  view source on GitHub ↗

SCard Returns the set cardinality (number of elements) of the set stored at key.

(key string)

Source from the content-addressed store, hash-verified

107
108// SCard Returns the set cardinality (number of elements) of the set stored at key.
109func (s *Set) SCard(key string) int {
110 if !s.SHasKey(key) {
111 return 0
112 }
113
114 return len(s.M[key])
115}
116
117// SDiff Returns the members of the set resulting from the difference between the first set and all the successive sets.
118func (s *Set) SDiff(key1, key2 string) ([]*core.Record, error) {

Callers 1

TestSet_SCardFunction · 0.45

Calls 1

SHasKeyMethod · 0.95

Tested by 1

TestSet_SCardFunction · 0.36