tree

package module
v0.0.0-...-d8009f6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

README

expression-tree

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNodeStack

func NewNodeStack(bufSize int) *nodeStack

func NewStringStack

func NewStringStack(bufSize int) *stringStack

Types

type Expression

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

Expression represents the boolean expression tree and allows basic operation on this

func InfixToExp

func InfixToExp(infixExp string) (*Expression, error)

InfixToExp uses Golang text/scanner and Shunting-yard algorithm to parse expression to tree

func (*Expression) FindStatement

func (e *Expression) FindStatement(key string) *Node

FindStatement returns the node which contains the key

func (*Expression) RemoveStatement

func (e *Expression) RemoveStatement(key string) error

RemoveStatement finds a key in the expression and remove it from the tree return err if key can be found the first node will be removed

func (*Expression) ToQuery

func (e *Expression) ToQuery() string

ToQuery returns query from the tree

type Node

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

func (*Node) ToQuery

func (n *Node) ToQuery() string

func (*Node) Validate

func (n *Node) Validate() error

Jump to

Keyboard shortcuts

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