Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Transform Mapbox GL Style Specification decision expressions to SQL WHERE clause conditions

Notifications You must be signed in to change notification settings

stepankuzmin/mapbox-expressions-to-sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mapbox-expressions-to-sql

Build Status Greenkeeper badge

Transform Mapbox GL style specification decision expressions to SQL WHERE clause conditions.

Installation

npm i mapbox-expressions-to-sql

Usage

const parse = require('mapbox-expressions-to-sql');

parse(["has", "key"]) === 'key IS NOT NULL';

parse(["==", "key", "value"]) === "key = 'value'";

parse(["!=", "key", "value"]) === "key <> 'value'";

parse([">", "key", "value"]) === "key > 'value'";

parse([">=", "key", "value"]) === "key >= 'value'";

parse(["<", "key", "value"]) === "key < 'value'";

parse(["<=", "key", "value"]) === "key <= 'value'";

parse(["in", "key", "v0", "v1", "v2"]) === "key IN ('v0', 'v1', 'v2')";

parse(["all", ["==", "key0", "value0"], ["==", "key1", "value1"]]) === "key0 = 'value0' AND key1 = 'value1'";

See tests for more examples.

About

Transform Mapbox GL Style Specification decision expressions to SQL WHERE clause conditions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published