-
Notifications
You must be signed in to change notification settings - Fork 0
/
execute.go.bkp
35 lines (33 loc) · 964 Bytes
/
execute.go.bkp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package sider
func Execute(instructions ...string) (interface{}, error) {
var instruction = instructions[0]
switch {
case instruction == "LPUSH":
var key string = instructions[1]
var values = instructions[2:]
case instruction == "LPOP":
var key string = instructions[1]
var value = instructions[2]
case instruction == "RPUSH":
var key string = instructions[1]
var values = instructions[2:]
case instruction == "RPOP":
var key string = instructions[1]
var value = instructions[2]
case instruction == "SET":
var key string = instructions[1]
var value = instructions[2]
var expire = instructions[3]
case instruction == "GET":
var key string = instructions[1]
var value = instructions[2]
case instruction == "GETDEL":
var key string = instructions[1]
var value = instructions[2]
case instruction == "LRANGE":
var key string = instructions[1]
var start = instructions[2]
var stop = instructions[2]
}
return false, nil
}