cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.40.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

internal/parser/utils/binary_expr.go

21lines · modecode

1package utils
2
3import (
4 promParser "github.com/prometheus/prometheus/promql/parser"
5
6 "github.com/cloudflare/pint/internal/parser"
7)
8
9func HasOuterBinaryExpr(node *parser.PromQLNode) *promParser.BinaryExpr {
10 if n, ok := node.Node.(*promParser.BinaryExpr); ok {
11 return n
12 }
13
14 for _, child := range node.Children {
15 if be := HasOuterBinaryExpr(child); be != nil {
16 return be
17 }
18 }
19
20 return nil
21}