Skip to content

package validate

import "github.com/cloudboss/unobin/pkg/sdk/cfg/validate"

Package validate provides standard Validator constructors for cfg configuration fields. Each constructor returns a cfg.Validator whose Describe reports its kind and parameters so the schema commands and editor tooling can render the constraint declaratively rather than as an opaque function.

Functions

func All

func All(vs ...cfg.Validator) cfg.Validator

All returns a validator that runs each child in order. The first failure stops the chain.

func Func

func Func(description string, fn func(any) error) cfg.Validator

Func returns a validator backed by an arbitrary Go function. The description tells operators and editor tooling what the function checks, since the function body itself is opaque to introspection.

func Pattern

func Pattern(re string) cfg.Validator

Pattern returns a validator that requires a string value to match a regular expression. The pattern compiles at construction; a malformed pattern panics.

func Range

func Range(min, max int64) cfg.Validator

Range returns a validator that requires an integer value to fall within [min, max] inclusive.