1 package Catalyst::Controller::DBIC::API::Types;
3 #ABSTRACT: Provides shortcut types and coercions for DBIC::API
7 use MooseX::Types -declare => [
8 qw( OrderedBy GroupedBy Prefetch SelectColumns AsAliases ResultSource
9 ResultSet Model SearchParameters JoinBuilder )
11 use MooseX::Types::Moose(':all');
13 =type Prefetch as Maybe[ArrayRef[Str|HashRef]]
15 Represents the structure of the prefetch argument.
17 Coerces Str and HashRef.
21 subtype Prefetch, as Maybe[ArrayRef[Str|HashRef]];
22 coerce Prefetch, from Str, via { [$_] }, from HashRef, via { [$_] };
24 =type GroupedBy as Maybe[ArrayRef[Str]]
26 Represents the structure of the grouped_by argument.
32 subtype GroupedBy, as Maybe[ArrayRef[Str]];
33 coerce GroupedBy, from Str, via { [$_] };
35 =type OrderedBy as Maybe[ArrayRef[Str|HashRef|ScalarRef]]
37 Represents the structure of the ordered_by argument
43 subtype OrderedBy, as Maybe[ArrayRef[Str|HashRef|ScalarRef]];
44 coerce OrderedBy, from Str, via { [$_] }, from HashRef, via { [$_] };
46 =type SelectColumns as Maybe[ArrayRef[Str|HashRef]]
48 Represents the structure of the select argument
54 subtype SelectColumns, as Maybe[ArrayRef[Str|HashRef]];
55 coerce SelectColumns, from Str, via { [$_] }, from HashRef, via { [$_] };
57 =type SearchParameters as Maybe[ArrayRef[HashRef]]
59 Represents the structure of the search argument
65 subtype SearchParameters, as Maybe[ArrayRef[HashRef]];
66 coerce SearchParameters, from HashRef, via { [$_] };
68 =type AsAliases as Maybe[ArrayRef[Str]]
70 Represents the structure of the as argument
74 subtype AsAliases, as Maybe[ArrayRef[Str]];
76 =type ResultSet as class_type('DBIx::Class::ResultSet')
78 Shortcut for DBIx::Class::ResultSet
82 subtype ResultSet, as class_type('DBIx::Class::ResultSet');
84 =type ResultSource as class_type('DBIx::Class::ResultSource')
86 Shortcut for DBIx::Class::ResultSource
90 subtype ResultSource, as class_type('DBIx::Class::ResultSource');
92 =type JoinBuilder as class_type('Catalyst::Controller::DBIC::API::JoinBuilder')
94 Shortcut for Catalyst::Controller::DBIC::API::JoinBuilder
99 as class_type('Catalyst::Controller::DBIC::API::JoinBuilder');
101 =type Model as class_type('DBIx::Class')
103 Shortcut for model objects
107 subtype Model, as class_type('DBIx::Class');