Documentation
¶
Index ¶
- func FieldMap(anystruct any) (map[string]any, error)
- func FieldNames(anystruct any) ([]string, error)
- type JSONPrinter
- type Printer
- type Renderer
- type RendererPrinter
- type TablePrinter
- func (p *TablePrinter[T]) Print(s T, w io.Writer) error
- func (p *TablePrinter[T]) PrintAll(slice []T, w io.Writer) error
- func (p *TablePrinter[T]) Render(s T) ([]byte, error)
- func (p *TablePrinter[T]) RenderAll(slice []T) ([]byte, error)
- func (p *TablePrinter[T]) Reset()
- func (p *TablePrinter[T]) SetFieldNames(fieldNames []string)
- func (p *TablePrinter[T]) SetWithHeader(withHeader bool)
- type YAMLPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FieldMap ¶
FieldMap returns a map of all field names and values that can be used at runtime without panicking.
func FieldNames ¶
FieldNames returns a string list of all field names that can be used at runtime without panicking.
Types ¶
type JSONPrinter ¶
type JSONPrinter[T any] struct{}
func (*JSONPrinter[T]) PrintNewLine ¶
func (p *JSONPrinter[T]) PrintNewLine(w io.Writer) error
func (*JSONPrinter[T]) Render ¶
func (p *JSONPrinter[T]) Render(s T) ([]byte, error)
func (*JSONPrinter[T]) RenderAll ¶
func (p *JSONPrinter[T]) RenderAll(slice []T) ([]byte, error)
type RendererPrinter ¶
type TablePrinter ¶
type TablePrinter[T any] struct { sync.Mutex WithHeader bool // contains filtered or unexported fields }
func (*TablePrinter[T]) Render ¶
func (p *TablePrinter[T]) Render(s T) ([]byte, error)
func (*TablePrinter[T]) RenderAll ¶
func (p *TablePrinter[T]) RenderAll(slice []T) ([]byte, error)
func (*TablePrinter[T]) Reset ¶
func (p *TablePrinter[T]) Reset()
func (*TablePrinter[T]) SetFieldNames ¶
func (p *TablePrinter[T]) SetFieldNames(fieldNames []string)
SetFieldNames allows you to customize which field names are printed and in what order, instead of automatically deriving and printing all fields in their definition order.
func (*TablePrinter[T]) SetWithHeader ¶
func (p *TablePrinter[T]) SetWithHeader(withHeader bool)
SetWithHeader is a flag that determines whether the table is rendered with a header.
type YAMLPrinter ¶
type YAMLPrinter[T any] struct{}
func (*YAMLPrinter[T]) Render ¶
func (p *YAMLPrinter[T]) Render(s T) ([]byte, error)
func (*YAMLPrinter[T]) RenderAll ¶
func (p *YAMLPrinter[T]) RenderAll(slice []T) ([]byte, error)
Click to show internal directories.
Click to hide internal directories.