json_traversal

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Executable

func Executable()

func JsonFindByPath

func JsonFindByPath(obj interface{}, path []*PathComponent) interface{}

func PathString

func PathString(components []*PathComponent) []string

func RunFindByPath

func RunFindByPath()

func RunFindByPathNestedItems

func RunFindByPathNestedItems()

func RunFindByRegex

func RunFindByRegex()

func RunFindInJsonByRegex

func RunFindInJsonByRegex(args *FindByRegexArgs)

Types

type FindByRegexArgs

type FindByRegexArgs struct {
	File      string
	Regex     string
	StartPath []string
}

func (*FindByRegexArgs) Json

func (a *FindByRegexArgs) Json() string

func (*FindByRegexArgs) StartPathSelector

func (a *FindByRegexArgs) StartPathSelector() []*Selector

type KeyMatch

type KeyMatch struct {
	Path  []*PathComponent
	Value string
}

func JsonFindByRegex

func JsonFindByRegex(obj interface{}, path []*PathComponent, re *regexp.Regexp) []*KeyMatch

func (*KeyMatch) PathString

func (k *KeyMatch) PathString() []string

type PathComponent

type PathComponent struct {
	ArrayIndex *int
	MapKey     *string
	MapValue   *string
}

func NewArrayPathComponent

func NewArrayPathComponent(index int) *PathComponent

func NewMapKeyPathComponent

func NewMapKeyPathComponent(key string) *PathComponent

func NewMapValuePathComponent

func NewMapValuePathComponent(key string) *PathComponent

func (*PathComponent) PathString

func (p *PathComponent) PathString() string

func (*PathComponent) RawString

func (p *PathComponent) RawString() string

type Result

type Result struct {
	Path  []*PathComponent
	Value interface{}
}

func JsonFindBySelector

func JsonFindBySelector(obj interface{}, selector []*Selector, context []*PathComponent) []*Result

type Selector

type Selector struct {
	IsGlob  bool
	IsArray bool
	Key     *string
}

Jump to

Keyboard shortcuts

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