inspect

package
v29.10.0-rc.1+incompat... Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 9 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inspect

func Inspect(out io.Writer, references []string, tmplStr string, getRef GetRefFunc) error

Inspect fetches objects by reference using GetRefFunc and writes the json representation to the output writer.

Types

type GetRefFunc

type GetRefFunc func(ref string) (any, []byte, error)

GetRefFunc is a function which used by Inspect to fetch an object from a reference

type Inspector

type Inspector interface {
	// Inspect writes the raw element in JSON format.
	Inspect(typedElement any, rawElement []byte) error
	// Flush writes the result of inspecting all elements into the output stream.
	Flush() error
}

Inspector defines an interface to implement to process elements

func NewIndentedInspector

func NewIndentedInspector(out io.Writer) Inspector

NewIndentedInspector generates a new inspector with an indented representation of elements.

func NewJSONInspector

func NewJSONInspector(out io.Writer) Inspector

NewJSONInspector generates a new inspector with a compact representation of elements.

func NewTemplateInspectorFromString

func NewTemplateInspectorFromString(out io.Writer, tmplStr string) (Inspector, error)

NewTemplateInspectorFromString creates a new TemplateInspector from a string which is compiled into a template.

type TemplateInspector

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

TemplateInspector uses a text template to inspect elements.

func NewTemplateInspector

func NewTemplateInspector(out io.Writer, tmpl *template.Template) *TemplateInspector

NewTemplateInspector creates a new inspector with a template.

func (*TemplateInspector) Flush

func (i *TemplateInspector) Flush() error

Flush writes the result of inspecting all elements into the output stream.

func (*TemplateInspector) Inspect

func (i *TemplateInspector) Inspect(typedElement any, rawElement []byte) error

Inspect executes the inspect template. It decodes the raw element into a map if the initial execution fails. This allows docker cli to parse inspect structs injected with Swarm fields.

Jump to

Keyboard shortcuts

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