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

Function cmdHMSET

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

Source from the content-addressed store, hash-verified

188
189 return v, nil
190}
191
192func cmdHMSET(m uhaha.Machine, args []string) (interface{}, error) {
193 if len(args) < 3 {
194 return nil, uhaha.ErrWrongNumArgs
195 }
196
197 if len(args[2:])%2 != 0 {
198 return nil, uhaha.ErrWrongNumArgs
199 }
200
201 key := args[1]
202
203 args = args[2:]
204
205 kvs := make([]ledis.FVPair, len(args)/2)
206 for i := 0; i < len(kvs); i++ {
207 kvs[i].Field = []byte(args[2*i])
208 kvs[i].Value = []byte(args[2*i+1])
209 }
210
211 if err := ldb.HMset([]byte(key), kvs...); err != nil {
212 return nil, err
213 }
214
215 return redcon.SimpleString("OK"), nil
216}
217

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected