jsonexp

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

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortDiffLines

func SortDiffLines(ds []DiffLine)

Types

type Array

type Array = []Value

type ArrayIndex

type ArrayIndex int

func (ArrayIndex) Node

func (ArrayIndex) Node()

type Boolean

type Boolean = bool

type Diff

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

func (*Diff) HasDiff

func (d *Diff) HasDiff() bool

func (*Diff) Lines

func (d *Diff) Lines() []DiffLine

func (*Diff) Text

func (d *Diff) Text() string

func (*Diff) WriteText

func (d *Diff) WriteText(w io.Writer) error

type DiffLine

type DiffLine struct {
	At   Path
	Type Operation
}

type Expression

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

func Parse

func Parse(b []byte) (*Expression, error)

func (*Expression) Diff

func (e *Expression) Diff(jsontext string) (*Diff, error)

func (*Expression) DiffValue

func (e *Expression) DiffValue(v Value) *Diff

type Node

type Node interface {
	Node()
	// contains filtered or unexported methods
}

type Number

type Number = float64

type Object

type Object = map[string]Value

type ObjectKey

type ObjectKey string

func (ObjectKey) Node

func (ObjectKey) Node()

type Operation

type Operation int
const (
	OpInsertion Operation = iota + 1
	OpDeletion
	OpSubStitution
)

func (Operation) String

func (o Operation) String() string

type Path

type Path []Node

func NewPath

func NewPath(nodes ...any) Path

func (Path) Clone

func (p Path) Clone() Path

func (Path) CloneAppend

func (p Path) CloneAppend(node Node) Path

func (Path) Compare

func (p Path) Compare(q Path) int

func (Path) Equal

func (p Path) Equal(q Path) bool

func (Path) IsAncestorOf

func (p Path) IsAncestorOf(child Path) bool

func (Path) Query

func (p Path) Query(value Value) (Value, error)

func (Path) String

func (p Path) String() string

type String

type String = string

type Value

type Value = any

Value is Object | Array | String | Number | Boolean | nil

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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