ref
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package ref contains the reference interfaces used throughout the types components.
Index¶
- type FieldGetter
- type FieldTester
- type FieldTypedeprecated
- type Type
- type TypeAdapterdeprecated
- type TypeProviderdeprecated
- type TypeRegistrydeprecated
- type Val
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeFieldGetter¶added inv0.4.0
FieldGetter is used to get the field value from an input object, if set.
typeFieldTester¶added inv0.4.0
FieldTester is used to test field presence on an input object.
typeFieldTypedeprecated
type FieldType struct {// Type of the field as a protobuf type value.Type *exprpb.Type// IsSet indicates whether the field is set on an input object.IsSetFieldTester// GetFrom retrieves the field value on the input object, if set.GetFromFieldGetter}FieldType represents a field's type value and whether that field supportspresence detection.
Deprecated: use types.FieldType
typeType¶
type Type interface {// HasTrait returns whether the type has a given trait associated with it.//// See common/types/traits/traits.go for a list of supported traits.HasTrait(traitint)bool// TypeName returns the qualified type name of the type.//// The type name is also used as the type's identifier name at type-check and interpretation time.TypeName()string}Type interface indicate the name of a given type.
typeTypeAdapterdeprecatedadded inv0.2.0
typeTypeProviderdeprecated
type TypeProvider interface {// EnumValue returns the numeric value of the given enum value name.EnumValue(enumNamestring)Val// FindIdent takes a qualified identifier name and returns a Value if one exists.FindIdent(identNamestring) (Val,bool)// FindType looks up the Type given a qualified typeName. Returns false if not found.FindType(typeNamestring) (*exprpb.Type,bool)// FieldFieldType returns the field type for a checked type value. Returns false if// the field could not be found.FindFieldType(messageType, fieldNamestring) (*FieldType,bool)// NewValue creates a new type value from a qualified name and map of field name// to value.//// Note, for each value, the Val.ConvertToNative function will be invoked to convert// the Val to the field's native type. If an error occurs during conversion, the// NewValue will be a types.Err.NewValue(typeNamestring, fields map[string]Val)Val}TypeProvider specifies functions for creating new object instances and forresolving enum values by name.
Deprecated: use types.Provider
typeTypeRegistrydeprecatedadded inv0.2.0
type TypeRegistry interface {TypeAdapterTypeProvider// RegisterDescriptor registers the contents of a protocol buffer `FileDescriptor`.RegisterDescriptor(fileDescprotoreflect.FileDescriptor)error// RegisterMessage registers a protocol buffer message and its dependencies.RegisterMessage(messageproto.Message)error// RegisterType registers a type value with the provider which ensures the// provider is aware of how to map the type to an identifier.//// If a type is provided more than once with an alternative definition, the// call will result in an error.RegisterType(types ...Type)error}TypeRegistry allows third-parties to add custom types to CEL. Not all `TypeProvider`implementations support type-customization, so these features are optional. However, a`TypeRegistry` should be a `TypeProvider` and a `TypeAdapter` to ensure that typeswhich are registered can be converted to CEL representations.
Deprecated: use types.Registry
typeVal¶
type Val interface {// ConvertToNative converts the Value to a native Go struct according to the// reflected type description, or error if the conversion is not feasible.//// The ConvertToNative method is intended to be used to support conversion between CEL types// and native types during object creation expressions or by clients who need to adapt the,// returned CEL value into an equivalent Go value instance.//// When implementing or using ConvertToNative, the following guidelines apply:// - Use ConvertToNative when marshalling CEL evaluation results to native types.// - Do not use ConvertToNative within CEL extension functions.// - Document whether your implementation supports non-CEL field types, such as Go or Protobuf.ConvertToNative(typeDescreflect.Type) (any,error)// ConvertToType supports type conversions between CEL value types supported by the expression language.ConvertToType(typeValueType)Val// Equal returns true if the `other` value has the same type and content as the implementing struct.Equal(otherVal)Val// Type returns the TypeValue of the value.Type()Type// Value returns the raw value of the instance which may not be directly compatible with the expression// language types.Value()any}Val interface defines the functions supported by all expression values.Val implementations may specialize the behavior of the value through the addition of traits.