validation

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFailedValidationFields

func GetFailedValidationFields(err error) (map[FieldName]Message, error)

GetFailedValidationFields returns the failed validation fields or error if the error is not a fieldValidationFailure

func IsFieldValidationError

func IsFieldValidationError(err error) bool

IsFieldValidationError returns trye if the error is of type fieldValidationFailure

func IsLengthLessOrEqual

func IsLengthLessOrEqual(s string, max int) bool

IsLengthLessOrEqual checks if the string has length less than max

func IsUTFAlpahnumeric

func IsUTFAlpahnumeric(s string) bool

IsUTFAlpahnumeric checks if the string contains only unicode letters and numbers. Empty string is valid.

func IsValidUUID

func IsValidUUID(u string) bool

IsValidUUID checks if a given string is a valid v4 UUID

func RetrieveFieldName

func RetrieveFieldName(f FieldName) string

RetrieveFieldName returns the underlying field name for f

func RetrieveMessage

func RetrieveMessage(m Message) string

RetrieveMessage returns the underlying message for m

Types

type Error

type Error struct {
	Fields map[FieldName]Message
}

Error is a representation of all input validation errors when initializing a workflow

func (Error) Error

func (v Error) Error() string

Error adds the error behavior to ValidationError

func (Error) FailedFields

func (v Error) FailedFields() Fields

FailedFields returns the fields that failed validation

type FieldName

type FieldName string

FieldName is the name of the field that failed validation

type Fields

type Fields map[FieldName]Message

Fields is a key value collection of the names of all failed fields and their corresponding failure messages

type Message

type Message string

Message is the message describing the field validation failure

Jump to

Keyboard shortcuts

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