Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Lobunets committed Dec 16, 2014
1 parent 3b2162d commit a8a54a6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
conditions
==========

This package offers a parser of a simple conditions specification language
(reduced set of arithmetic/logical operations). It was created for Flow-Based Programming components that
require configuration to perform some operations on the data received from multiple input ports.

Example:
```
import "github.com/oleksandr/conditions"
// Our condition to check
s := "($0 > 0.45) AND ($1 == \"ON\" OR $2 == \"ACTIVE\") AND $3 == false"
// Parse the condition language and get expression
p := NewParser(strings.NewReader(s))
expr, err := p.Parse()
if err != nil {
// ...
}
// Evaluate expression passing data for $vars
r, err := Evaluate(expr, 0.12, "OFF", "ACTIVE", true)
if err != nil {
// ...
}
// r is false
```

0 comments on commit a8a54a6

Please sign in to comment.