| 1 | # ========================================================================== # | ||
| 2 | # lib/JPList::DB::Config.pm - JPList DB Config | ||
| 3 | # Copyright (C) 2017 Exceleron Software, LLC | ||
| 4 | # ========================================================================== # | ||
| 5 | |||
| 6 | package JPList::DB::Config; | ||
| 7 | |||
| 8 | 1 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | # ========================================================================== # | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | JPList::DB::Config - JPList DB Config | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | with 'JPList::DB::Config'; | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | The JPList::DB::Config module allows you store the DB Config | ||
| 26 | |||
| 27 | =head2 ATTRIBUTES | ||
| 28 | |||
| 29 | =over 4 | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | # ========================================================================== # | ||
| 34 | |||
| 35 | =item C<dbh> | ||
| 36 | |||
| 37 | Params : $dbh | ||
| 38 | |||
| 39 | Desc : Database Handle | ||
| 40 | |||
| 41 | =item C<db_table_name> | ||
| 42 | |||
| 43 | Params : $table_name | ||
| 44 | |||
| 45 | Desc : Table name to query the result | ||
| 46 | |||
| 47 | =item C<fields> | ||
| 48 | |||
| 49 | Params : String | ||
| 50 | '"Column1", "Column2"' | ||
| 51 | |||
| 52 | Desc : Fields can be column list | ||
| 53 | |||
| 54 | =item C<where_fields> | ||
| 55 | |||
| 56 | Params : HASHREF | ||
| 57 | { | ||
| 58 | Column1 => '' | ||
| 59 | } | ||
| 60 | |||
| 61 | Desc : Table name to query the result | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | 1 | has 'dbh' => ( | |
| 66 | is => 'rw', | ||
| 67 | required => 1, | ||
| 68 | ); | ||
| 69 | |||
| 70 | |||
| 71 | 1 | has 'db_table_name' => ( | |
| 72 | is => 'rw', | ||
| 73 | isa => 'Str', | ||
| 74 | required => 1, | ||
| 75 | ); | ||
| 76 | |||
| 77 | 1 | has 'fields' => ( | |
| 78 | is => 'rw', | ||
| 79 | documentation => | ||
| 80 | 'fields as per SQL::Abstract it can be array of fields (which will be joined and quoted) or plain scalar (literal SQL, not quoted)' | ||
| 81 | ); | ||
| 82 | |||
| 83 | has 'where_fields' => ( | ||
| 84 | is => 'rw', | ||
| 85 | default => sub { | ||
| 86 | 0 | ▶ | return {}; |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 87 | }, | ||
| 88 | 1 | documentation => 'Custom Where fields like UtilityId etc..' | |
| 89 | ); | ||
| 90 | |||
| 91 | 1 | has 'group_fields' => ( | |
| 92 | is => 'rw', | ||
| 93 | documentation => 'Custom group by fields like UtilityId, AccountId etc..' | ||
| 94 | ); | ||
| 95 | |||
| 96 | 1 | has 'order_index' => ( | |
| 97 | is => 'rw', | ||
| 98 | documentation => | ||
| 99 | 'Custom order index to sort by order index instad of column name to support quries with custom fields' | ||
| 100 | ); | ||
| 101 | |||
| 102 | # ========================================================================== # | ||
| 103 | |||
| 104 | 1 | 1; | |
| 105 | |||
| 106 | __END__ | ||
| 107 | |||
| 108 | =back | ||
| 109 | |||
| 110 | =head1 AUTHORS | ||
| 111 | |||
| 112 | Sheeju Alex, <sheeju@exceleron.com> | ||
| 113 | |||
| 114 | =head1 BUGS | ||
| 115 | |||
| 116 | https://github.com/sheeju/JPList/issues | ||
| 117 | |||
| 118 | =head1 SUPPORT | ||
| 119 | |||
| 120 | You can find documentation for this module with the perldoc command. | ||
| 121 | |||
| 122 | perldoc JPList | ||
| 123 | |||
| 124 | |||
| 125 | You can also look for information at: | ||
| 126 | |||
| 127 | =over 4 | ||
| 128 | |||
| 129 | =item * RT: CPAN's request tracker (report bugs here) | ||
| 130 | |||
| 131 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=JPList> | ||
| 132 | |||
| 133 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 134 | |||
| 135 | L<http://annocpan.org/dist/JPList> | ||
| 136 | |||
| 137 | =item * CPAN Ratings | ||
| 138 | |||
| 139 | L<http://cpanratings.perl.org/d/JPList> | ||
| 140 | |||
| 141 | =item * Search CPAN | ||
| 142 | |||
| 143 | L<http://search.cpan.org/dist/JPList/> | ||
| 144 | |||
| 145 | =back | ||
| 146 | |||
| 147 | =head1 ACKNOWLEDGEMENTS | ||
| 148 | |||
| 149 | Development time supported by Exceleron L<www.exceleron.com|http://www.exceleron.com>. | ||
| 150 | |||
| 151 | =head1 LICENSE AND COPYRIGHT | ||
| 152 | |||
| 153 | Copyright (C) 2017 Exceleron Software, LLC | ||
| 154 | |||
| 155 | This program is free software; you can redistribute it and/or modify it | ||
| 156 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 157 | copy of the full license at: | ||
| 158 | |||
| 159 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 160 | |||
| 161 | Any use, modification, and distribution of the Standard or Modified | ||
| 162 | Versions is governed by this Artistic License. By using, modifying or | ||
| 163 | distributing the Package, you accept this license. Do not use, modify, | ||
| 164 | or distribute the Package, if you do not accept this license. | ||
| 165 | |||
| 166 | If your Modified Version has been derived from a Modified Version made | ||
| 167 | by someone other than you, you are nevertheless required to ensure that | ||
| 168 | your Modified Version complies with the requirements of this license. | ||
| 169 | |||
| 170 | This license does not grant you the right to use any trademark, service | ||
| 171 | mark, tradename, or logo of the Copyright Holder. | ||
| 172 | |||
| 173 | This license includes the non-exclusive, worldwide, free-of-charge | ||
| 174 | patent license to make, have made, use, offer to sell, sell, import and | ||
| 175 | otherwise transfer the Package with respect to any patent claims | ||
| 176 | licensable by the Copyright Holder that are necessarily infringed by the | ||
| 177 | Package. If you institute patent litigation (including a cross-claim or | ||
| 178 | counterclaim) against any party alleging that the Package constitutes | ||
| 179 | direct or contributory patent infringement, then this Artistic License | ||
| 180 | to you shall terminate on the date that such litigation is filed. | ||
| 181 | |||
| 182 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||
| 183 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||
| 184 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
| 185 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||
| 186 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||
| 187 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||
| 188 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||
| 189 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 190 | |||
| 191 | =cut | ||
| 192 | |||
| 193 | # vim: ts=4 | ||
| 194 | # vim600: fdm=marker fdl=0 fdc=3 | ||