structexplorer

package module
v0.0.0-...-d394d16 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 14 Imported by: 0

README

structexplorer

Go GoDoc codecov

A Go Struct Explorer Service (http.Handler) that offers remote inspection of any Go struct and its references.

install

go get github.com/emicklei/structexplorer

usage

structexplorer.NewService("some structure", yourStruct).Start()

or as HTTP Handler:

s := structexplorer.NewService("some structure", yourStruct)
http.ListenAndServe(":8080", s)

then a HTTP service will be started

INFO starting go struct explorer at http://localhost:5656

syntax

  • if a value is a pointer to a standard type then the display value has a "*" prefix
  • if a value is a reflect.Value then the display value has a "~" prefix

buttons

  • ⇊ : explore one or more selected values from the list and put them below
  • ⇉ : explore one or more selected values from the list and put them on the right
  • z : show or hide fields which currently have zero value ("",0,nil,false)
  • x : remove the struct from the page

Note: if the list contains just one structural value then selecting it can be skipped for ⇊ and ⇉.

examples

See folder examples for simple programs.

example of exploring a yaegi program

program

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Uses 5656 as the default
	HTTPPort int
	// Uses http.DefaultServeMux as default
	ServeMux *http.ServeMux
	// Uses "/" as default
	HTTPBasePath string
}

Options can be used to configure a Service on startup.

type Service

type Service interface {
	http.Handler
	// Start accepts 0 or 1 Options
	Start(opts ...Options)
}

Service is an HTTP Handler to explore one or more values (structures).

func NewService

func NewService(labelValuePairs ...any) Service

NewService creates a new to explore one or more values (structures).

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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