...

Package jmespath

import "github.com/jmespath/go-jmespath"
Overview
Index
Subdirectories

Overview ▾

Constants

const (
    ASTEmpty astNodeType = iota
    ASTComparator
    ASTCurrentNode
    ASTExpRef
    ASTFunctionExpression
    ASTField
    ASTFilterProjection
    ASTFlatten
    ASTIdentity
    ASTIndex
    ASTIndexExpression
    ASTKeyValPair
    ASTLiteral
    ASTMultiSelectHash
    ASTMultiSelectList
    ASTOrExpression
    ASTAndExpression
    ASTNotExpression
    ASTPipe
    ASTProjection
    ASTSubexpression
    ASTSlice
    ASTValueProjection
)
func Search(expression string, data interface{}) (interface{}, error)

Search evaluates a JMESPath expression against input data and returns the result.

type ASTNode

ASTNode represents the abstract syntax tree of a JMESPath expression.

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

func (ASTNode) PrettyPrint

func (node ASTNode) PrettyPrint(indent int) string

PrettyPrint will pretty print the parsed AST. The AST is an implementation detail and this pretty print function is provided as a convenience method to help with debugging. You should not rely on its output as the internal structure of the AST may change at any time.

func (ASTNode) String

func (node ASTNode) String() string

type JMESPath

JMESPath is the representation of a compiled JMES path query. A JMESPath is safe for concurrent use by multiple goroutines.

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

func Compile

func Compile(expression string) (*JMESPath, error)

Compile parses a JMESPath expression and returns, if successful, a JMESPath object that can be used to match against data.

func MustCompile

func MustCompile(expression string) *JMESPath

MustCompile is like Compile but panics if the expression cannot be parsed. It simplifies safe initialization of global variables holding compiled JMESPaths.

func (*JMESPath) Search

func (jp *JMESPath) Search(data interface{}) (interface{}, error)

Search evaluates a JMESPath expression against input data and returns the result.

type Lexer

Lexer contains information about the expression being tokenized.

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

func NewLexer

func NewLexer() *Lexer

NewLexer creates a new JMESPath lexer.

type Parser

Parser holds state about the current expression being parsed.

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

func NewParser

func NewParser() *Parser

NewParser creates a new JMESPath parser.

func (*Parser) Parse

func (p *Parser) Parse(expression string) (ASTNode, error)

Parse will compile a JMESPath expression.

type SyntaxError

SyntaxError is the main error used whenever a lexing or parsing error occurs.

type SyntaxError struct {
    Expression string // Expression that generated a SyntaxError
    Offset     int    // The location in the string where the error occurred
    // contains filtered or unexported fields
}

func (SyntaxError) Error

func (e SyntaxError) Error() string

func (SyntaxError) HighlightLocation

func (e SyntaxError) HighlightLocation() string

HighlightLocation will show where the syntax error occurred. It will place a "^" character on a line below the expression at the point where the syntax error occurred.

Subdirectories

Name Synopsis
..
cmd
jpgo Basic command line interface for debug and testing purposes.
fuzz