NAME

JsonSQL::Param::ConditionDispatcher - A dispatcher module that parses condition statements to create the appropriate JsonSQL Condition objects.

VERSION

version 0.4

SYNOPSIS

This is a supporting module used by JsonSQL::Query modules for parsing condition operators as parameters for conditional clauses.

To use this:

my $condObj = JsonSQL::Param::ConditionDispatcher->parse($conditionhashref, $queryObj, $default_table_rules);
if ( eval { $condObj->is_error } ) {
    return "Could not create condition object: $condObj->{message}";
} else {
    ...
}

The $conditionhashref must contain a single key which is the operator for the condition statement. The operator gets mapped to the appropriate module to load as defined in the %opmap hash. The conditional modules are subclasses of JsonSQL::Param::Condition and reside in JsonSQL::Param::Conditions. The value of the operator key is a hash of args to apply to the operator. For example, a TestCondition needs to have "field" and "value" properties.

The collection of conditional modules is fairly complete, but others can be created if need be.

METHODS

Dispatcher parse($conditionhashref, $queryObj, $default_table_rules) -> JsonSQL::Param::Condition

Serves as a dispatcher to load the appropriate JsonSQL::Param::Conditions:: class, and create a new instance which is then returned.

AUTHOR

Chris Hoefler <bhoefler@draper.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Chris Hoefler.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.