NAME

Salvation::MacroProcessor::Spec - Query object

REQUIRES

Scalar::Util

Carp::Assert

Moose

METHODS

parse_and_new

Salvation::MacroProcessor::Spec -> parse_and_new( $class_or_object, $query );

Creates and returns new query object, an instance of Salvation::MacroProcessor::Spec class.

$class_or_object is a class name or instance of the class which will be the base class for the query. It has been thought of as "I will check or select objects of that type".

$query is an object of type ArrayRef[ArrayRef[Any]]. It is the query you want to perform. Each inner ArrayRef represents a filter, a field which consists of two parameters: the first is the name and the second is the value. Imagine you have following $query object:

[
	[ method => $value ]
]

. method here is the name of the method description which will be the part of the query, and $value is the value for this column, a condition for a filter. It should be thought of as "I want to select an object which method()' call returns the $value".

I.e., a query with two fields will look somewhat like this:

 [
 	[ method1 => $value1 ],
	[ method2 => $value2 ]
 ]

. Note this very explicit separation of fields.

select

$spec -> select();

Selects objects.

check

$spec -> check( $object );

Checks if given $object could be selected using this $spec.

$object is an object representing a single row of data returned by the query.