gup

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 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 NewValidation added in v1.0.3

func NewValidation[T interface{}](fields map[string]*RuleList) *validation[T]

Types

type RuleList

type RuleList struct {
	Values *map[string]interface{}
	Rules  []ValidationRule
}

func R

func R() *RuleList

func (*RuleList) Custom added in v1.0.3

func (ruleList *RuleList) Custom(rule ValidationRule) *RuleList

func (*RuleList) Email

func (ruleList *RuleList) Email() *RuleList

func (*RuleList) Execute

func (ruleList *RuleList) Execute(key string, value interface{}) (interface{}, []string)

func (*RuleList) MaxLength added in v1.0.2

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

func (*RuleList) MaxValue

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

func (*RuleList) MinLength added in v1.0.2

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

func (*RuleList) MinValue

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

func (*RuleList) Number

func (ruleList *RuleList) Number() *RuleList

func (*RuleList) Required

func (ruleList *RuleList) Required() *RuleList

func (*RuleList) SameAs added in v1.0.3

func (ruleList *RuleList) SameAs(field string) *RuleList

func (*RuleList) Trim

func (ruleList *RuleList) Trim() *RuleList

func (*RuleList) UseValues added in v1.0.3

func (ruleList *RuleList) UseValues(values *map[string]interface{})

type ValidationRule

type ValidationRule func(key string, value interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

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