list

package
v0.0.0-...-57c4ae3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package list provides a utility function to quickly print a table based on the element fields of a slice. This package is currently used for franz - while it can, in theory, be used for other packages, there are still various edge cases that should be taken care of, such as passing in something different than a slice or a slice of interface{}.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatTable

func FormatTable(entries interface{}, caption string) (string, error)

FormatTable takes a slice with a distinct type as argument and prints it as a table, one row for for each entry in the slice. The columns are based on the statically declared element type of the slice, so note that passing in e.g. []interface{} does not make much sense. By default, the field name is taken as the column name. This can be overridden by setting a tag like so: `header:"New Column Name"`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL