check

package
v0.0.1-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxIdentifierLength = 25
)

Variables

View Source
var (
	ErrIdentifierLength = &ValidationError{
		fmt.Sprintf(
			"Identifier has to be between %d and %d in length.",
			minIdentifierLength,
			MaxIdentifierLength,
		),
	}

	ErrDescriptionTooLong = &ValidationError{
		fmt.Sprintf("Description can be at most %d in length.", maxDescriptionLength),
	}

	ErrIdentifierRegex = &ValidationError{
		"Identifier can only contain lower case alphanumeric characters and dash, should start with alphabet and end with alphanumeric",
	}

	ErrInvalidCharacters = &ValidationError{"Input contains invalid characters."}

	ErrEmailInvalid = &ValidationError{
		"Invalid email address format",
	}

	ErrPasswordLen = &ValidationError{
		fmt.Sprintf("Password has to be within %d and %d characters", minPasswordLength, maxPasswordLength),
	}

	ErrDisplayNameLength = &ValidationError{
		fmt.Sprintf("Display name has to be between %d and %d in length.", minDisplayNameLength, maxDisplayNameLength),
	}

	ErrGitRepoUrl = &ValidationError{"Invalid Git repository url format"}

	ErrFqdn = &ValidationError{"Invalid FQDN format, should start with http:// or https:// and must not include any path or query parameters"}

	ErrIPV4 = &ValidationError{"Invalid IP v4 address format"}

	ErrDirectory = &ValidationError{"Invalid path, should shart with / and should be a valid directory path"}

	ErrVarKeyLength = &ValidationError{
		fmt.Sprintf("Variable key has to be between %d and %d in length.", minVarKey, maxVarKey),
	}
	ErrVarKeyRegex = &ValidationError{"Variable key should start with an alphabet and contain only alphanumeric and underscore"}
)
View Source
var (
	ErrAny  = &ValidationError{}
	ErrsAny = &ValidationErrors{}
)

Functions

func Description

func Description(description string) error

Description checks the provided description and returns an error if it isn't valid.

func Directory

func Directory(dir string) error

Directory check the provided directory and returns an error if it isn't valid.

func DisplayName

func DisplayName(displayName string) error

DisplayName checks the provided display name and returns an error if it isn't valid.

func Email

func Email(email string) error

Email checks the provided email and returns an error if it isn't valid.

func FQDN

func FQDN(fqdn string) error

FQDN checks the provided fqdn and returns an error if it isn't valid.

func ForControlCharacters

func ForControlCharacters(s string) error

ForControlCharacters ensures that there are no control characters in the provided string.

func GitRepo

func GitRepo(repo string) error

GitRepo checks the provided git repo url and returns an error if it isn't valid.

func IPV4

func IPV4(ipv4 string) error

IPV4 checks the provided ipv4 and returns an error if it isn't valid.

func Identifier

func Identifier(identifier string) error

Identifier checks the provided identifier and returns an error if it isn't valid.

func Password

func Password(password string) error

Password check the provided password and returns an error if it isn't valid.

func VariableKey

func VariableKey(key string) error

VariableKey checks the provided variable key and returns an error if it isn't valid.

Types

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError is error returned for any validation errors. WARNING: This error will be printed to the user as is!

func NewValidationError

func NewValidationError(msg string) *ValidationError

func NewValidationErrorf

func NewValidationErrorf(format string, args ...interface{}) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Is

func (e *ValidationError) Is(target error) bool

type ValidationErrors

type ValidationErrors struct {
	// contains filtered or unexported fields
}

func NewValidationErrors

func NewValidationErrors() *ValidationErrors

func NewValidationErrorsKey

func NewValidationErrorsKey(key string, msg string) *ValidationErrors

func (*ValidationErrors) AddValidationError

func (e *ValidationErrors) AddValidationError(key string, err error)

func (*ValidationErrors) Error

func (e *ValidationErrors) Error() string

func (*ValidationErrors) Errors

func (e *ValidationErrors) Errors() map[string]string

func (*ValidationErrors) HasError

func (e *ValidationErrors) HasError() bool

func (*ValidationErrors) Is

func (e *ValidationErrors) Is(target error) bool

Jump to

Keyboard shortcuts

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