validators

package
v0.0.0-...-dae269f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSlug = errors.New("invalid slug")

Functions

func New

func New() validator.Collection

New creates a new set of standard validators for the configuration

func ValidateBool

func ValidateBool(value *NullableBool, dflt string) (err error)

func ValidateDirectory

func ValidateDirectory(path *string, dflt string) error

func ValidateDomain

func ValidateDomain(domain *string, dflt string) error

func ValidateDuration

func ValidateDuration(d *time.Duration, dflt string) error

func ValidateEmail

func ValidateEmail(email *string, dflt string) error

ValidateEmail checks that s represents an email, and then returns it as is.

func ValidateFile

func ValidateFile(path *string, dflt string) error

func ValidateHTTPSURL

func ValidateHTTPSURL(url **URL, dflt string) error

func ValidateNonempty

func ValidateNonempty(value *string, dflt string) error

func ValidatePort

func ValidatePort(value *uint16, dflt string) (err error)

func ValidatePositive

func ValidatePositive(value *int, dflt string) (err error)

func ValidateSlug

func ValidateSlug(s *string, dflt string) error

ValidateSlug validates a slug and normalizes it.

Types

type NullableBool

type NullableBool struct {
	Set, Value bool
}

NullableBool represents a bool that can be null

func (NullableBool) MarshalYAML

func (nb NullableBool) MarshalYAML() (interface{}, error)

func (*NullableBool) UnmarshalYAML

func (nb *NullableBool) UnmarshalYAML(value *yaml.Node) error

type URL

type URL url.URL

URL represents a url.URL that is marshaled as a string representing the url.

func (*URL) MarshalText

func (u *URL) MarshalText() (text []byte, err error)

func (*URL) String

func (u *URL) String() string

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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