display

package
v1.0.49 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySlices = errors.New("empty slices")

ErrEmptySlices signals that empty slices has been provided

View Source
var ErrNilDataLines = errors.New("nil lineData slice")

ErrNilDataLines signals that a nil data lines slice has been provided

View Source
var ErrNilDisplayByteSliceHandler = errors.New("nil display byte slice handler")

ErrNilDisplayByteSliceHandler signals that a nil display byte slice handler has been provided

View Source
var ErrNilHeader = errors.New("nil header")

ErrNilHeader signals that a nil header slice has been provided

View Source
var ErrNilLineDataInSlice = errors.New("nil line data element found in slice")

ErrNilLineDataInSlice signals that a nil line data element was found in slice

View Source
var ErrNilValuesOfLineDataInSlice = errors.New("nil line data values slice found")

ErrNilValuesOfLineDataInSlice signals that a line data element has nil values

Functions

func CreateTableString

func CreateTableString(header []string, data []*LineData) (string, error)

CreateTableString creates an ASCII table having header as table header and a LineData slice as table rows It automatically resize itself based on the lengths of every cell

func DisplayByteSlice added in v1.0.41

func DisplayByteSlice(slice []byte) string

DisplayByteSlice converts the provided byte slice to its string representation using displayByteSlice function pointer

func Headline

func Headline(message string, timestamp string, delimiter string) string

Headline will build a headline message given a delimiter string

timestamp parameter will be printed before the repeating delimiter

func SetDisplayByteSlice added in v1.0.41

func SetDisplayByteSlice(f func(slice []byte) string) error

SetDisplayByteSlice sets the converter function from byte slice to string default, this will call hex.EncodeToString. It will also change the logger's convert function so that the messages will be consistent

func ToHexShort added in v1.0.41

func ToHexShort(slice []byte) string

ToHexShort generates a short-hand of provided bytes slice showing only the first 3 and the last 3 bytes as hex in total, the resulting string is maximum 13 characters long

Types

type LineData

type LineData struct {
	Values              []string
	HorizontalRuleAfter bool
}

LineData represents a displayable table line

func NewLineData

func NewLineData(horizontalRuleAfter bool, values []string) *LineData

NewLineData creates a new LineData object

Jump to

Keyboard shortcuts

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