table

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 4 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

Overview

Package table merges two table engines behind one facade: aquasecurity (StyleAqua, the default: bordered unicode tables) and rodaine (StyleRodaine: borderless padded columns, most script-friendly). Engines live in subpackages with their upstream APIs intact; new styles arrive as new Style values without breaking callers.

Fork attributions:

engine aqua: github.com/aquasecurity/table, MIT, Copyright (c) 2022 Aqua Security
engine rodaine: github.com/rodaine/table, MIT, Copyright (c) 2015 Chris Roche

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Table)

Option tunes a Table at construction.

func WithStyle

func WithStyle(s Style) Option

WithStyle selects the engine. Default StyleAqua.

type Style

type Style int

Style selects the rendering engine. New styles arrive as new values; unknown values fail Render instead of silently picking one.

const (
	// StyleAqua is bordered unicode output, the default look.
	StyleAqua Style = iota
	// StyleRodaine is borderless padded columns for script-friendly output.
	StyleRodaine
)

func (Style) String

func (s Style) String() string

String names the style for errors and docs.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table buffers a header plus string rows and renders on demand.

func New

func New(w io.Writer, opts ...Option) *Table

New builds a Table writing to w with StyleAqua unless overridden.

func (*Table) AddRow

func (t *Table) AddRow(cols ...string)

AddRow appends one row.

func (*Table) AddRows

func (t *Table) AddRows(rows ...[]string)

AddRows appends many rows.

func (*Table) Render

func (t *Table) Render() error

Render draws the table with the selected engine. Rows normalize to the header width (short rows pad empty, long rows truncate), matching script-friendly expectations on both engines.

func (*Table) SetHeaders

func (t *Table) SetHeaders(cols ...string)

SetHeaders replaces the header row.

Directories

Path Synopsis
Package aqua renders bordered unicode tables.
Package aqua renders bordered unicode tables.
Package rodaine renders borderless padded-column tables.
Package rodaine renders borderless padded-column tables.

Jump to

Keyboard shortcuts

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