legacy

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLegacySupport

func WithLegacySupport(mode Mode) pv.ValidatorOption

WithLegacySupport provides a protovalidate.ValidatorOption that transparently upgrades legacy constraints defined for protoc-gen-validate to be compatible with protovalidate. The specified mode determines the behavior of how the validator uses the legacy constraints.

Types

type Mode

type Mode uint8

Mode determines the behavior of how the validator uses the legacy constraints relative to existing standard constraints.

const (
	// ModeMerge merges any existing standard constraints into the translated
	// legacy constraints. This mode uses proto.Merge to combine the results. This
	// is the default behavior.
	ModeMerge Mode = iota
	// ModeReplace replaces all existing standard constraints on the message,
	// oneof, or field with the translated legacy constraints.
	ModeReplace
	// ModeIfNotPresent uses the translated legacy constraints only if no standard
	// constraints are present on the message, oneof, or field.
	ModeIfNotPresent
)

Jump to

Keyboard shortcuts

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