Documentation ¶
Index ¶
- type Element
- type JSONQL
- type Lifo
- type Operator
- type Parser
- func (thisParser *Parser) Calculate(expression string) (string, error)
- func (thisParser *Parser) Evaluate(ts *Lifo, postfix bool) (string, error)
- func (thisParser *Parser) Init()
- func (thisParser *Parser) ParseRPN(tokens []string) (output *Lifo, err error)
- func (thisParser *Parser) Tokenize(exp string) (tokens []string)
- type Stack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element - an item in the stack
type JSONQL ¶
type JSONQL struct { Data interface{} SelectedField []string }
JSONQL - JSON Query Lang struct encapsulating the JSON data.
func NewQuery ¶
func NewQuery(jsonObject interface{}) *JSONQL
NewQuery - creates a new &JSONQL from an array of interface{} or a map of [string]interface{}
func NewStringQuery ¶
NewStringQuery - creates a new &JSONQL from raw JSON string
func (*JSONQL) Get ¶
Get - queries against the JSON using the conditions specified in the where stirng.
type Lifo ¶
type Lifo struct {
// contains filtered or unexported fields
}
Lifo - last in first out stack
func (*Lifo) Peep ¶
func (s *Lifo) Peep() (value interface{})
Peep - gets the last value in the stack without popping it out.
type Operator ¶
type Operator struct { Precedence int Eval func(symbolTable interface{}, left string, right string) (string, error) }
Operator - encapsulates the Precedence and behavior logic of the operators.
type Parser ¶
type Parser struct { Operators map[string]*Operator SymbolTable interface{} // contains filtered or unexported fields }
Parser - the main struct that contains operators, symbol table.
func (*Parser) Evaluate ¶
Evaluate - evaluates the token stack until only one (as the final result) is left.
func (*Parser) Init ¶
func (thisParser *Parser) Init()
Init - init inspects the Operators and learns how long the longest operator string is