types

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFieldMissing = fmt.Errorf("No field with such name")
View Source
var ErrIdxOutOfBounds = fmt.Errorf("Index out of bounds")
View Source
var ErrWrongVisit = fmt.Errorf("Not possible to visit a field for the value of this type")

Functions

This section is empty.

Types

type Node

type Node interface {
	Visit(field PathElement) (Node, error)
	NodeType() NodeType
	Value() any
	GetField(field PathElement) (any, error)
	SetField(field PathElement, value any) error
	DeleteField(field PathElement) error
}

type NodeType

type NodeType string
var (
	NodeTypeString NodeType = "string"
	NodeTypeNumber NodeType = "number"
	NodeTypeBool   NodeType = "bool"
	NodeTypeObject NodeType = "object"
	NodeTypeArray  NodeType = "array"
	NodeTypeNull   NodeType = "null"
)

type PathElement added in v0.0.8

type PathElement struct {
	ObjectField string
	ArrayIdx    int
}

func (PathElement) String added in v0.0.8

func (pe PathElement) String() string

type PathElementSlice added in v0.0.8

type PathElementSlice []PathElement

func (PathElementSlice) String added in v0.0.8

func (sl PathElementSlice) String() string

type RootNode added in v0.0.8

type RootNode interface {
	Node
	Serialize() ([]byte, error)
}

Jump to

Keyboard shortcuts

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