cloudflare/pint

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.38.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

internal/parser/utils/binary_expr.go

21lines · modepreview

package utils

import (
	promParser "github.com/prometheus/prometheus/promql/parser"

	"github.com/cloudflare/pint/internal/parser"
)

func HasOuterBinaryExpr(node *parser.PromQLNode) *promParser.BinaryExpr {
	if n, ok := node.Node.(*promParser.BinaryExpr); ok {
		return n
	}

	for _, child := range node.Children {
		if be := HasOuterBinaryExpr(child); be != nil {
			return be
		}
	}

	return nil
}