Open LucyEgan opened 2 months ago
The behaviour can already be achieved via
(true AND "Whatever") OR "Something";
(false AND "Whatever") OR "Something";
But developers coming from other languages are probably already familiar with the ternary expression, thus it might make sense to offer that as well.
Thanks @dbaudisch ive added above under alt methods
Is your feature request related to a problem?
Currently when doing a quick condition based on a truly/falsely value you need to do using the full IF. For example
DEFINE FIELD ... TYPE option<point> VALUE IF ( location ) { <point> [location.lat, location.long] } ELSE { NONE }
It would be nice to havelocation ? <point> [location.lat, location.long] : NONE
as in other languages, but purely from a sugar point of viewDescribe the solution
Add short IFs as in other languages
condition ? trulyValue : falselyValue
Alternative methods
While not as clear it does get the job done better than a full IF
Supplied by @dbaudisch
SurrealDB version
2.0.0-alpha.8 for linux on x86_64
Contact Details
lucy.e@aspirecomps.co.uk
Is there an existing issue for this?
Code of Conduct