validate

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package validate implements the functions, types, and interfaces for the module.

Package validate implements the functions, types, and interfaces for the module.

Package validate implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProtoValidate

func NewProtoValidate(opts ...ProtoValidatorOption) (*protovalidate.Validator, error)

NewProtoValidate creates a new ProtoValidator.

func ProtoValidate

func ProtoValidate(message proto.Message) error

ProtoValidate validates a protobuf message.

Types

type CompilationError

type CompilationError = protovalidate.CompilationError

CompilationError is an error that occurs during compilation.

type ProtoValidator

type ProtoValidator = protovalidate.Validator

ProtoValidator is a validator for protobuf messages.

type ProtoValidatorOption

type ProtoValidatorOption = protovalidate.ValidatorOption

ProtoValidatorOption is an option for the ProtoValidator.

func WithAllowUnknownFields

func WithAllowUnknownFields(allow bool) ProtoValidatorOption

WithAllowUnknownFields allows unknown fields.

func WithDescriptors

func WithDescriptors(descriptors ...protoreflect.MessageDescriptor) ProtoValidatorOption

WithDescriptors sets the descriptors to validate.

func WithDisableLazy

func WithDisableLazy(disable bool) ProtoValidatorOption

WithDisableLazy disables lazy validation.

func WithExtensionTypeResolver

func WithExtensionTypeResolver(extensionTypeResolver protoregistry.ExtensionTypeResolver) ProtoValidatorOption

WithExtensionTypeResolver sets the extension type resolver.

func WithFailFast

func WithFailFast(failFast bool) ProtoValidatorOption

WithFailFast sets the fail fast option.

func WithMessages

func WithMessages(messages ...proto.Message) ProtoValidatorOption

WithMessages sets the messages to validate.

func WithStandardConstraintInterceptor

func WithStandardConstraintInterceptor(interceptor StandardConstraintInterceptor) ProtoValidatorOption

WithStandardConstraintInterceptor adds a standard constraint interceptor.

func WithUTC

func WithUTC(use bool) ProtoValidatorOption

WithUTC sets the time zone to UTC.

type RuntimeError

type RuntimeError = protovalidate.RuntimeError

RuntimeError is an error that occurs during runtime.

type StandardConstraintInterceptor

type StandardConstraintInterceptor = protovalidate.StandardConstraintInterceptor

StandardConstraintInterceptor is a constraint interceptor for the ProtoValidator.

type StandardConstraintResolver

type StandardConstraintResolver = protovalidate.StandardConstraintResolver

StandardConstraintResolver is a constraint resolver for the ProtoValidator.

type ValidationError

type ValidationError = protovalidate.ValidationError

ValidationError is an error that occurs during validation.

type Validator

type Validator interface {
	Validate(message proto.Message) error
}

Validator is an interface for validating protobuf messages.

func NewValidate

func NewValidate(opts ...ProtoValidatorOption) (Validator, error)

NewValidate creates a new Validator.

type Version

type Version int

Version is the version of the module.

const (
	V1 Version = 1
	V2 Version = 2
)

func (Version) String

func (i Version) String() string

Jump to

Keyboard shortcuts

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