mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Refs #29824 -- Added RangeOperators helper class.
This commit is contained in:
parent
cf79f92abe
commit
7174cf0b00
3 changed files with 53 additions and 8 deletions
|
@ -916,3 +916,31 @@ types.
|
|||
.. attribute:: range_type
|
||||
|
||||
The psycopg2 range type to use.
|
||||
|
||||
Range operators
|
||||
---------------
|
||||
|
||||
.. versionadded:: 3.0
|
||||
|
||||
.. class:: RangeOperators
|
||||
|
||||
PostgreSQL provides a set of SQL operators that can be used together with the
|
||||
range data types (see `the PostgreSQL documentation for the full details of
|
||||
range operators <https://www.postgresql.org/docs/current/
|
||||
functions-range.html#RANGE-OPERATORS-TABLE>`_). This class is meant as a
|
||||
convenient method to avoid typos. The operator names overlap with the names of
|
||||
corresponding lookups.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class RangeOperators:
|
||||
EQUAL = '='
|
||||
NOT_EQUAL = '<>'
|
||||
CONTAINS = '@>'
|
||||
CONTAINED_BY = '<@'
|
||||
OVERLAPS = '&&'
|
||||
FULLY_LT = '<<'
|
||||
FULLY_GT = '>>'
|
||||
NOT_LT = '&>'
|
||||
NOT_GT = '&<'
|
||||
ADJACENT_TO = '-|-'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue