go-simpler / check

✔️ Write any validations declaratively

Home Page:https://go-simpler.org/check

Repository from Github https://github.comgo-simpler/checkRepository from Github https://github.comgo-simpler/check

check

checks pkg.go.dev goreportcard codecov

Write any validations declaratively.

📦 Install

go get go-simpler.org/check

📋 Usage

Use That/Thatf to write conditions to check, multiple calls can be chained. The last call in the chain must be FirstError, AllErrors, or JoinErrors.

err := check.
    That(user.Name != "", errEmptyName).
    Thatf(user.Age >= 18, "%d y.o. is too young", user.Age).
    Thatf(isEmail(user.Email), "%s is invalid email", user.Email).
    JoinErrors() // or FirstError() / AllErrors().

About

✔️ Write any validations declaratively

https://go-simpler.org/check

License:Mozilla Public License 2.0


Languages

Language:Go 87.8%Language:Makefile 12.2%