Documentation ¶
Index ¶
- func DefaultEnv(useUTC bool) (*cel.Env, error)
- func ProtoFieldToCELType(fieldDesc protoreflect.FieldDescriptor, generic, forItems bool) *cel.Type
- func ProtoFieldToCELValue(fieldDesc protoreflect.FieldDescriptor, value protoreflect.Value, ...) ref.Val
- func RequiredCELEnvOptions(fieldDesc protoreflect.FieldDescriptor) []cel.EnvOption
- type Lib
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultEnv ¶
DefaultEnv produces a cel.Env with the necessary cel.EnvOption and cel.ProgramOption values preconfigured for usage throughout the module. If useUTC is true, timestamp operations use the UTC timezone instead of the local timezone.
func ProtoFieldToCELType ¶ added in v0.5.0
func ProtoFieldToCELType(fieldDesc protoreflect.FieldDescriptor, generic, forItems bool) *cel.Type
ProtoFieldToCELType 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 ProtoFieldToCELValue ¶ added in v0.7.1
func ProtoFieldToCELValue(fieldDesc protoreflect.FieldDescriptor, value protoreflect.Value, forItems bool) ref.Val
func RequiredCELEnvOptions ¶ added in v0.5.0
func RequiredCELEnvOptions(fieldDesc protoreflect.FieldDescriptor) []cel.EnvOption
RequiredCELEnvOptions returns the options required to have expressions which rely on the provided descriptor.
Types ¶
type Lib ¶ added in v0.6.3
type Lib struct {
// contains filtered or unexported fields
}
Lib is the collection of 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
All implementations of protovalidate MUST implement these functions and should avoid exposing additional functions as they will not be portable.
func (Lib) CompileOptions ¶ added in v0.6.3
func (Lib) ProgramOptions ¶ added in v0.6.3
func (l Lib) ProgramOptions() []cel.ProgramOption