render

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 10 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 render prints decoded NATS messages for a person (pretty) or for a program (one JSON object per line).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTerminal

func IsTerminal(w io.Writer) bool

IsTerminal reports whether w is a character device, which is where colors help.

func IsTerminalInput

func IsTerminalInput(r io.Reader) bool

IsTerminalInput reports whether r is a character device, so a command does not wait for input that a person did not pipe in.

Types

type Envelope

type Envelope struct {
	Time    time.Time
	Subject string
	Reply   string
	Header  codec.Header
	Data    []byte
	Result  codec.Result
}

Envelope is one received message with its decoded payload.

type Mode

type Mode string

Mode selects the output format.

const (
	ModePretty Mode = "pretty"
	ModeJSON   Mode = "json"
	ModeRaw    Mode = "raw"
)

The output modes.

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode validates s.

type Printer

type Printer struct {
	W           io.Writer
	Mode        Mode
	Color       bool
	ShowHeaders bool
}

Printer writes envelopes to W.

func (*Printer) Print

func (p *Printer) Print(e Envelope) error

Print writes one envelope.

Jump to

Keyboard shortcuts

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