Documentation
¶
Overview ¶
Package csvparam parses comma-separated flag and query parameter values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse splits raw on commas, trims whitespace, removes empty tokens, deduplicates, and returns tokens in sorted order. Blank input returns nil.
func ParseAllowed ¶
ParseAllowed parses raw using Parse and validates every token against allowed. All unknown tokens are collected before returning the error so callers receive the full set of violations in a single pass.
Types ¶
type UnknownTokenError ¶
type UnknownTokenError struct {
Param string
Allowed []string
// Tokens holds the unknown input values. They are excluded from the Error()
// message — consume via structured slog fields, never inline into responses.
Tokens []string
}
UnknownTokenError reports that one or more CSV tokens were not in the allowed set. The raw tokens are intentionally omitted from the Error() message so public validation errors do not echo user-supplied input (XSS / log injection prevention). Use the Tokens field for structured logging only.
func (UnknownTokenError) Error ¶
func (e UnknownTokenError) Error() string