| 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 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | 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 VERSION | ||
| 20 | |||
| 21 | Version 0.04 | ||
| 22 | |||
| 23 | =cut | ||
| 24 | |||
| 25 | 2 | our $VERSION = '0.04'; | |
| 26 | |||
| 27 | =head1 SYNOPSIS | ||
| 28 | |||
| 29 | with 'JPList::DB::Config'; | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | The JPList::DB::Config module allows you store the DB Config | ||
| 34 | |||
| 35 | =head2 ATTRIBUTES | ||
| 36 | |||
| 37 | =over 4 | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | # ========================================================================== # | ||
| 42 | |||
| 43 | =item C<dbh> | ||
| 44 | |||
| 45 | Params : $dbh | ||
| 46 | |||
| 47 | Desc : Database Handle | ||
| 48 | |||
| 49 | =item C<db_table_name> | ||
| 50 | |||
| 51 | Params : $table_name | ||
| 52 | |||
| 53 | Desc : Table name to query the result | ||
| 54 | |||
| 55 | =item C<fields> | ||
| 56 | |||
| 57 | Params : String | ||
| 58 | '"Column1", "Column2"' | ||
| 59 | |||
| 60 | Desc : Fields can be column list | ||
| 61 | |||
| 62 | =item C<where_fields> | ||
| 63 | |||
| 64 | Params : HASHREF | ||
| 65 | { | ||
| 66 | Column1 => '' | ||
| 67 | } | ||
| 68 | |||
| 69 | Desc : Table name to query the result | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | 2 | has 'dbh' => ( | |
| 74 | is => 'rw', | ||
| 75 | required => 1, | ||
| 76 | ); | ||
| 77 | |||
| 78 | |||
| 79 | 2 | has 'db_table_name' => ( | |
| 80 | is => 'rw', | ||
| 81 | isa => 'Str', | ||
| 82 | required => 1, | ||
| 83 | ); | ||
| 84 | |||
| 85 | 2 | has 'fields' => ( | |
| 86 | is => 'rw', | ||
| 87 | documentation => | ||
| 88 | 'fields as per SQL::Abstract it can be array of fields (which will be joined and quoted) or plain scalar (literal SQL, not quoted)' | ||
| 89 | ); | ||
| 90 | |||
| 91 | has 'where_fields' => ( | ||
| 92 | is => 'rw', | ||
| 93 | 0 | ▶ | default => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 94 | 0 | return {}; | |
| 95 | }, | ||
| 96 | 2 | documentation => 'Custom Where fields like UtilityId etc..' | |
| 97 | ); | ||
| 98 | |||
| 99 | 2 | has 'group_fields' => ( | |
| 100 | is => 'rw', | ||
| 101 | documentation => 'Custom group by fields like UtilityId, AccountId etc..' | ||
| 102 | ); | ||
| 103 | |||
| 104 | 2 | has 'order_index' => ( | |
| 105 | is => 'rw', | ||
| 106 | documentation => | ||
| 107 | 'Custom order index to sort by order index instad of column name to support quries with custom fields' | ||
| 108 | ); | ||
| 109 | |||
| 110 | # ========================================================================== # | ||
| 111 | |||
| 112 | 2 | 1; | |
| 113 | |||
| 114 | __END__ | ||