Toggle boolean #1508
Answered
by
AL1L
ehsanonline
asked this question in
Q&A
Toggle boolean
#1508
-
is there a way to update a bool type value by toggling? example: |
Beta Was this translation helpful? Give feedback.
Answered by
AL1L
Dec 6, 2022
Replies: 1 comment
-
I looked through the documentation and even tried some things and I can't find a specific operator or function to invert a boolean... For now you can do a compaison against UPDATE user:asdf SET is_admin = (is_admin == false); Something funny I found is this is also valid, but not as strict, but you could use it if UPDATE user:asdf SET is_admin = (is_admin = false); As a double Also, the perentesis aren't required, but I think it makes the code easier to read. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ehsanonline
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I looked through the documentation and even tried some things and I can't find a specific operator or function to invert a boolean...
For now you can do a compaison against
false
which should do the trickSomething funny I found is this is also valid, but not as strict, but you could use it if
is_admin
might not be a boolean.As a double
==
is a strict equals.Also, the perentesis aren't required, but I think it makes the code easier to read.