config
This commit is contained in:
parent
9bddb6d020
commit
041c3211bc
@ -1,6 +1,7 @@
|
|||||||
package elasticilm
|
package elasticilm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
// "math"
|
// "math"
|
||||||
"testing"
|
"testing"
|
||||||
@ -46,11 +47,23 @@ func TestEnsureILMPolicy(t *testing.T) {
|
|||||||
results = append(results, row)
|
results = append(results, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打印结果矩阵
|
// 将结果存储为结构化数据
|
||||||
|
resultMap := make(map[string][]map[string]string)
|
||||||
for i, period := range timeFrames {
|
for i, period := range timeFrames {
|
||||||
fmt.Printf("Time Frame: %s\n", period)
|
periodResults := make([]map[string]string, 0)
|
||||||
for j, result := range results[i] {
|
for j, result := range results[i] {
|
||||||
fmt.Printf(" Month: %s - %s\n", startDate.AddDate(0, j, 0).Format("2006-01"), result)
|
month := startDate.AddDate(0, j, 0).Format("2006-01")
|
||||||
|
periodResults = append(periodResults, map[string]string{"Month": month, "Result": result})
|
||||||
}
|
}
|
||||||
|
resultMap[period] = periodResults
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 将结果编码为JSON格式
|
||||||
|
jsonData, err := json.MarshalIndent(resultMap, "", " ")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Failed to encode results to JSON: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打印JSON结果
|
||||||
|
fmt.Println(string(jsonData))
|
||||||
}
|
}
|
||||||
|
4902
elasticilm/warmDay.json
Normal file
4902
elasticilm/warmDay.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user