pathfinder

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pathfinder holds utilities for working with JSON path.

Package pathfinder holds utilities for working with different data formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicJSONPathFinder

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

DynamicJSONPathFinder is entity that has ability to obtain data from JSON from given expression. Entity knows how to determine whether expression matches https://github.com/pawelWritesCode/qjson or https://github.com/oliveagle/jsonpath syntax

func NewDynamicJSONPathFinder

func NewDynamicJSONPathFinder(qjson QJSONFinder, oliveagleJSONFinder OliveagleJSONFinder) *DynamicJSONPathFinder

func (DynamicJSONPathFinder) Find

func (d DynamicJSONPathFinder) Find(expr string, jsonBytes []byte) (interface{}, error)

Find obtains data from jsonBytes according to given expr. It accepts expr in format acceptable by pawelWritesCode/qjson or oliveagle/jsonpath libraries.

type GoccyGoYamlFinder

type GoccyGoYamlFinder struct{}

func NewGoccyGoYamlFinder

func NewGoccyGoYamlFinder() GoccyGoYamlFinder

func (GoccyGoYamlFinder) Find

func (g GoccyGoYamlFinder) Find(expr string, jsonBytes []byte) (interface{}, error)

type OliveagleJSONFinder

type OliveagleJSONFinder struct{}

OliveagleJSONFinder represents implementation of JSON path from https://github.com/oliveagle/jsonpath library

func NewOliveagleJSONFinder

func NewOliveagleJSONFinder() OliveagleJSONFinder

func (OliveagleJSONFinder) Find

func (o OliveagleJSONFinder) Find(expr string, jsonBytes []byte) (interface{}, error)

Find obtains data from jsonBytes according to given expr valid with pawelWritesCode/qjson library

type PathFinder

type PathFinder interface {

	// Find obtains data from bytes according to given expression
	Find(expr string, bytes []byte) (interface{}, error)
}

PathFinder describes ability to obtain node(s) from data in fixed data format

type QJSONFinder

type QJSONFinder struct{}

QJSONFinder represents implementation of JSON path from https://github.com/pawelWritesCode/qjson library

func NewQJSONFinder

func NewQJSONFinder() QJSONFinder

func (QJSONFinder) Find

func (Q QJSONFinder) Find(expr string, jsonBytes []byte) (interface{}, error)

Find obtains data from jsonBytes according to given expr valid with oliveagle/jsonpath library

Jump to

Keyboard shortcuts

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