Skip to content

danielwchapman/validate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

validate

A simple, reusable parameter validator

Install

Install this package with go get:

go get github.com/danielwchapman/validate

Usage

var (
    age *int
    ids []int{1, 2, 3}
    count = 3
)
    
err := errors.Join(
    validate.Exists("age", age),
    validate.Length("ids", ids, 2),
    validate.Between("count", count, 0, 5),
)

if err != nil {
    fmt.Printf("Validation error: %s", err)
}

About

A simple, reusable parameter validator

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages