Overview
This content is for v0.7. Switch to the latest version for up-to-date documentation.
Validators hold a value and a list of rules to evaluate.
Name and title
Section titled “Name and title”If you omit a name, Valgo generates one (e.g. value_0).
val := v.New(v.String("").Empty())Prefer passing a stable field name (and optionally a human-friendly title):
val := v.New(v.String("", "company_name").Not().Empty())val := v.New(v.String("", "company_name", "Customer").Not().Empty())Not() inverts the next rule.
valid := v.Is(v.Number(0).Not().Zero()).Valid()