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

Function MSet

command/strings.go:142–155  ·  view source on GitHub ↗

MSet sets the given keys to their respective values

(ctx *Context, txn *db.Transaction)

Source from the content-addressed store, hash-verified

140
141// MSet sets the given keys to their respective values
142func MSet(ctx *Context, txn *db.Transaction) (OnCommit, error) {
143 argc := len(ctx.Args)
144 args := ctx.Args
145 if argc%2 != 0 {
146 return nil, ErrMSet
147 }
148 for i := 2; i <= argc; i += 2 {
149 ctx.Args = args[i-2 : i]
150 if _, err := Set(ctx, txn); err != nil {
151 return nil, err
152 }
153 }
154 return SimpleString(ctx.Out, OK), nil
155}
156
157// MSetNx et multiple keys to multiple values,only if none of the keys exist
158//TODO bug

Callers

nothing calls this directly

Calls 2

SimpleStringFunction · 0.85
SetFunction · 0.70

Tested by

no test coverage detected