SMembers returns all the members of the set value stored at key
(ctx *Context, txn *db.Transaction)
| 32 | |
| 33 | // SMembers returns all the members of the set value stored at key |
| 34 | func 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 |
| 51 | func SCard(ctx *Context, txn *db.Transaction) (OnCommit, error) { |
nothing calls this directly
no test coverage detected