constraints

package
v2.0.0-...-02ad64b Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectedWrapperConstraints

func ExpectedWrapperConstraints(fqn protoreflect.FullName) (desc protoreflect.FieldDescriptor, ok bool)

ExpectedWrapperConstraints returns the validate.FieldConstraints field that is expected for the given wrapper well-known type's full name. If ok is false, no standard constraints exist for that type.

func ProtoKindToCELType

func ProtoKindToCELType(kind protoreflect.Kind) *cel.Type

ProtoKindToCELType maps a protoreflect.Kind to a compatible cel.Type.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a build-through cache to computed standard constraints.

func NewCache

func NewCache() Cache

NewCache constructs a new build-through cache for the standard constraints.

func (*Cache) Build

func (c *Cache) Build(
	env *cel.Env,
	fieldDesc protoreflect.FieldDescriptor,
	fieldConstraints *validate.FieldConstraints,
	forItems bool,
) (set expression.ProgramSet, err error)

Build creates the standard constraints for the given field. If forItems is true, the constraints for repeated list items is built instead of the constraints on the list itself.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL