validators

package
v0.58.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MPL-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

View Source
const (
	// HardwareMappingDeviceIDValidatorErrMessage is the error message when the validation fails.
	HardwareMappingDeviceIDValidatorErrMessage = `value must be a valid hardware mapping device ID, e.g. "8086:5916"`
)

Variables

This section is empty.

Functions

func HardwareMappingDeviceIDValidator added in v0.54.0

func HardwareMappingDeviceIDValidator() validator.String

HardwareMappingDeviceIDValidator validates a hardware mapping device ID.

func KeyboardLayoutValidator

func KeyboardLayoutValidator() validator.String

KeyboardLayoutValidator returns a new validator for keyboard layouts.

func LanguageValidator

func LanguageValidator() validator.String

LanguageValidator returns a new validator for language codes.

func NewParseValidator

func NewParseValidator[T any](parseFunction func(string) (T, error), description string) validator.String

NewParseValidator creates a validator which uses a parsing function to validate a string. The function is expected to return a value of type `T` and an error. If the error is non-nil, the validator will fail. The `description` argument should contain a description of the validator's effect.

Types

This section is empty.

Jump to

Keyboard shortcuts

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