render

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONRenderer

type JSONRenderer struct {
	Type    RendererType
	Columns []string
	// contains filtered or unexported fields
}

JSONRenderer is the Renderer used to output JSON.

func NewJSONRenderer

func NewJSONRenderer(opts *JSONRendererOptions) JSONRenderer

NewJSONRenderer creates an instance of JSONRenderer.

func (JSONRenderer) AddSeparator

func (j JSONRenderer) AddSeparator()

AddSeparator not used on JSONRenderer.

func (JSONRenderer) AppendRow

func (j JSONRenderer) AppendRow(row *types.Row)

AppendRow adds a new row to the list.

func (JSONRenderer) Render

func (j JSONRenderer) Render() error

Render returns a JSON representation of the list content.

type JSONRendererOptions

type JSONRendererOptions struct {
	Writer      io.Writer
	Columns     []string
	OnlyEnabled bool
}

JSONRendererOptions contains options to render JSON content.

type RendererType

type RendererType string

RendererType represents all the existing renderers.

var (
	Markdown RendererType = "markdown"
	Table    RendererType = "table"
	Raw      RendererType = "raw"
	JSON     RendererType = "json"
)

type TableRenderer

type TableRenderer struct {
	Type    RendererType
	Columns []string
	// contains filtered or unexported fields
}

TableRenderer is the Renderer used to output tables.

func NewMarkdownRenderer

func NewMarkdownRenderer(opts *TableRendererOptions) TableRenderer

NewMarkdownRenderer creates an instance of TableRenderer.

func NewRawRenderer

func NewRawRenderer(opts *TableRendererOptions) TableRenderer

NewRawRenderer creates an instance of TableRenderer without borders.

func NewTableRenderer

func NewTableRenderer(opts *TableRendererOptions) TableRenderer

NewTableRenderer creates an instance of TableRenderer.

func (TableRenderer) AddSeparator

func (t TableRenderer) AddSeparator()

AddSeparator adds a separator line to the list.

func (TableRenderer) AppendRow

func (t TableRenderer) AppendRow(row *types.Row)

AppendRow adds a new row to the list.

func (TableRenderer) Render

func (t TableRenderer) Render() error

Render prints a table representation of row content.

type TableRendererOptions

type TableRendererOptions struct {
	Writer  io.Writer
	Columns []string
}

TableRendererOptions contains options to render a table.

Jump to

Keyboard shortcuts

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