MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / formatFilter

Function formatFilter

module/monitor/driver/influxdb-v2/util.go:70–86  ·  view source on GitHub ↗
(wheres []monitor.MonWhereItem)

Source from the content-addressed store, hash-verified

68}
69
70func formatFilter(wheres []monitor.MonWhereItem) string {
71 filter := ``
72 if len(wheres) > 0 {
73 filters := make([]string, 0, len(wheres))
74 for _, where := range wheres {
75 if len(where.Values) > 0 {
76 wl := make([]string, 0, len(where.Values))
77 for _, v := range where.Values {
78 wl = append(wl, fmt.Sprintf(fmt.Sprintf(`r["%s"] == "%s"`, where.Key, v)))
79 }
80 filters = append(filters, fmt.Sprint("(", strings.Join(wl, " or "), ")"))
81 }
82 }
83 filter = fmt.Sprint(`|> filter(fn:(r)=>`, strings.Join(filters, " and "), ")")
84 }
85 return filter
86}
87
88// getTimeIntervalAndBucket 根据start和end来获取窗口时间间隔,窗口偏移量offset,以及使用的bucket, 查询的startTime也会格式化
89func getTimeIntervalAndBucket(startTime, endTime time.Time) (time.Time, string, string, string) {

Callers 13

MessageTrendMethod · 0.85
ProxyTrendMethod · 0.85
InvokeTrendMethod · 0.85
RequestSummaryMethod · 0.85
ProxySummaryMethod · 0.85
CommonStatisticsMethod · 0.85
overviewByStatusCodeMethod · 0.85
RequestOverviewMethod · 0.85
TopNMethod · 0.85
TokenOverviewMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected