pathfinder

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 11 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 AntchfxHTMLFinder added in v1.2.0

type AntchfxHTMLFinder struct{}

AntchfxHTMLFinder represents implementation of HTMLPath from https://github.com/antchfx/htmlquery

func NewAntchfxHTMLFinder added in v1.2.0

func NewAntchfxHTMLFinder() AntchfxHTMLFinder

func (AntchfxHTMLFinder) Find added in v1.2.0

func (a AntchfxHTMLFinder) Find(expr string, b []byte) (any, error)

type AntchfxJSONQueryFinder added in v1.2.0

type AntchfxJSONQueryFinder struct{}

AntchfxJSONQueryFinder represents implementation of JSON path from https://github.com/antchfx/jsonquery library

func NewAntchfxJSONQueryFinder added in v1.2.0

func NewAntchfxJSONQueryFinder() AntchfxJSONQueryFinder

func (AntchfxJSONQueryFinder) Find added in v1.2.0

func (a AntchfxJSONQueryFinder) Find(expr string, b []byte) (any, error)

Find obtains data from jsonBytes according to given expr valid with antchfx/jsonquery library

type AntchfxXMLFinder added in v0.13.0

type AntchfxXMLFinder struct{}

AntchfxXMLFinder represents implementation of XPath from https://github.com/antchfx/xmlquery

func NewAntchfxXMLFinder added in v0.13.0

func NewAntchfxXMLFinder() AntchfxXMLFinder

func (AntchfxXMLFinder) Find added in v0.13.0

func (a AntchfxXMLFinder) Find(expr string, bytes []byte) (any, error)

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/tidwall/gjson, https://github.com/oliveagle/jsonpath or https://github.com/antchfx/jsonquery syntax

func NewDynamicJSONPathFinder

func NewDynamicJSONPathFinder(gjson GJSONFinder, oliveagleJSONFinder OliveagleJSONFinder, antchfxJSONQuery AntchfxJSONQueryFinder) *DynamicJSONPathFinder

func (DynamicJSONPathFinder) Find

func (d DynamicJSONPathFinder) Find(expr string, jsonBytes []byte) (any, error)

Find obtains data from jsonBytes according to given expr. It accepts expr in format acceptable by tidwall/gjson, oliveagle/jsonpath or antchfx/jsonquery libraries.

type GJSONFinder added in v1.1.0

type GJSONFinder struct{}

GJSONFinder represents implementation of JSON path from https://github.com/tidwall/gjson library

func NewGJSONFinder added in v1.1.0

func NewGJSONFinder() GJSONFinder

func (GJSONFinder) Find added in v1.1.0

func (G GJSONFinder) Find(expr string, b []byte) (any, error)

Find obtains data from jsonBytes according to given expr valid with tidwall/gjson library

type GoccyGoYamlFinder

type GoccyGoYamlFinder struct{}

func NewGoccyGoYamlFinder

func NewGoccyGoYamlFinder() GoccyGoYamlFinder

func (GoccyGoYamlFinder) Find

func (g GoccyGoYamlFinder) Find(expr string, jsonBytes []byte) (any, 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) (any, error)

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

type PathFinder

type PathFinder interface {

	// Find obtains data from bytes according to given expression
	Find(expr string, bytes []byte) (any, 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) (any, error)

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

Jump to

Keyboard shortcuts

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