Rename and restructure AST-to-JSON file

Signed-off-by: Julius Volz <julius.volz@gmail.com>
pull/14872/head
Julius Volz 3 months ago
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…
Cancel
Save