Skip to content

Commit

Permalink
Adding info to README.md
Browse files Browse the repository at this point in the history
alternative operators
IN list , list needs to have comma
  • Loading branch information
nikunjy authored May 11, 2019
1 parent 921ff6f commit 8228a8c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ Here are some examples:
type obj map[string]interface{}
parser.Evaluate("x eq 1", obj{"x": 1})
parser.Evaluate("x == 1", obj{"x": 1})
parser.Evaluate("x lt 1", obj{"x": 1})
parser.Evaluate("x < 1", obj{"x": 1})
parser.Evaluate("x gt 1", obj{"x": 1})
parser.Evaluate("x.a eq 1 and x.b.c le 2", obj{
parser.Evaluate("x.a == 1 and x.b.c <= 2", obj{
"x": obj{
"a": 1,
"b": obj{
Expand All @@ -23,11 +25,11 @@ Here are some examples:
})
parser.Evaluate("y eq 4 and (x gt 1)", obj{"x": 1})
parser.Evaluate("y == 4 and (x > 1)", obj{"x": 1})
parser.Evaluate("y eq 4 and (x IN [1 2 3])", obj{"x": 1})
parser.Evaluate("y == 4 and (x IN [1,2,3])", obj{"x": 1})
parser.Evaluate("y eq 4 and (x eq 1.2.3)", obj{"x": "1.2.3"})
parser.Evaluate("y == 4 and (x eq 1.2.3)", obj{"x": "1.2.3"})
```

Expand All @@ -36,14 +38,14 @@ All the operations can be written capitalized or lowercase (ex: `eq` or `EQ` can

Logical Operations supported are `AND OR`

Compare Expression and their definitions:
Compare Expression and their definitions (a|b means you can use either one of the two a or b):
```
eq: equals to
ne: not equals to
lt: less than
gt: greater than
le: less than equal to
ge: greater than equal to
eq|==: equals to
ne|!=: not equals to
lt|<: less than
gt|>: greater than
le|<=: less than equal to
ge|>=: greater than equal to
co: contains
sw: starts with
ew: ends with
Expand Down

0 comments on commit 8228a8c

Please sign in to comment.