utils

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CsvPretty

func CsvPretty(
	header []string,
	rows [][]string,
	sortRows bool,
) string

Fails if the header is shorter than any of the rows

func CsvPrettyMap

func CsvPrettyMap(keyName string, valueName string, m map[string]string) string

func CsvPrettyOmitEmptyCols added in v0.0.25

func CsvPrettyOmitEmptyCols(
	header []string,
	rows [][]string,
	sortRows bool,
) string

CsvPrettyOmitEmptyCols renders the table like CsvPretty, but omits any column whose data cells are all empty (its header is dropped along with it). This lets callers always pass the full set of columns and have the optional ones (e.g. a color or scope dimension that no row populates) disappear automatically.

Fails if the header is shorter than any of the rows.

func Filter

func Filter[T any](slice []T, predicate func(x T) bool) []T

func MapGetOrPutDefault

func MapGetOrPutDefault[T any](m map[string]T, key string, getDefault func() T) T

func MaxBigInt

func MaxBigInt(a *big.Int, b *big.Int) *big.Int

func MinBigInt

func MinBigInt(a *big.Int, b *big.Int) *big.Int

func NestedMapGetOrPutDefault

func NestedMapGetOrPutDefault[T any](m map[string]map[string]T, key1 string, key2 string, getDefault func() T) T

func NonExhaustiveMatchPanic

func NonExhaustiveMatchPanic[T any](value any) T

func NonNeg

func NonNeg(a *big.Int) *big.Int

Types

This section is empty.

Jump to

Keyboard shortcuts

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