length: add MinLengthBytes / MaxLengthBytes
CI / test (pull_request) Successful in 34s
CI / test (push) Successful in 37s

MinLength/MaxLength now count runes, leaving no way to bound a string by
its byte size -- still wanted for fixed-width columns and wire-format
fields. Add the byte-counting pair alongside them, with their own "%d
bytes" sentinels (ErrMustHaveMoreBytes / ErrMustHaveFewerBytes).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit was merged in pull request #11.
This commit is contained in:
2026-09-07 16:48:29 +01:00
co-authored by Claude Sonnet 5
parent 4e2e05c1b9
commit 164dcbf367
3 changed files with 96 additions and 3 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ validate.Collect(rules...)
|---|---|
| Compose | `All`, `Collect` |
| Presence / equality | `Required`, `Equal`, `In`, `NotIn` |
| String length & content | `MinLength`, `MaxLength`, `Chars`, `ExceptChars`, `Prefix`, `Suffix`, `Contains`, `Match` |
| String length & content | `MinLength`, `MaxLength` (runes), `MinLengthBytes`, `MaxLengthBytes`, `Chars`, `ExceptChars`, `Prefix`, `Suffix`, `Contains`, `Match` |
| Formats | `Email`, `URL`, `UUID` |
| Numbers | `Min`, `Max`, `MinFloat32`, `MaxFloat32`, `MinFloat64`, `MaxFloat64` |
| Slices | `MinSize`, `MaxSize` |