objview

package
v1.7.0-dev-20191021 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatters

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

Formatters is a collection of functions that can format the values on certain paths (e.g. myStruct/myField/mySubfield) in an object hierarchy in an application-specific way (e.g. render a URL string as a link).

func NewFormatters

func NewFormatters() *Formatters

NewFormatters instantiates a new Formatters collection.

func (*Formatters) Add

func (f *Formatters) Add(pattern string, fun func(string, interface{}) interface{}) *Formatters

Add registers a formatting function that is applied to paths matching the given pattern.

type Representer

type Representer interface {
	Representation() interface{}
}

Representer is implemented by objects wishing to provide their own representation for use in the object viewer.

type View

type View struct {
	*dom.Div
	// contains filtered or unexported fields
}

View is a DOM element that can render arbitrary go structures as tables for inspection purposes. It supports a stack of objects with breadcrumb navigation.

func NewView

func NewView() *View

NewView instantiates a new object viewer.

func (*View) Expandable

func (j *View) Expandable(path string, obj interface{}) interface{}

Expandable is a formatting function that formats a value as a link that pushes that value onto the object viewer stack.

func (*View) NewPusher

func (j *View) NewPusher(label string, name string, obj interface{}, fmts *Formatters) interface{}

NewPusher returns a link which, when clicked, pushes the given object onto the stack.

func (*View) Pop

func (j *View) Pop()

Pop navigates downwards in the object stack.

func (*View) Push

func (j *View) Push(name string, obj interface{}, fmt *Formatters)

Push pushes a new object onto the stack with the given name and formatters. Any objects in the navigation bar past the currently selected one are discarded and replaced with the new object.

func (*View) Set

func (j *View) Set(name string, obj interface{}, fmt *Formatters)

Set sets the viewer stack to the single passed object, with the given name (in the navigation bar) and formatters.

Jump to

Keyboard shortcuts

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