mapbox_expressions_to_sql

Crates.iomapbox_expressions_to_sql
lib.rsmapbox_expressions_to_sql
version0.1.0
sourcesrc
created_at2018-03-28 08:39:27.737845
updated_at2018-03-28 08:39:27.737845
descriptionIron router with regex captures support.
homepagehttps://github.com/stepankuzmin/rust-mapbox-expressions-to-sql
repositoryhttps://github.com/stepankuzmin/rust-mapbox-expressions-to-sql
max_upload_size
id57874
size9,533
Stepan Kuzmin (stepankuzmin)

documentation

https://docs.rs/mapbox-expressions-to-sql

README

mapbox-expressions-to-sql

Build Status

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

Documentation

Documentation is here

Usage

Add this to your Cargo.toml:

[dependencies]
mapbox_expressions_to_sql = "0.1"

and this to your crate root:

extern crate mapbox_expressions_to_sql;

Example

extern crate mapbox_expressions_to_sql;
use mapbox_expressions_to_sql::parse;

assert_eq!(parse(r#"["has", "key"]"#).unwrap(), "key IS NOT NULL");

assert_eq!(parse(r#"["==", "key", 42]"#).unwrap(), "key = 42");

assert_eq!(parse(r#"["in", "key", "v0", "v1", "v2"]"#).unwrap(), "key IN ('v0', 'v1', 'v2')");

assert_eq!(parse(r#"["all", ["==", "key0", "value0"], ["==", "key1", "value1"]]"#).unwrap(), "key0 = 'value0' AND key1 = 'value1'");

See tests for more examples.

Commit count: 4

cargo fmt