MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / SMembers

Method SMembers

structure/set.go:105–118  ·  view source on GitHub ↗

SMembers gets all members of a set identified by the provided key. If the set does not exist or the key belongs to a different data type, the function will return an error. It returns a slice of strings which are the members of the set.

(key string)

Source from the content-addressed store, hash-verified

103// the function will return an error.
104// It returns a slice of strings which are the members of the set.
105func (s *SetStructure) SMembers(key string) ([]string, error) {
106 fs, err := s.checkAndGetSet(key, false)
107 if err != nil {
108 return nil, err
109 }
110 // type of fs is map[string]struct{}
111 // we need to take the keys and make them a slice
112 var members []string
113 for k := range *fs {
114 members = append(members, k)
115 }
116
117 return members, nil
118}
119
120// SIsMember checks if a member exists in a set
121func (s *SetStructure) SIsMember(key, member string) (bool, error) {

Callers 1

SizeMethod · 0.95

Calls 1

checkAndGetSetMethod · 0.95

Tested by

no test coverage detected