Documentation
¶
Index ¶
- func FormatErrors(errs []Error) string
- type Checker
- func (c *Checker) Check(path, value string, cond bool, msg string)
- func (c *Checker) Errors() []Error
- func (c *Checker) FloatMax(path string, value float64, max *float64)
- func (c *Checker) FloatMin(path string, value float64, min *float64)
- func (c *Checker) HasErrors() bool
- func (c *Checker) IntMin(path string, value, min int)
- func (c *Checker) IntRange(path string, value, min, max int)
- func (c *Checker) LessOrEqual(pathA string, a int, pathB string, b int)
- func (c *Checker) MaxLength(path string, value string, max *int)
- func (c *Checker) OneOf(path, value string, allowed []string)
- func (c *Checker) Required(path, value string)
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatErrors ¶
FormatErrors joins all errors into a single multi-line string.
Types ¶
type Checker ¶
type Checker struct {
// contains filtered or unexported fields
}
Checker accumulates validation errors as you check fields.
func (*Checker) IntRange ¶
IntRange checks that value is within [min, max]. Skips if value is 0 (zero value means "use default").
func (*Checker) LessOrEqual ¶
LessOrEqual checks a <= b. Skips if either is 0.
func (*Checker) MaxLength ¶
MaxLength checks that a string's length does not exceed max. Skips if max is nil.
Click to show internal directories.
Click to hide internal directories.