Skip to content

Querying Results

These helpers do not re-run validation. They inspect the latest recorded errors.

val := v.Is(
v.String("", "email").Not().Empty(),
v.String("John", "name").Not().Blank(),
)
_ = val.PathValid("email") // false
_ = val.PathValid("name") // true

For nested/indexed paths, parent namespaces are considered invalid when any child is invalid.

val := v.Is(
v.String("john@example.com", "email").Not().Empty(),
v.String("", "password").Not().Empty(),
)
_ = val.AllValid("email") // true
_ = val.AllValid("email", "password") // false
_ = val.AllValid() // same as val.Valid()
val := v.Is(
v.String("", "email").Not().Empty(),
v.String("+3569999999", "phone").Not().Empty(),
)
_ = val.AnyValid("email", "phone") // true
_ = val.AnyValid() // false (explicit set required)

IsValid("path") is deprecated; use PathValid("path").