NAME
Salvation::MacroProcessor::Hooks - Base class for your hooks with implementation of actual logic for Salvation::MacroProcessor::Spec
REQUIRES
METHODS
To be redefined
You can redefine following methods to achieve your own goals.
check
$hook -> check( $spec, $object );
Checks if given $object
could be selected using this $spec
.
$spec
is a Salvation::MacroProcessor::Spec instance.
$object
is an object representing a single row of data returned by the query.
Boolean value should be returned, false
means "skip this object" and true
means "yes, this object is what we want".
query_from_attribute
$hook -> query_from_attribute( $method_description, $attr, @rest );
Generates query part which needs to be applied to the query to get an object which satisfies specified criteria.
This method will be called if all following conditions are true:
- class has an attribute (see Moose::Manual::Attributes for more info) which name is exactly the same as the method being described
- description has no
query
argument specified
$method_description
is a Salvation::MacroProcessor::MethodDescription instance.
$attr
is a Moose::Meta::Attribute instance.
@rest
is a list of arguments of the same types, conditions and meaning as it is for query
argument of Salvation::MacroProcessor::smp_add_description
when $query
is a CodeRef.
Return value should also be as the one of $query
function of Salvation::MacroProcessor::smp_add_description
.
select
$hook -> select( $spec, $additional_query, $additional_args );
Selects objects using given $spec
with a mix of $additional_query
and $additional_args
.
$spec
is a Salvation::MacroProcessor::Spec instance.
$additional_query
and $additional_args
are both passed in by you or any other developer who will try to make a query. Though both are thought of as ArrayRef's.
$additional_query
's meaning is "some custom query part we need to apply to the query".
$additional_args
's meaning is "some additional custom arguments we need to pass to the method which will then perform a request to complete the query".
Return value will be returned directly to caller which is your custom code issued Salvation::MacroProcessor::Spec::select
. Though return value is thought of as Salvation::MacroProcessor::Iterator instance.