decode-errors

command
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 8 Imported by: 0

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

Jump to

Keyboard shortcuts

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