perltidy all classes
[catagits/Catalyst-Controller-DBIC-API.git] / lib / Catalyst / Controller / DBIC / API / Types.pm
CommitLineData
d2739840 1package Catalyst::Controller::DBIC::API::Types;
2
3#ABSTRACT: Provides shortcut types and coercions for DBIC::API
4use warnings;
5use strict;
6
8ea592cb 7use MooseX::Types -declare => [
8 qw( OrderedBy GroupedBy Prefetch SelectColumns AsAliases ResultSource
9 ResultSet Model SearchParameters JoinBuilder )
10];
d2739840 11use MooseX::Types::Moose(':all');
12
13=type Prefetch as Maybe[ArrayRef[Str|HashRef]]
14
15Represents the structure of the prefetch argument.
16
17Coerces Str and HashRef.
18
19=cut
20
21subtype Prefetch, as Maybe[ArrayRef[Str|HashRef]];
22coerce Prefetch, from Str, via { [$_] }, from HashRef, via { [$_] };
23
24=type GroupedBy as Maybe[ArrayRef[Str]]
25
26Represents the structure of the grouped_by argument.
27
28Coerces Str.
29
30=cut
31
32subtype GroupedBy, as Maybe[ArrayRef[Str]];
33coerce GroupedBy, from Str, via { [$_] };
34
35=type OrderedBy as Maybe[ArrayRef[Str|HashRef|ScalarRef]]
36
37Represents the structure of the ordered_by argument
38
39Coerces Str.
40
41=cut
42
43subtype OrderedBy, as Maybe[ArrayRef[Str|HashRef|ScalarRef]];
1bd2d315 44coerce OrderedBy, from Str, via { [$_] }, from HashRef, via { [$_] };
d2739840 45
46=type SelectColumns as Maybe[ArrayRef[Str|HashRef]]
47
48Represents the structure of the select argument
49
50Coerces Str.
51
52=cut
53
54subtype SelectColumns, as Maybe[ArrayRef[Str|HashRef]];
1bd2d315 55coerce SelectColumns, from Str, via { [$_] }, from HashRef, via { [$_] };
d2739840 56
57=type SearchParameters as Maybe[ArrayRef[HashRef]]
58
59Represents the structure of the search argument
60
61Coerces HashRef.
62
63=cut
64
65subtype SearchParameters, as Maybe[ArrayRef[HashRef]];
66coerce SearchParameters, from HashRef, via { [$_] };
67
68=type AsAliases as Maybe[ArrayRef[Str]]
69
70Represents the structure of the as argument
71
72=cut
73
74subtype AsAliases, as Maybe[ArrayRef[Str]];
75
76=type ResultSet as class_type('DBIx::Class::ResultSet')
77
78Shortcut for DBIx::Class::ResultSet
79
80=cut
81
82subtype ResultSet, as class_type('DBIx::Class::ResultSet');
83
84=type ResultSource as class_type('DBIx::Class::ResultSource')
85
86Shortcut for DBIx::Class::ResultSource
87
88=cut
89
90subtype ResultSource, as class_type('DBIx::Class::ResultSource');
91
92=type JoinBuilder as class_type('Catalyst::Controller::DBIC::API::JoinBuilder')
93
94Shortcut for Catalyst::Controller::DBIC::API::JoinBuilder
95
96=cut
97
8ea592cb 98subtype JoinBuilder,
99 as class_type('Catalyst::Controller::DBIC::API::JoinBuilder');
d2739840 100
101=type Model as class_type('DBIx::Class')
102
103Shortcut for model objects
104
105=cut
106
107subtype Model, as class_type('DBIx::Class');
108
1091;