cel

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLibrary

func NewLibrary() cel.Library

NewLibrary creates a new CEL library that specifies all of the functions and settings required by protovalidate beyond the standard definitions of the CEL Specification:

https://github.com/google/cel-spec/blob/master/doc/langdef.md#list-of-standard-definitions

Using this function, you can create a CEL environment that is identical to the one used to evaluate protovalidate CEL expressions.

func ProtoFieldToType

func ProtoFieldToType(fieldDesc protoreflect.FieldDescriptor, generic, forItems bool) *cel.Type

ProtoFieldToType resolves the CEL value type for the provided FieldDescriptor. If generic is true, the specific subtypes of map and repeated fields will be replaced with cel.DynType. If forItems is true, the type for the repeated list items is returned instead of the list type itself.

func ProtoFieldToValue

func ProtoFieldToValue(fieldDesc protoreflect.FieldDescriptor, value protoreflect.Value, forItems bool) ref.Val

func RequiredEnvOptions

func RequiredEnvOptions(fieldDesc protoreflect.FieldDescriptor) []cel.EnvOption

RequiredEnvOptions returns the options required to have expressions which rely on the provided descriptor.

Types

This section is empty.