Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidFilter = errors.New("invalid filter: expected key=value") ErrUnknownFilterKey = errors.New("unknown filter key") )
Sentinel errors for filter parsing.
Functions ¶
func ApplyFilters ¶
ApplyFilters filters a slice of structs by key=value pairs. Keys are matched against table/json struct tags (case-insensitive). Values use case-insensitive substring matching. Multiple filters are AND-ed together. Empty filters returns data unchanged.
Types ¶
type Formatter ¶
type Formatter interface {
// Format writes the data to the writer in the formatter's format.
Format(w io.Writer, data any) error
}
Formatter defines the interface for output formatting.
func NewFormatter ¶
NewFormatter creates a Formatter for the given format string.
type TableFormatter ¶
type TableFormatter struct{}
TableFormatter outputs data as an aligned table using text/tabwriter.
Click to show internal directories.
Click to hide internal directories.