Documentation ¶
Index ¶
- Constants
- func AbsoluteFilePathValidator() validator.String
- func FileID() validator.String
- func HardwareMappingDeviceIDValidator() validator.String
- func KeyboardLayoutValidator() validator.String
- func LanguageValidator() validator.String
- func NewParseValidator[T any](parseFunction func(string) (T, error), description string) validator.String
- func NonEmptyString() validator.String
Constants ¶
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
AbsoluteFilePathValidator validates that a string is an absolute file path.
func FileID ¶ added in v0.59.1
FileID returns a validator that checks if a string is a valid file ID.
func HardwareMappingDeviceIDValidator ¶ added in v0.54.0
HardwareMappingDeviceIDValidator validates a hardware mapping device ID.
func KeyboardLayoutValidator ¶
KeyboardLayoutValidator returns a new validator for keyboard layouts.
func LanguageValidator ¶
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
NonEmptyString returns a new validator to ensure a non-empty string.
Types ¶
This section is empty.