Categorygithub.com/antonmedv/expr
modulepackage
0.0.5
Repository: https://github.com/antonmedv/expr.git
Documentation: pkg.go.dev

# README

Expr Build Status Go Report Card Code Coverage Sparkline

Expr is an engine that can evaluate expressions.

The purpose of the package is to allow users to use expressions inside configuration for more complex logic. It is a perfect candidate for the foundation of a business rule engine. The idea is to let configure things in a dynamic way without recompile of a program:

# Get the special price if
user.Group in ["good_customers", "collaborator"]

# Promote article to the homepage when
len(article.Comments) > 100 and article.Category not in ["misc"]

# Send an alert when
product.Stock < 15

Inspired by

Install

go get -u github.com/antonmedv/expr

Documentation

License

MIT

# Functions

Eval parses and evaluates given input.
Funcs sets list of allowed function.
Names sets list of allowed names.
Parse parses input into ast.
Run evaluates given ast.

# Interfaces

Node represents items of abstract syntax tree.

# Type aliases

OptionFn for configuring parser.