jsonpath

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package jsonpath holds utilities for working with JSON path.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicJSONPathResolver

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

DynamicJSONPathResolver 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 NewDynamicJSONPathResolver

func NewDynamicJSONPathResolver(qjson QJSONResolver, oliveagleJSONpath OliveagleJSONpath) *DynamicJSONPathResolver

func (DynamicJSONPathResolver) Resolve

func (d DynamicJSONPathResolver) Resolve(expr string, jsonBytes []byte) (interface{}, error)

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

type OliveagleJSONpath

type OliveagleJSONpath struct{}

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

func NewOliveagleJSONpath

func NewOliveagleJSONpath() OliveagleJSONpath

func (OliveagleJSONpath) Resolve

func (o OliveagleJSONpath) Resolve(expr string, jsonBytes []byte) (interface{}, error)

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

type QJSONResolver

type QJSONResolver struct{}

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

func NewQJSONResolver

func NewQJSONResolver() QJSONResolver

func (QJSONResolver) Resolve

func (Q QJSONResolver) Resolve(expr string, jsonBytes []byte) (interface{}, error)

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

type Resolver

type Resolver interface {
	// Resolve obtains data from jsonBytes according to given expression
	Resolve(expr string, jsonBytes []byte) (interface{}, error)
}

Resolver describes ability to obtain node(s) from JSON

Jump to

Keyboard shortcuts

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