| 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 ref contains the reference interfaces used throughout the types components. |
| 16 | package refscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/ |
| 17 | |
| 18 | import ( |
| 19 | "reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/" |
| 20 | ) |
| 21 | |
| 22 | // Type interface indicate the name of a given type. |
| 23 | type Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type# interface { |
| 24 | // HasTrait returns whether the type has a given trait associated with it. |
| 25 | // |
| 26 | // See common/types/traits/traits.go for a list of supported traits. |
| 27 | HasTraitscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type#HasTrait.(trait int) bool |
| 28 | |
| 29 | // TypeName returns the qualified type name of the type. |
| 30 | // |
| 31 | // The type name is also used as the type's identifier name at type-check and interpretation time. |
| 32 | TypeNamescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type#TypeName.() string |
| 33 | } |
| 34 | |
| 35 | // Val interface defines the functions supported by all expression values. |
| 36 | // Val implementations may specialize the behavior of the value through the addition of traits. |
| 37 | type Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# interface { |
| 38 | // ConvertToNative converts the Value to a native Go struct according to the |
| 39 | // reflected type description, or error if the conversion is not feasible. |
| 40 | // |
| 41 | // The ConvertToNative method is intended to be used to support conversion between CEL types |
| 42 | // and native types during object creation expressions or by clients who need to adapt the, |
| 43 | // returned CEL value into an equivalent Go value instance. |
| 44 | // |
| 45 | // When implementing or using ConvertToNative, the following guidelines apply: |
| 46 | // - Use ConvertToNative when marshalling CEL evaluation results to native types. |
| 47 | // - Do not use ConvertToNative within CEL extension functions. |
| 48 | // - Document whether your implementation supports non-CEL field types, such as Go or Protobuf. |
| 49 | ConvertToNativescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToNative.(typeDesc reflectscip-go gomod github.com/golang/go/src go1.23.0 reflect/.Typescip-go gomod github.com/golang/go/src go1.23.0 reflect/Type#) (any, error) |
| 50 | |
| 51 | // ConvertToType supports type conversions between CEL value types supported by the expression language. |
| 52 | ConvertToTypescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#ConvertToType.(typeValue Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type#) Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# |
| 53 | |
| 54 | // Equal returns true if the `other` value has the same type and content as the implementing struct. |
| 55 | Equalscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Equal.(other Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#) Valscip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val# |
| 56 | |
| 57 | // Type returns the TypeValue of the value. |
| 58 | Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Type.() Typescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Type# |
| 59 | |
| 60 | // Value returns the raw value of the instance which may not be directly compatible with the expression |
| 61 | // language types. |
| 62 | Valuescip-go gomod github.com/google/cel-go . `github.com/google/cel-go/common/types/ref`/Val#Value.() any |
| 63 | } |