shared

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrFailedTo

func ErrFailedTo(action string, err error) error

ErrFailedTo creates a "failed to X" error

func ErrInvalid

func ErrInvalid(what string, value interface{}) error

ErrInvalid creates an "invalid X" error

func ErrMissingParam

func ErrMissingParam(param string) error

ErrMissingParam creates a "missing required parameter" error

func ErrNotFound

func ErrNotFound(what string) error

ErrNotFound creates a "X not found" error

Types

type Validator added in v0.2.0

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

Validator provides common validation functions

func NewValidator added in v0.2.0

func NewValidator() *Validator

NewValidator creates a new validator

func (*Validator) Error added in v0.2.0

func (v *Validator) Error() error

Error returns the validation error if any

func (*Validator) Errors added in v0.2.0

func (v *Validator) Errors() []string

Errors returns all validation errors

func (*Validator) HasErrors added in v0.2.0

func (v *Validator) HasErrors() bool

HasErrors returns true if validation errors exist

func (*Validator) RequireNonEmpty added in v0.2.0

func (v *Validator) RequireNonEmpty(field string, value string) *Validator

RequireNonEmpty validates that a string is not empty

func (*Validator) RequirePositive added in v0.2.0

func (v *Validator) RequirePositive(field string, value int) *Validator

RequirePositive validates that a value is positive

func (*Validator) RequireRange added in v0.2.0

func (v *Validator) RequireRange(field string, value, min, max float64) *Validator

RequireRange validates that a value is within a range

Jump to

Keyboard shortcuts

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