MCPcopy Create free account
hub / github.com/distributedio/titan / SMembers

Function SMembers

command/sets.go:34–48  ·  view source on GitHub ↗

SMembers returns all the members of the set value stored at key

(ctx *Context, txn *db.Transaction)

Source from the content-addressed store, hash-verified

32
33// SMembers returns all the members of the set value stored at key
34func SMembers(ctx *Context, txn *db.Transaction) (OnCommit, error) {
35 key := []byte(ctx.Args[0])
36 set, err := txn.Set(key)
37 if err != nil {
38 if err == db.ErrTypeMismatch {
39 return nil, ErrTypeMismatch
40 }
41 return nil, errors.New("ERR " + err.Error())
42 }
43 members, err := set.SMembers()
44 if err != nil {
45 return nil, errors.New("ERR " + err.Error())
46 }
47 return BytesArray(ctx.Out, members), nil
48}
49
50// SCard returns the set cardinality (number of elements) of the set stored at key
51func SCard(ctx *Context, txn *db.Transaction) (OnCommit, error) {

Callers

nothing calls this directly

Calls 4

BytesArrayFunction · 0.85
SMembersMethod · 0.80
SetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected