Hi!,
the summary of this ticket is:
add bit shift operators (concretely '>>' and '<<') to F(), then you can use these operators like this:
- F('somefield').bitleftshift(16)
- F('somefield').bitrightshift(16)
The discussion of this ticket went in few ways:
1) We permit these operators in F(), and then we allow addition of others methods too?
2) Move the bitand() and bitor() to expressions?
3) Or only allow bit shift and stop there. (Into this way there are open other discussions):
3.1) situation->Oracle don't support bit shift operators, but you can do some math to do it
3.1.1) Is a good idea to implement this maths?
3.1.2) Or is better to raise NotImplementedError("Bit-wise left/right is not supported in Oracle."), because we want to follow the same design following by Django in other cases like this? such as 'or' operator: (you can check the code):
In django/django/db/backends/oracle/features.py
supports_bitwise_or = False
In django/django/db/backends/oracle/operations.py
def combine_expression(self, connector, sub_expressions):
....
elif connector == '|':
raise NotImplementedError("Bit-wise or is not supported in Oracle.")
The pull request has the solution 3.1.2, implement binary left/right shift operators to F() and raise NotImplementedError for Oracle.
All opinions are welcome! thank you so much!