Documentation
¶
Overview ¶
Package decode-errors demonstrates multi-field validation errors in go-codex.
Before: struct Decode stopped at the first failing field — callers got one error and had to re-submit to discover the next one.
Now: all fields are validated in a single pass. Every failing field is collected into a codex.ValidationErrors slice, so callers see the complete picture immediately.
Structured error types allow callers to inspect each failure precisely:
- codex.ValidationErrors — slice of per-field errors
- codex.ValidationError — field name + underlying error
- codex.ConstraintError — constraint name + human-readable message
All types implement slog.LogValuer for structured logging. For a comprehensive tour of all error types, see examples/error-types.
Run with: go run ./examples/decode-errors
Click to show internal directories.
Click to hide internal directories.