Added filter operators

In this changeset, I refactored the DB filter system to support
comparison operators using a django-like syntax.
A filter can take 2 forms:

- "<FIELDNAME>" which is a syntactic sugar for "<FIELDNAME>__eq"
- "<FIELDNAME>__<OPERATOR>" where <OPERATOR> is the comparison operator
  to be used.

Here is the list of the supported operators:

- 'eq' (==)
- 'neq' (!=)
- 'gt' (>)
- 'gte' (>=)
- 'lt' (<)
- 'lte' (<=)
- 'in' (in)
- 'notin' (not in)

Change-Id: I53a61d50a3253342a40f0ff87cb5612ed57a3bd1
This commit is contained in:
Vincent Françoise
2016-06-06 10:07:00 +02:00
committed by David TARDIVEL
parent 7b403c0d3b
commit 77c07a466f
4 changed files with 162 additions and 196 deletions

View File

@@ -139,8 +139,6 @@ class BaseConnection(object):
match the specified filters.
:param context: The security context
:param columns: List of column names to return.
Defaults to 'id' column when columns == None.
:param filters: Filters to apply. Defaults to None.
:param limit: Maximum number of strategies to return.
@@ -221,7 +219,7 @@ class BaseConnection(object):
"""
@abc.abstractmethod
def get_audit_template_list(self, context, columns=None, filters=None,
def get_audit_template_list(self, context, filters=None,
limit=None, marker=None, sort_key=None,
sort_dir=None):
"""Get specific columns for matching audit templates.
@@ -230,8 +228,6 @@ class BaseConnection(object):
match the specified filters.
:param context: The security context
:param columns: List of column names to return.
Defaults to 'id' column when columns == None.
:param filters: Filters to apply. Defaults to None.
:param limit: Maximum number of audit templates to return.
@@ -320,7 +316,7 @@ class BaseConnection(object):
"""
@abc.abstractmethod
def get_audit_list(self, context, columns=None, filters=None, limit=None,
def get_audit_list(self, context, filters=None, limit=None,
marker=None, sort_key=None, sort_dir=None):
"""Get specific columns for matching audits.
@@ -328,8 +324,6 @@ class BaseConnection(object):
specified filters.
:param context: The security context
:param columns: List of column names to return.
Defaults to 'id' column when columns == None.
:param filters: Filters to apply. Defaults to None.
:param limit: Maximum number of audits to return.
@@ -407,7 +401,7 @@ class BaseConnection(object):
"""
@abc.abstractmethod
def get_action_list(self, context, columns=None, filters=None, limit=None,
def get_action_list(self, context, filters=None, limit=None,
marker=None, sort_key=None, sort_dir=None):
"""Get specific columns for matching actions.
@@ -415,8 +409,6 @@ class BaseConnection(object):
specified filters.
:param context: The security context
:param columns: List of column names to return.
Defaults to 'id' column when columns == None.
:param filters: Filters to apply. Defaults to None.
:param limit: Maximum number of actions to return.
@@ -490,7 +482,7 @@ class BaseConnection(object):
@abc.abstractmethod
def get_action_plan_list(
self, context, columns=None, filters=None, limit=None,
self, context, filters=None, limit=None,
marker=None, sort_key=None, sort_dir=None):
"""Get specific columns for matching action plans.
@@ -498,8 +490,6 @@ class BaseConnection(object):
match the specified filters.
:param context: The security context
:param columns: List of column names to return.
Defaults to 'id' column when columns == None.
:param filters: Filters to apply. Defaults to None.
:param limit: Maximum number of audits to return.