path

package
v0.0.0-...-685dc72 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 2 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextPath

type ContextPath struct {
	Path []interface{}
	Tag  string
}

func New

func New(tag string, path ...interface{}) ContextPath

New returns a new ContextPath with the given tag and path. It's a helper since go's literal syntax is quite verbose, especially with []interface{}{...}.

func (ContextPath) Append

func (c ContextPath) Append(e ...interface{}) ContextPath

Append returns a new ContextPath with the specified elements appended. The underlying array is sometimes reused, so if the original path might be used in future Append operations, the returned ContextPath should not be stored into a long-lived data structure. (Store a copy instead.)

func (ContextPath) Copy

func (c ContextPath) Copy() ContextPath

Copy returns an identical ContextPath that shares no state with the original. When storing a ContextPath into a data structure, usually a copy should be stored instead of the original (for example, Report does this), since Append sometimes modifies the path's underlying array in place.

func (ContextPath) Head

func (c ContextPath) Head() interface{}

Head returns the first element in the path, panics if empty.

func (ContextPath) Len

func (c ContextPath) Len() int

func (ContextPath) Pop

func (c ContextPath) Pop() ContextPath

func (ContextPath) String

func (c ContextPath) String() string

func (ContextPath) Tail

func (c ContextPath) Tail() ContextPath

Jump to

Keyboard shortcuts

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