validators

package
v0.51.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HAResourceIDValidator

func HAResourceIDValidator() validator.String

HAResourceIDValidator returns a new HA resource identifier validator.

func HAResourceStateValidator

func HAResourceStateValidator() validator.String

HAResourceStateValidator returns a new HA resource state validator.

func HAResourceTypeValidator

func HAResourceTypeValidator() validator.String

HAResourceTypeValidator returns a new HA resource type validator.

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