Last active
November 4, 2020 17:42
-
-
Save ondrej-kvasnovsky/ea7c76098f7b13eb4fe2469836b0e278 to your computer and use it in GitHub Desktop.
JSON mapping to SQL where conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| JSON format: | |
| [ | |
| "AND", | |
| ["GE", ["column", "Price"], 10], | |
| ["EQ", ["column", "Product"], "iPhone"], | |
| ["NOT", | |
| [ | |
| "OR", | |
| ["GE", ["column", "Discount"], 1000], | |
| ["IN", ["column", "Product"], ["iPhone 7", "iPhone 8"]] | |
| ] | |
| ] | |
| ] | |
| ( | |
| ( | |
| (Price >= 10) | |
| AND | |
| (Product = 'iPhone') | |
| ) | |
| AND | |
| ( | |
| NOT ( | |
| (Discount >= 1000) | |
| OR (Product IN 'iPhone 7', 'iPhone 8') | |
| ) | |
| ) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment