Documentation
¶
Overview ¶
Package truncation provides string truncation with metadata tracking.
Index ¶
Constants ¶
View Source
const DefaultMaxLength = 200
Variables ¶
This section is empty.
Functions ¶
func FormatTruncatedLength ¶
FormatTruncatedLength returns a display string like "500 chars".
Types ¶
type Config ¶
type Config struct {
MaxLength int
Expand map[string]bool // fields to never truncate
Full bool // expand all fields
}
Config holds truncation settings.
type TruncatingWriter ¶
type TruncatingWriter struct {
// contains filtered or unexported fields
}
TruncatingWriter wraps a ResultWriter and applies truncation to string values.
func NewTruncatingWriter ¶
func NewTruncatingWriter(inner output.ResultWriter, cfg Config) *TruncatingWriter
NewTruncatingWriter creates a truncation decorator around a ResultWriter.
func (*TruncatingWriter) Flush ¶
func (tw *TruncatingWriter) Flush() error
func (*TruncatingWriter) WritePagination ¶
func (tw *TruncatingWriter) WritePagination(p *output.Pagination) error
Click to show internal directories.
Click to hide internal directories.