Documentation ¶
Index ¶
- Variables
- func Register(f *opt.Function) error
- type CustomParamsListener
- type Expression
- func (expression *Expression) AddParameter(name string, value interface{}) error
- func (expression *Expression) Evaluate() (*opt.Argument, error)
- func (expression *Expression) GetParameterNames() []string
- func (expression *Expression) GetResult() (*opt.Argument, error)
- func (expression *Expression) OriginalString() string
- func (expression *Expression) Precompile() error
- func (expression *Expression) ResetParameters()
Constants ¶
This section is empty.
Variables ¶
View Source
var LuaFunctionRegexp = `lua[('\s]+function[\w\s]+\(([a-zA-Z0-9,\s]+)\).*?end\'\)`
View Source
var WildcardRegexp = `(@[\w\d\.]+(\.\*)+[\.\w\d\*]*)[,\s)]`
View Source
var WildcardSymbols = []string{"sum(", "count", "avg"}
Functions ¶
Types ¶
type CustomParamsListener ¶
type CustomParamsListener struct { parser.BaseFormulaListener // contains filtered or unexported fields }
func (*CustomParamsListener) ExitId ¶
func (s *CustomParamsListener) ExitId(c *parser.IdContext)
ExitId is called when exiting the id production.
func (*CustomParamsListener) GetParamNames ¶
func (s *CustomParamsListener) GetParamNames() []string
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression for build user's input
func NewExpression ¶
func NewExpression(expression string, options ...opt.Option) *Expression
NewExpression create new Expression
func (*Expression) AddParameter ¶
func (expression *Expression) AddParameter(name string, value interface{}) error
AddParameter add user's parameter which is required in the expression
func (*Expression) Evaluate ¶
func (expression *Expression) Evaluate() (*opt.Argument, error)
Evaluate return result of expression
func (*Expression) GetParameterNames ¶
func (expression *Expression) GetParameterNames() []string
func (*Expression) OriginalString ¶
func (expression *Expression) OriginalString() string
OriginalString return user's input text
func (*Expression) Precompile ¶
func (expression *Expression) Precompile() error
func (*Expression) ResetParameters ¶
func (expression *Expression) ResetParameters()
ResetParameters clear all parameter
Click to show internal directories.
Click to hide internal directories.