Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTheme = Theme{ String: RGB{138, 201, 38}, Quotes: RGB{112, 214, 255}, Bool: RGB{249, 87, 56}, Number: RGB{10, 178, 242}, Types: RGB{0, 150, 199}, Address: RGB{205, 93, 0}, PointerTag: RGB{110, 110, 110}, Nil: RGB{219, 57, 26}, Func: RGB{160, 90, 220}, Fields: RGB{189, 176, 194}, Chan: RGB{195, 154, 76}, UnsafePointer: RGB{89, 193, 180}, Braces: RGB{185, 86, 86}, }
Functions ¶
Types ¶
type Dumper ¶ added in v0.8.0
type Dumper struct {
// Indentation is an optional string used for indentation.
// The default value is a string of three spaces.
Indentation string
// ShowPrimitiveNamedTypes determines whether to show primitive named types.
ShowPrimitiveNamedTypes bool
// HidePrivateFields allows you to optionally hide struct's unexported fields from being printed.
HidePrivateFields bool
// Theme allows you to define your preferred styling.
Theme Theme
// contains filtered or unexported fields
}
Dumper provides an elegant interface to pretty print any variable of any type in a colored and structured format.
The zero value for Dumper is a theme-less Dumper ready to use.
func (*Dumper) Fprint ¶ added in v0.8.0
Fprint formats `v` and writes the result to `dst`.
It returns a write error if encountered while writing to `dst`.
func (*Dumper) Fprintln ¶ added in v0.8.0
Fprintln formats `v`, appends a new line, and writes the result to `dst`.
It returns a write error if encountered while writing to `dst`.
func (*Dumper) Print ¶ added in v0.8.0
Print formats `v` and writes the result to standard output.
It returns a write error if encountered while writing to standard output.
func (*Dumper) Println ¶ added in v0.8.0
Println formats `v`, appends a new line, and writes the result to standard output.
It returns a write error if encountered while writing to standard output.
type RGB ¶ added in v0.8.0
type RGB struct {
R, G, B int
}
RGB implements Style and allows you to define your style as an RGB value, it uses ANSI escape sequences under the hood.
type Theme ¶ added in v0.8.0
type Theme struct {
// String defines the style used for strings
String Style
// Quotes defines the style used for quotes (") around strings.
Quotes Style
// Bool defines the style used for boolean values.
Bool Style
// Number defines the style used for numbers, including all types of integers, floats and complex numbers.
Number Style
// Types defines the style used for defined and/or structural types, eg., slices, structs, maps...
Types Style
// Nil defines the style used for nil.
Nil Style
// Func defines the style used for functions.
Func Style
// Chan defines the style used for channels.
Chan Style
// UnsafePointer defines the style used for unsafe pointers.
UnsafePointer Style
// Address defines the style used for address symbol '&'.
Address Style
// PointerTag defines the style used for pointer tags, typically the pointer id '#x' and the recursive reference '@x'.
PointerTag Style
// Fields defines the style used for struct fields.
Fields Style
// Braces defines the style used for braces '{}' in structural types.
Braces Style
}
Theme allows you to define your preferred styling for Dumper.



