gup

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2024 License: MIT Imports: 7 Imported by: 0

README

GUP

The GUP package helps you validate struct in GoLang in a easy way, by implementing fluent interface behind the scene allowing you to quickly create validation for data on your projects.

Install

go get github.com/alexandremccastro/gup

Documentation

A full go doc style documetation of this package can be viewed online whithout installing this package by using the Go Site here: https://pkg.go.dev/github.com/alexandremccastro/gup

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewValidator

func NewValidator[T interface{}](fields map[string]*RuleList) *validator[T]

Types

type RuleList

type RuleList struct {
	Rules []ValidationRule
}

func R

func R() *RuleList

func (*RuleList) Add

func (l *RuleList) Add(rule ValidationRule) *RuleList

func (*RuleList) Email

func (l *RuleList) Email() *RuleList

func (*RuleList) Execute

func (l *RuleList) Execute(key, value string) (string, []string)

func (*RuleList) MaxLength added in v1.0.2

func (l *RuleList) MaxLength(maxLenght int) *RuleList

func (*RuleList) MaxValue

func (l *RuleList) MaxValue(maxValue float64) *RuleList

func (*RuleList) MinLength added in v1.0.2

func (l *RuleList) MinLength(minLenght int) *RuleList

func (*RuleList) MinValue

func (l *RuleList) MinValue(minValue float64) *RuleList

func (*RuleList) Number

func (l *RuleList) Number() *RuleList

func (*RuleList) Required

func (l *RuleList) Required() *RuleList

func (*RuleList) Trim

func (l *RuleList) Trim() *RuleList

type ValidationRule

type ValidationRule func(key, value string) (string, error)

Jump to

Keyboard shortcuts

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