litter – github.com/sanity-io/litter Index | Files

package litter

import "github.com/sanity-io/litter"

Index

Variables

var Config = Options{
	StripPackageNames: false,
	HidePrivateFields: true,
	FieldExclusions:   regexp.MustCompile(`^(XXX_.*)$`),
	Separator:         " ",
}

Config is the default config used when calling Dump

Functions

func Dump

func Dump(value ...interface{})

Dump a value to stdout

func Sdump

func Sdump(value ...interface{}) string

Sdump dumps a value to a string

Types

type Dumper

type Dumper interface {
	LitterDump(w io.Writer)
}

Dumper is the interface for implementing custom dumper for your types.

type Options

type Options struct {
	Compact           bool
	StripPackageNames bool
	HidePrivateFields bool
	HideZeroValues    bool
	FieldExclusions   *regexp.Regexp
	FieldFilter       func(reflect.StructField, reflect.Value) bool
	HomePackage       string
	Separator         string
	StrictGo          bool
	DumpFunc          func(reflect.Value, io.Writer) bool

	// DisablePointerReplacement, if true, disables the replacing of pointer data with variable names
	// when it's safe. This is useful for diffing two structures, where pointer variables would cause
	// false changes. However, circular graphs are still detected and elided to avoid infinite output.
	DisablePointerReplacement bool
}

Options represents configuration options for litter

func (Options) Dump

func (o Options) Dump(values ...interface{})

Dump a value to stdout according to the options

func (Options) Sdump

func (o Options) Sdump(values ...interface{}) string

Sdump dumps a value to a string according to the options

Source Files

dump.go pointers.go print.go util.go

Version
v1.4.0
Published
Feb 3, 2021
Platform
windows/amd64
Imports
10 packages
Last checked
now

Tools for package owners.