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

Function cmdHGET

hashes.go:53–71  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

51}
52
53func cmdHGET(m uhaha.Machine, args []string) (interface{}, error) {
54 if len(args) != 3 {
55 return nil, uhaha.ErrWrongNumArgs
56 }
57 val, err := ldb.HGet([]byte(args[1]), []byte(args[2]))
58
59 if err != nil {
60 if err == leveldb.ErrNotFound {
61 return nil, nil
62 }
63 return nil, err
64 }
65
66 // A missing field yields a nil slice; a field holding an empty value yields
67 // an empty one and must stay an empty bulk string rather than a nil reply.
68 if val == nil {
69 return nil, nil
70 }
71
72 return val, nil
73}
74

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected