forked from abhishekkr/goshare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbtasks.go
40 lines (32 loc) · 848 Bytes
/
dbtasks.go
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
36
37
38
39
40
package goshare
/*
[PATTERN]
action {read, push, delete}
type {default, ns, tsds, now}
## message_array here is devoided of axn and key_type
non-tsds {key&val, :type-data}
tsds(-*) {tdot&key&val, tdot&:type-data}
*/
// gotta refactor more and make this front for these tasks
func DBTasks(axn string, key_type string, message_array []string) ([]byte, bool) {
response := ""
axn_status := false
key := message_array[0]
switch axn {
case "read":
// returns axn error if key has empty value, if you gotta store then store, don't keep placeholders
response = GetValTask(key_type, key)
if response != "" {
axn_status = true
}
case "push":
if PushKeyValByType(key_type, message_array) {
axn_status = true
}
case "delete":
if DelKeyTask(key_type, key) {
axn_status = true
}
}
return []byte(response), axn_status
}