format

package
v0.0.0-...-6b2826c Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownFormat = errors.New("unknown format")

Functions

func PropHint

func PropHint[T any](p Prop, name PropHintName, defaultValue T) T

func Register

func Register(format Format, writer Writer)

func Write

func Write(format Format, writer io.Writer, hints Hints, data ...any) error

Types

type Format

type Format string

func Available

func Available() []Format

type Hints

type Hints struct {
	Props      []Prop
	OutputMode OutputMode
}

type OutputMode

type OutputMode string
const (
	OutputModeWide    OutputMode = "wide"
	OutputModeCompact OutputMode = "compact"
)

type Prop

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

func NewProp

func NewProp(name, label string, funcs ...PropHintFunc) Prop

func (*Prop) Label

func (p *Prop) Label() string

func (*Prop) Name

func (p *Prop) Name() string

type PropHintFunc

type PropHintFunc func() (PropHintName, any)

func WithPropHint

func WithPropHint(name PropHintName, value any) PropHintFunc

type PropHintName

type PropHintName string

type Registry

type Registry map[Format]Writer

type Writer

type Writer interface {
	Write(writer io.Writer, hints Hints, data ...any) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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