Skip to content

Commit 5a6d044

Browse files
committed
Update README.md
1 parent 7d03f1d commit 5a6d044

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
[![Code Coverage](https://scrutinizer-ci.com/g/antonmedv/expr/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/antonmedv/expr/?branch=master)
55
[![GoDoc](https://godoc.org/github.com/antonmedv/expr?status.svg)](https://godoc.org/github.com/antonmedv/expr)
66

7-
Expr is an engine that can evaluate expressions.
7+
**Expr** package provides an engine that can compile and evaluate expressions.
8+
An expression is a one-liner that returns a value (mostly, but not limited to, booleans).
9+
It is designed for simplicity, speed and safety.
810

911
The purpose of the package is to allow users to use expressions inside configuration for more complex logic.
1012
It is a perfect candidate for the foundation of a _business rule engine_.
@@ -51,8 +53,8 @@ go get -u github.com/antonmedv/expr
5153

5254
## Documentation
5355

54-
* See [![GoDoc](https://godoc.org/github.com/antonmedv/expr?status.svg)](https://godoc.org/github.com/antonmedv/expr) for developer documentation,
55-
* See [The Expression Syntax](https://github.com/antonmedv/expr/wiki/The-Expression-Syntax) page to learn the syntax of the Expr expressions.
56+
* See [docs](docs) for developer documentation.
57+
* See [The Expression Syntax](https://github.com/antonmedv/expr/wiki/The-Expression-Syntax) page to learn the syntax.
5658

5759
## Examples
5860

@@ -81,7 +83,7 @@ type Bar struct {
8183

8284
program, err := expr.Compile("Foo + Bar.Value", expr.Env(Env{}))
8385

84-
output, err := expr.Run(program, Env{1, Bar{2}})
86+
out, err := expr.Run(program, Env{1, Bar{2}})
8587
```
8688

8789
Using env's methods as functions inside expressions.
@@ -95,9 +97,9 @@ func (e *Env) Title() string {
9597
return strings.Title(e.Name)
9698
}
9799

98-
p, err := expr.Parse(`"Hello " + Title()`, expr.Env(&Env{}))
100+
program, err := expr.Compile(`"Hello " + Title()`, expr.Env(&Env{}))
99101

100-
out, err := expr.Run(p, &Env{"world"})
102+
out, err := expr.Run(program, &Env{"world"})
101103
```
102104

103105
Using embedded structs to construct env.
@@ -115,9 +117,9 @@ func (Helpers) Title(s string) string {
115117
}
116118

117119

118-
p, err := expr.Parse(`"Hello " + Title(Name)`, expr.Env(Env{}))
120+
program, err := expr.Compile(`"Hello " + Title(Name)`, expr.Env(Env{}))
119121

120-
out, err := expr.Run(p, Env{"world"})
122+
out, err := expr.Run(program, Env{"world"})
121123
```
122124

123125
## Who is using Expr?

0 commit comments

Comments
 (0)