output

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FullDateTime

func FullDateTime(t time.Time) string

FullDateTime formats t as "2006-01-02 15:04:05 UTC". Returns empty string for zero time.

func HumanTime

func HumanTime(t time.Time) string

HumanTime returns a relative human-readable time (e.g., "3 hours ago"). Returns empty string for zero time.

func PrintJSON

func PrintJSON(w io.Writer, v any) error

PrintJSON marshals items as JSON and writes to w. For proto messages, uses protojson for proper field naming.

Types

type Table

type Table[T any] struct {
	// contains filtered or unexported fields
}

Table renders items as an ASCII table.

func NewTable

func NewTable[T any](w io.Writer) *Table[T]

NewTable creates a new Table that writes to the given writer.

func (*Table[T]) AddField

func (t *Table[T]) AddField(name string, fn func(T) string)

AddField adds a column to the table with a header name and a field extraction function.

func (*Table[T]) Write

func (t *Table[T]) Write(items []T)

Write renders the table with the given items.

Jump to

Keyboard shortcuts

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