//存储堆排序结果 func StoreSortingResult(h *sorting.Heap, taskId string) { for h.Len() > 0 { element := heap.Pop(h).(sorting.Element) b, err := json.Marshal(element) if err != nil { logs.Log("json marshal error in StoreValueTypeStat : " + err.Error()) return } dbutil.Store(string(b), "2", taskId) } }
func StoreValueLengthFilter(list *list.List, fileId string) { for e := list.Front(); e != nil; e = e.Next() { str, ok := e.Value.(string) if ok { dbutil.Store(str, "2", fileId) } else { logs.Log("list element error in StoreValueLengthFilter list element is not string!") continue } } }
func StoreValueTypeStat(resultMap map[string]int, fileId string) { for k, v := range resultMap { var value ValueTypeStat value.ValueType = k value.Num = v b, err := json.Marshal(value) if err != nil { logs.Log("json marshal error in StoreValueTypeStat : " + err.Error()) return } dbutil.Store(string(b), "1", fileId) } }
//输出过滤的key func StoreKeyFiltResult(keyMap map[string]int, taskId string) { for key, valueL := range keyMap { var value ValueLengthFilterData value.Key = key value.ValueLength = valueL b, err := json.Marshal(value) if err != nil { logs.Log("json marshal error in valueLengthFilter : " + err.Error()) continue } dbutil.Store(string(b), "3", taskId) } }