MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / soptGeneric

Function soptGeneric

set.go:40–59  ·  view source on GitHub ↗
(args [][]byte, optType byte)

Source from the content-addressed store, hash-verified

38
39func cmdSADD(m uhaha.Machine, args []string) (interface{}, error) {
40 if len(args) < 3 {
41 return nil, uhaha.ErrWrongNumArgs
42 }
43 n, err := ldb.SAdd([]byte(args[1]), stringSliceToBytes(args[2:])...)
44 return redcon.SimpleInt(n), err
45}
46
47func soptGeneric(args [][]byte, optType byte) ([][]byte, error) {
48 if len(args) < 2 {
49 return nil, uhaha.ErrWrongNumArgs
50 }
51
52 var v [][]byte
53 var err error
54 switch optType {
55 case ledis.UnionType:
56 v, err = ldb.SUnion(args[1:]...)
57 case ledis.DiffType:
58 v, err = ldb.SDiff(args[1:]...)
59 case ledis.InterType:
60 v, err = ldb.SInter(args[1:]...)
61 }
62 if err != nil {

Callers 3

cmdSDIFFFunction · 0.85
cmdSINTERFunction · 0.85
cmdSUNIONFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected