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