Help us shape the future of Go! Take the 2026 Go Developer Survey

validate

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(expr string, d model.Doc, today time.Time) (bool, error)

Eval is a convenience wrapper for tests and simple callers.

func EvalIn

func EvalIn(expr string, ctx EvalContext) (bool, error)

EvalIn evaluates a boolean rule expression against ctx.

Types

type EvalContext

type EvalContext struct {
	Doc   model.Doc
	Root  string
	Today time.Time
}

EvalContext carries everything an expression can reference.

type Finding

type Finding struct {
	Path     string `json:"path"`
	Field    string `json:"field"`
	Rule     string `json:"rule"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
}

Finding is one validation problem on one document.

func Check

func Check(docs []model.Doc, s *schema.Schema, root string) []Finding

Check validates every doc against the schema and returns all findings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL