jsonpath

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Simple Implementation of JSON Path for state machine

Index

Constants

This section is empty.

Variables

View Source
var NOT_FOUND_ERROR = errors.New("Not Found")

Functions

func ParsePathString

func ParsePathString(path_string string) ([]string, error)

ParsePathString parses a path string

Types

type Path

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

func NewPath

func NewPath(path_string string) (*Path, error)

NewPath takes string returns JSONPath Object

func (*Path) Get

func (path *Path) Get(input interface{}) (value interface{}, err error)

Get returns interface from Path

func (*Path) GetBool

func (path *Path) GetBool(input interface{}) (*bool, error)

GetBool returns Bool from Path

func (*Path) GetMap

func (path *Path) GetMap(input interface{}) (output map[string]interface{}, err error)

GetMap returns Map from Path

func (*Path) GetNumber

func (path *Path) GetNumber(input interface{}) (*float64, error)

GetNumber returns Number from Path

func (*Path) GetSlice added in v1.0.3

func (path *Path) GetSlice(input interface{}) (output []interface{}, err error)

func (*Path) GetString

func (path *Path) GetString(input interface{}) (*string, error)

GetString returns String from Path

func (*Path) GetTime

func (path *Path) GetTime(input interface{}) (*time.Time, error)

GetTime returns Time from Path

func (*Path) MarshalJSON

func (path *Path) MarshalJSON() ([]byte, error)

MarshalJSON converts path to json string

func (*Path) Set

func (path *Path) Set(input interface{}, value interface{}) (output map[string]interface{}, err error)

Set sets a Value in a map with Path

func (*Path) String

func (path *Path) String() string

func (*Path) UnmarshalJSON

func (path *Path) UnmarshalJSON(b []byte) error

UnmarshalJSON makes a path out of a json string

Jump to

Keyboard shortcuts

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