validators

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MPL-2.0 Imports: 8 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 AbsoluteFilePathValidator added in v0.61.0

func AbsoluteFilePathValidator() validator.String

AbsoluteFilePathValidator validates that a string is an absolute file path.

func FileID added in v0.59.1

func FileID() validator.String

FileID returns a validator that checks if a string is a valid file ID.

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.

func NonEmptyString added in v0.61.0

func NonEmptyString() validator.String

NonEmptyString returns a new validator to ensure a non-empty string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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