MGet returns the values of all specified key
(ctx *Context, txn *db.Transaction)
| 116 | |
| 117 | // MGet returns the values of all specified key |
| 118 | func MGet(ctx *Context, txn *db.Transaction) (OnCommit, error) { |
| 119 | count := len(ctx.Args) |
| 120 | values := make([][]byte, count) |
| 121 | |
| 122 | keys := make([][]byte, count) |
| 123 | for i := range ctx.Args { |
| 124 | keys[i] = []byte(ctx.Args[i]) |
| 125 | } |
| 126 | |
| 127 | strs, err := txn.Strings(keys) |
| 128 | if err != nil { |
| 129 | return nil, errors.New("ERR " + err.Error()) |
| 130 | } |
| 131 | for i, str := range strs { |
| 132 | if str == nil || !str.Exist() { |
| 133 | values[i] = nil |
| 134 | continue |
| 135 | } |
| 136 | values[i], _ = str.Get() |
| 137 | } |
| 138 | return BytesArray(ctx.Out, values), nil |
| 139 | } |
| 140 | |
| 141 | // MSet sets the given keys to their respective values |
| 142 | func MSet(ctx *Context, txn *db.Transaction) (OnCommit, error) { |
nothing calls this directly
no test coverage detected