Module: Cuprum::Collections::Queries

Defined in:
lib/cuprum/collections/queries.rb,
lib/cuprum/collections/queries/ordering.rb

Overview

Namespace for internal functionality for implementing collection queries.

Defined Under Namespace

Modules: Ordering Classes: UninvertibleOperatorException, UnknownOperatorException

Constant Summary collapse

Operators =

Defines the supported operators for a Query.

SleepingKingStudios::Tools::Toolbox::ConstantMap.new(
  EQUAL:                    :equal,
  GREATER_THAN:             :greater_than,
  GREATER_THAN_OR_EQUAL_TO: :greater_than_or_equal_to,
  LESS_THAN:                :less_than,
  LESS_THAN_OR_EQUAL_TO:    :less_than_or_equal_to,
  NOT_EQUAL:                :not_equal,
  NOT_NULL:                 :not_null,
  NOT_ONE_OF:               :not_one_of,
  NULL:                     :null,
  ONE_OF:                   :one_of
).freeze
INVERTIBLE_OPERATORS =

Defines the negated operator corresponding to each operator.

{
  Operators::EQUAL                    => Operators::NOT_EQUAL,
  Operators::GREATER_THAN             => Operators::LESS_THAN_OR_EQUAL_TO,
  Operators::GREATER_THAN_OR_EQUAL_TO => Operators::LESS_THAN,
  Operators::LESS_THAN                => Operators::GREATER_THAN_OR_EQUAL_TO, # rubocop:disable Layout/LineLength
  Operators::LESS_THAN_OR_EQUAL_TO    => Operators::GREATER_THAN,
  Operators::NOT_EQUAL                => Operators::EQUAL,
  Operators::NOT_NULL                 => Operators::NULL,
  Operators::NOT_ONE_OF               => Operators::ONE_OF,
  Operators::NULL                     => Operators::NOT_NULL,
  Operators::ONE_OF                   => Operators::NOT_ONE_OF
}.freeze
VALID_OPERATORS =

Enumerates the valid operators as a Set for performant lookup.

Set.new(Operators.values).freeze