| 1 | // Copyright 2018 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 traits defines interfaces that a type may implement to participate |
| 16 | // in operator overloads and function dispatch. |
| 17 | package traitsscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ |
| 18 | |
| 19 | const ( |
| 20 | // AdderType types provide a '+' operator overload. |
| 21 | AdderTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/AdderType. = 1 << iota |
| 22 | |
| 23 | // ComparerType types support ordering comparisons '<', '<=', '>', '>='. |
| 24 | ComparerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ComparerType. |
| 25 | |
| 26 | // ContainerType types support 'in' operations. |
| 27 | ContainerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ContainerType. |
| 28 | |
| 29 | // DividerType types support '/' operations. |
| 30 | DividerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/DividerType. |
| 31 | |
| 32 | // FieldTesterType types support the detection of field value presence. |
| 33 | FieldTesterTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/FieldTesterType. |
| 34 | |
| 35 | // IndexerType types support index access with dynamic values. |
| 36 | IndexerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IndexerType. |
| 37 | |
| 38 | // IterableType types can be iterated over in comprehensions. |
| 39 | IterableTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IterableType. |
| 40 | |
| 41 | // IteratorType types support iterator semantics. |
| 42 | IteratorTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IteratorType. |
| 43 | |
| 44 | // MatcherType types support pattern matching via 'matches' method. |
| 45 | MatcherTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MatcherType. |
| 46 | |
| 47 | // ModderType types support modulus operations '%' |
| 48 | ModderTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ModderType. |
| 49 | |
| 50 | // MultiplierType types support '*' operations. |
| 51 | MultiplierTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MultiplierType. |
| 52 | |
| 53 | // NegatorType types support either negation via '!' or '-' |
| 54 | NegatorTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/NegatorType. |
| 55 | |
| 56 | // ReceiverType types support dynamic dispatch to instance methods. |
| 57 | ReceiverTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ReceiverType. |
| 58 | |
| 59 | // SizerType types support the size() method. |
| 60 | SizerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/SizerType. |
| 61 | |
| 62 | // SubtractorType types support '-' operations. |
| 63 | SubtractorTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/SubtractorType. |
| 64 | |
| 65 | // FoldableType types support comprehensions v2 macros which iterate over (key, value) pairs. |
| 66 | FoldableTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/FoldableType. |
| 67 | ) |
| 68 | |
| 69 | const ( |
| 70 | // ListerType supports a set of traits necessary for list operations. |
| 71 | // |
| 72 | // The ListerType is syntactic sugar and not intended to be a perfect reflection of all List operators. |
| 73 | ListerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ListerType. = AdderTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/AdderType. | ContainerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ContainerType. | IndexerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IndexerType. | IterableTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IterableType. | SizerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/SizerType. |
| 74 | |
| 75 | // MapperType supports a set of traits necessary for map operations. |
| 76 | // |
| 77 | // The MapperType is syntactic sugar and not intended to be a perfect reflection of all Map operators. |
| 78 | MapperTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/MapperType. = ContainerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/ContainerType. | IndexerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IndexerType. | IterableTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/IterableType. | SizerTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/traits`/SizerType. |
| 79 | ) |