validationutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmpty        = errors.New("empty")
	ErrTooLong      = errors.New("too long")
	ErrInvalidChars = errors.New("contains invalid characters")
)
View Source
var (
	IDMaxLen = 50 // maximum length of an ID

)

Functions

func SanitizeID

func SanitizeID(id string) string

func ValidateID

func ValidateID(id string, maxLen int) error

ValidateID checks if an ID is valid. It returns an error if the ID contains invalid characters, is empty, or is too long. The maxLen parameter is the maximum length of the ID. If maxLen is 0, the ID length is not checked.

Types

This section is empty.

Jump to

Keyboard shortcuts

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