mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-27 05:32:27 -08:00
Rename and restructure AST-to-JSON file
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
9b27e0d915
commit
cb66131974
|
@ -20,14 +20,8 @@ import (
|
|||
"github.com/prometheus/prometheus/promql/parser"
|
||||
)
|
||||
|
||||
func getStartOrEnd(startOrEnd parser.ItemType) interface{} {
|
||||
if startOrEnd == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return startOrEnd.String()
|
||||
}
|
||||
|
||||
// Take a Go PromQL AST and translate it to a JSON object for the tree view in the UI.
|
||||
// TODO: Could it make sense to do this via the normal JSON marshalling methods?
|
||||
func translateAST(node parser.Expr) interface{} {
|
||||
if node == nil {
|
||||
return nil
|
||||
|
@ -151,3 +145,11 @@ func translateMatchers(in []*labels.Matcher) interface{} {
|
|||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func getStartOrEnd(startOrEnd parser.ItemType) interface{} {
|
||||
if startOrEnd == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return startOrEnd.String()
|
||||
}
|
Loading…
Reference in a new issue