goexpress

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

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

README

goexpress

Documentation

Index

Constants

View Source
const (
	StatusStart      = 0
	StatusOfValue    = 1
	StatusOfOperator = 2
)

------------------------------------------

View Source
const VarPrefix = "${"
View Source
const VarSuffix = "}"

Variables

This section is empty.

Functions

func BenchmarkNewEvaluableExpression

func BenchmarkNewEvaluableExpression()

func Evaluate

func Evaluate(exs []interface{}, params map[string]interface{}) (bool, error)

Types

type BoolExpression

type BoolExpression struct {
	RawExpression string
	// contains filtered or unexported fields
}

func NewBoolExpression

func NewBoolExpression(expression string) (*BoolExpression, error)

func (*BoolExpression) Evaluate

func (exp *BoolExpression) Evaluate(params map[string]interface{}) bool

type BoolValue

type BoolValue bool

func (BoolValue) Bool

func (e BoolValue) Bool() bool

type Booler

type Booler interface {
	Bool() bool
}

------------------------------------------

type LiteralValue

type LiteralValue struct {
	Literal string
	Value   interface{}
	Kind    reflect.Kind
}

type Operator

type Operator string
const (
	OpEq         Operator = "=="
	OpNeq        Operator = "!="
	OpAnd        Operator = "&&"
	OpOr         Operator = "||"
	OpNot        Operator = "!"
	OpOpenParen  Operator = "("
	OpCloseParen Operator = ")"
)

func (Operator) PriorTo

func (op Operator) PriorTo(op2 Operator) bool

func (Operator) Priority

func (op Operator) Priority() int

值约小,优先级约高

type Scanner

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

type SimpleExpression

type SimpleExpression struct {
	Expression string
	Values     []BoolValue
	Operator   *Operator
}

------------------------------------------

func (SimpleExpression) Bool

func (e SimpleExpression) Bool() bool

type Stack

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

<recommend-cond>

</recommend-cond>

func NewStack

func NewStack() *Stack

func ToPostfixExpression

func ToPostfixExpression(exs []interface{}) (*Stack, error)

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

func (*Stack) Len

func (s *Stack) Len() int

func (*Stack) Peak

func (s *Stack) Peak() interface{}

func (*Stack) Pop

func (s *Stack) Pop() interface{}

func (*Stack) Push

func (s *Stack) Push(elem interface{})

func (*Stack) PushList

func (s *Stack) PushList(list ...interface{})

type Variable

type Variable string

------------------------------------------

Jump to

Keyboard shortcuts

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