Skip to content

Instantly share code, notes, and snippets.

@ondrej-kvasnovsky
Last active November 4, 2020 17:42
Show Gist options
  • Save ondrej-kvasnovsky/ea7c76098f7b13eb4fe2469836b0e278 to your computer and use it in GitHub Desktop.
Save ondrej-kvasnovsky/ea7c76098f7b13eb4fe2469836b0e278 to your computer and use it in GitHub Desktop.
JSON mapping to SQL where conditions
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