Module: DataMapper::Query::Conditions

Defined in:


The Conditions module contains classes used as part of a Query when filtering collections of resources.

The Conditions module contains two types of class used for filtering queries: Comparison and Operation. Although these are used on all repository types – not just SQL-based repos – these classes are best thought of as being the DataMapper counterpart to an SQL WHERE clause.

Comparisons compare properties and relationships with values, while operations tie Comparisons together to form more complex expressions.

For example, the following SQL query fragment:

... WHERE my_field = my_value AND another_field = another_value ...

… would be represented as two EqualToComparison instances tied together with an AndOperation.

Conditions – together with the Query class – allow DataMapper to represent SQL-like expressions in an ORM-agnostic manner, and are used for both in-memory filtering of loaded Collection instances, and by adapters to retrieve records directly from your repositories.

The classes contained in the Conditions module are for internal use by DataMapper and DataMapper plugins, and are not intended to be used directly in your applications.

Defined Under Namespace

Modules: FlattenOperation, RelationshipHandler Classes: AbstractComparison, AbstractOperation, AndOperation, Comparison, EqualToComparison, GreaterThanComparison, GreaterThanOrEqualToComparison, InclusionComparison, LessThanComparison, LessThanOrEqualToComparison, LikeComparison, NotOperation, NullOperation, Operation, OrOperation, RegexpComparison