reporting

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 3 Imported by: 3

Documentation

Overview

Package reporting provides structures and functions for reporting of errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToGolangPath

func ToGolangPath(p *Path) string

Translate the path to a Golang access path.

The name segments are expected to denote the names of the properties in Golang, not JSON property names.

func ToJSONPath

func ToJSONPath(p *Path) string

Translate the path to a JSON path.

The name segments are expected to denote the names of the properties in JSON property names, not Golang property names.

func ToRelativeXPath

func ToRelativeXPath(
	p *Path,
) string

Generate a relative XPath based on the path segments.

Leave out the leading slash (`/`). This is helpful if we want to embed the error report in a larger document with a prefix *etc.*

Types

type IndexSegment

type IndexSegment struct {
	Index int
}

type NameSegment

type NameSegment struct {
	Name string
}

type Path

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

func (*Path) OverSegments

func (p *Path) OverSegments(callback func(interface{}))

Apply the `callback` on each segment.

The segment object is either a NameSegment or a IndexSegment.

func (*Path) PrependIndex

func (p *Path) PrependIndex(segment *IndexSegment)

Prepend the index segment to the path.

func (*Path) PrependName

func (p *Path) PrependName(segment *NameSegment)

Prepend the name segment to the path.

Jump to

Keyboard shortcuts

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