Debian Codegraph @

common/functions/functions.go

raw symbols SCIP
1 // Copyright 2023 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Package functions defines the standard builtin functions supported by the interpreter
16 package functionsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/
17
18 import "github.com/google/cel-go/common/types/refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/"
19
20 // Overload defines a named overload of a function, indicating an operand trait
21 // which must be present on the first argument to the overload as well as one
22 // of either a unary, binary, or function implementation.
23 //
24 // The majority of operators within the expression language are unary or binary
25 // and the specializations simplify the call contract for implementers of
26 // types with operator overloads. Any added complexity is assumed to be handled
27 // by the generic FunctionOp.
28 type Overloadscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload# struct {
29 // Operator name as written in an expression or defined within
30 // operators.go.
31 Operatorscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#Operator. string
32
33 // Operand trait used to dispatch the call. The zero-value indicates a
34 // global function overload or that one of the Unary / Binary / Function
35 // definitions should be used to execute the call.
36 OperandTraitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#OperandTrait. int
37
38 // Unary defines the overload with a UnaryOp implementation. May be nil.
39 Unaryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#Unary. UnaryOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/UnaryOp#
40
41 // Binary defines the overload with a BinaryOp implementation. May be nil.
42 Binaryscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#Binary. BinaryOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/BinaryOp#
43
44 // Function defines the overload with a FunctionOp implementation. May be
45 // nil.
46 Functionscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#Function. FunctionOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/FunctionOp#
47
48 // NonStrict specifies whether the Overload will tolerate arguments that
49 // are types.Err or types.Unknown.
50 NonStrictscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/Overload#NonStrict. bool
51 }
52
53 // UnaryOp is a function that takes a single value and produces an output.
54 type UnaryOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/UnaryOp# func(value refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#
55
56 // BinaryOp is a function that takes two values and produces an output.
57 type BinaryOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/BinaryOp# func(lhs refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#, rhs refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#
58
59 // FunctionOp is a function with accepts zero or more arguments and produces
60 // a value or error as a result.
61 type FunctionOpscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/functions`/FunctionOp# func(values ...refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/.Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#