validate

package
v8.12.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultStructValidator

func DefaultStructValidator(target interface{}) error

DefaultStructValidator validates that the passed structure is valid.

func HasZero added in v8.12.0

func HasZero(values ...any) bool

HasZero checks returns true if any of the provided values is a zero value.

func IsZero added in v8.12.0

func IsZero(value any) bool

IsZero checks returns true if the provided value is a zero value.

func Validate

func Validate(target interface{}) error

Validate validates an object if it implements the Validator interface. Objects that do not implement the Validator interface are not validated.

Types

type Validator

type Validator interface {
	// Validate validates that the object is valid.
	Validate() error
}

Validator allows defining validation behavior for an object.

Jump to

Keyboard shortcuts

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