switch to go vendoring

This commit is contained in:
Michael Barz
2023-04-19 20:24:34 +02:00
parent 632fa05ef9
commit afc6ed1e41
8527 changed files with 3004916 additions and 2 deletions
+45
View File
@@ -0,0 +1,45 @@
// Copyright 2017 The OPA Authors. All rights reserved.
// Use of this source code is governed by an Apache2
// license that can be found in the LICENSE file.
package topdown
import (
"github.com/open-policy-agent/opa/ast"
"github.com/open-policy-agent/opa/topdown/builtins"
)
func builtinBinaryAnd(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) error) error {
s1, err := builtins.SetOperand(operands[0].Value, 1)
if err != nil {
return err
}
s2, err := builtins.SetOperand(operands[1].Value, 2)
if err != nil {
return err
}
return iter(ast.NewTerm(s1.Intersect(s2)))
}
func builtinBinaryOr(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) error) error {
s1, err := builtins.SetOperand(operands[0].Value, 1)
if err != nil {
return err
}
s2, err := builtins.SetOperand(operands[1].Value, 2)
if err != nil {
return err
}
return iter(ast.NewTerm(s1.Union(s2)))
}
func init() {
RegisterBuiltinFunc(ast.And.Name, builtinBinaryAnd)
RegisterBuiltinFunc(ast.Or.Name, builtinBinaryOr)
}