-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdbtasks_del.go
54 lines (45 loc) · 998 Bytes
/
dbtasks_del.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package goshare
/*
DelKey deletes val for a given key, returns status.
*/
func DelKey(key string) bool {
return tsds.DelKey(key)
}
/*
DelKeyNS deletes given key's namespace and all its values, returns status.
*/
func DelKeyNS(key string) bool {
return tsds.DeleteNSRecursive(key)
}
/*
DelKeyTSDS deletes all keys under given namespace, same as NS.
As here TimeSeries is a NameSpace
*/
func DelKeyTSDS(key string) bool {
return tsds.DeleteTSDS(key)
}
/*
DeleteFuncByKeyType calls a delete action for a key based on task-type.
*/
func DeleteFuncByKeyType(keyType string) FunkAxnParamKey {
switch keyType {
case "tsds":
return DelKeyTSDS
case "ns":
return DelKeyNS
default:
return DelKey
}
}
/*
DeleteFromPacket can handle multi-keys delete action,
it acts on packet data.
*/
func DeleteFromPacket(packet Packet) bool {
status := true
axnFunk := DeleteFuncByKeyType(packet.KeyType)
for _, _key := range packet.KeyList {
status = status && axnFunk(_key)
}
return status
}