Documentation
¶
Index ¶
- Variables
- func AssertErrors(t *testing.T, err error, key, detail string, v *Validator)
- func AssertValidationErrs(t *testing.T, errs ValidationErrors, key string, detail string)
- func IsValidProjectName(projectName string) error
- func IsValidWorkflowName(workflowName string) error
- func NewValidationError(key, detail string) error
- type ValidationError
- type ValidationErrors
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ValidNameRegex = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`)
ValidNameRegex matches only letters (upper and lower case), numbers, dashes, and underscores
Functions ¶
func AssertErrors ¶
AssertErrors is a helper function to assert that the validation errors are as expected.
func AssertValidationErrs ¶
func AssertValidationErrs(t *testing.T, errs ValidationErrors, key string, detail string)
func IsValidProjectName ¶
func IsValidWorkflowName ¶
func NewValidationError ¶
Types ¶
type ValidationError ¶
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []ValidationError
func (ValidationErrors) Error ¶
func (ve ValidationErrors) Error() string
Add error interface implementation for ValidationErrors
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator wraps a validator instance and a translator.
func NewValidator ¶
NewValidator creates a new Validator with English translations registered.
func (*Validator) ParseValidationErrors ¶
func (v *Validator) ParseValidationErrors(err error) ValidationErrors
ParseValidationErrors parses a raw validation error and returns a slice of ValidationErrors.
func (*Validator) RegisterCustomTranslation ¶
RegisterCustomTranslation registers a custom translation for a given tag.
func (*Validator) Translator ¶
func (v *Validator) Translator() ut.Translator
Translator returns the underlying translator if you need direct access.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.