forked from abhishekkr/goshare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdbtasks_get.go
37 lines (29 loc) · 886 Bytes
/
dbtasks_get.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
package goshare
import (
golhashmap "github.com/abhishekkr/gol/golhashmap"
levigoNS "github.com/abhishekkr/levigoNS"
abkleveldb "github.com/abhishekkr/levigoNS/leveldb"
levigoTSDS "github.com/abhishekkr/levigoTSDS"
)
/* Get value of given key */
func GetVal(key string) string {
return abkleveldb.GetVal(key, db)
}
/* Get value for all descendents of Namespace */
func GetValNS(key string) string {
hashmap := levigoNS.ReadNSRecursive(key, db)
return golhashmap.Hashmap_to_csv(hashmap)
}
/* Get value for the asked time-frame key, aah same NS */
func GetValTSDS(key string) string {
return golhashmap.Hashmap_to_csv(levigoTSDS.ReadTSDS(key, db))
}
/* Get a value based on task-type */
func GetValTask(task_type string, key string) string {
if task_type == "tsds" {
return GetValTSDS(key)
} else if task_type == "ns" {
return GetValNS(key)
}
return GetVal(key)
}