0.4.2 • Published 2 years ago

pivotql-parser-expression v0.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

PivotQL expression parser

Parses simple expression to generate PivotQL ASTs.

Install

npm install pivotql-compiler-mongodb

Example

import parse from 'pivotql-parser-expression';
import compile from 'pivotql-compiler-mongodb';

const query = '( height <= 20 or favorites.color == "green" ) and firstname in ["john", "doug"]';

const parsed = parse(query)

// parsed can be consumed by any pivotql compiler

Expression Query Syntax

ValuesDescription
43, -1.234Numbers
true, falseBooleans
null, undefinedPrimitives
"hello"Strings
foo, a.b.cSymbols (usually a key or column name in your datastore)
OperatorsDescription
x == yEquality
x != yIneqaulity
x ~= "y"Matching evaluated as a RegExp
x < yLess than
x <= yLess than or equal to
x > yGreater than
x >= yGreater than or equal to
x or yBoolean or
x and yBoolean and
not xBoolean not
( x )Expression

Operator precedence follows that of any sane language.

More information

See main repository for more information.

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.3.0

3 years ago

0.1.0

3 years ago

0.0.3

3 years ago

0.2.0

3 years ago

0.0.4

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago