| 1 | package # Hide from PAUSE | ||
| 2 | DBIx::Class::AuditAny::Util::BuiltinDatapoints; | ||
| 3 | |||
| 4 | # ABSTRACT: Built-in datapoint configs for DBIx::Class::AuditAny | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | DBIx::Class::AuditAny::Util::BuiltinDatapoints - Built-in datapoint configs for DBIx::Class::AuditAny | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | These are just lists of predefined hashref configs ($cnf) - DataPoint constructor arg | ||
| 13 | i.e. my $DataPoint = DBIx::Class::AuditAny::DataPoint->new(%$cnf); | ||
| 14 | |||
| 15 | This module is used internally and should not need to be called directly | ||
| 16 | |||
| 17 | =head1 METHODS | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | 14 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | 14 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | |||
| 25 | =head2 all_configs | ||
| 26 | |||
| 27 | Return all the builtin configs | ||
| 28 | |||
| 29 | =cut | ||
| 30 | 18 | ▶ | sub all_configs {( |
|
Subroutine
all_configs: called CC=1 SCAR=0.0
Pod
documented
| |||
| 31 | 18 | &_base_context, | |
| 32 | &_source_context, | ||
| 33 | &_set_context, | ||
| 34 | &_change_context, | ||
| 35 | &_column_context, | ||
| 36 | )} | ||
| 37 | |||
| 38 | |||
| 39 | 18 | ▶ | sub _base_context { |
|
Subroutine
_base_context: called CC=1 SCAR=1.2
| |||
| 40 | 36 | map {{ context => 'base', %$_ }} ( | |
| 41 | { | ||
| 42 | name => 'schema', | ||
| 43 | 0 | ▶ | method => sub { ref((shift)->AuditObj->schema) }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 44 | column_info => { data_type => "varchar", is_nullable => 0, size => 255 } | ||
| 45 | }, | ||
| 46 | { | ||
| 47 | name => 'schema_ver', | ||
| 48 | 0 | ▶ | method => sub { (shift)->AuditObj->schema->schema_version }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 49 | 18 | column_info => { data_type => "varchar", is_nullable => 1, size => 16 } | |
| 50 | } | ||
| 51 | ) | ||
| 52 | } | ||
| 53 | |||
| 54 | # set 'method' as a direct passthrough to $Context->'name' per default (see DataPoint class) | ||
| 55 | 18 | ▶ | sub _source_context { |
|
Subroutine
_source_context: called CC=1 SCAR=0.0
| |||
| 56 | 18 | map {{ context => 'source', method => $_->{name}, %$_ }} ( | |
| 57 | { | ||
| 58 | name => 'source', | ||
| 59 | column_info => { data_type => "varchar", is_nullable => 0, size => 255 } | ||
| 60 | }, | ||
| 61 | { | ||
| 62 | name => 'class', | ||
| 63 | column_info => { data_type => "varchar", is_nullable => 0, size => 255 } | ||
| 64 | }, | ||
| 65 | { | ||
| 66 | name => 'from_name', | ||
| 67 | column_info => { data_type => "varchar", is_nullable => 0, size => 128 } | ||
| 68 | }, | ||
| 69 | { | ||
| 70 | name => 'table_name', | ||
| 71 | column_info => { data_type => "varchar", is_nullable => 0, size => 128 } | ||
| 72 | }, | ||
| 73 | { | ||
| 74 | name => 'pri_key_column', | ||
| 75 | column_info => { data_type => "varchar", is_nullable => 0, size => 64 } | ||
| 76 | }, | ||
| 77 | { | ||
| 78 | name => 'pri_key_count', | ||
| 79 | column_info => { data_type => "integer", extra => { unsigned => 1 }, is_nullable => 0 } | ||
| 80 | } | ||
| 81 | ) | ||
| 82 | } | ||
| 83 | |||
| 84 | # set 'method' as a direct passthrough to $Context->'name' per default (see DataPoint class) | ||
| 85 | 18 | ▶ | sub _set_context { |
|
Subroutine
_set_context: called CC=1 SCAR=0.0
| |||
| 86 | 18 | map {{ context => 'set', method => $_->{name}, %$_ }} ( | |
| 87 | { | ||
| 88 | name => 'changeset_ts', | ||
| 89 | column_info => { | ||
| 90 | data_type => "datetime", | ||
| 91 | datetime_undef_if_invalid => 1, | ||
| 92 | is_nullable => 0 | ||
| 93 | } | ||
| 94 | }, | ||
| 95 | { | ||
| 96 | name => 'changeset_finish_ts', | ||
| 97 | column_info => { | ||
| 98 | data_type => "datetime", | ||
| 99 | datetime_undef_if_invalid => 1, | ||
| 100 | is_nullable => 0 | ||
| 101 | } | ||
| 102 | }, | ||
| 103 | { | ||
| 104 | name => 'changeset_elapsed', | ||
| 105 | column_info => { data_type => "varchar", is_nullable => 0, size => 16 } | ||
| 106 | }, | ||
| 107 | ) | ||
| 108 | } | ||
| 109 | |||
| 110 | # set 'method' as a direct passthrough to $Context->'name' per default (see DataPoint class) | ||
| 111 | 18 | ▶ | sub _change_context { |
|
Subroutine
_change_context: called CC=1 SCAR=0.0
| |||
| 112 | 18 | map {{ context => 'change', method => $_->{name}, %$_ }} ( | |
| 113 | { | ||
| 114 | name => 'change_ts', | ||
| 115 | column_info => { | ||
| 116 | data_type => "datetime", | ||
| 117 | datetime_undef_if_invalid => 1, | ||
| 118 | is_nullable => 0 | ||
| 119 | } | ||
| 120 | }, | ||
| 121 | { | ||
| 122 | name => 'action', | ||
| 123 | column_info => { data_type => "char", is_nullable => 0, size => 6 } | ||
| 124 | }, | ||
| 125 | { | ||
| 126 | name => 'action_id', | ||
| 127 | column_info => { data_type => "integer", is_nullable => 0 } | ||
| 128 | }, | ||
| 129 | { | ||
| 130 | name => 'pri_key_value', | ||
| 131 | column_info => { data_type => "varchar", is_nullable => 0, size => 255 } | ||
| 132 | }, | ||
| 133 | { | ||
| 134 | name => 'orig_pri_key_value', | ||
| 135 | column_info => { data_type => "varchar", is_nullable => 0, size => 255 } | ||
| 136 | }, | ||
| 137 | { | ||
| 138 | name => 'change_elapsed', | ||
| 139 | column_info => { data_type => "varchar", is_nullable => 0, size => 16 } | ||
| 140 | }, | ||
| 141 | { | ||
| 142 | name => 'column_changes_json', | ||
| 143 | column_info => { data_type => "mediumtext", is_nullable => 1 } | ||
| 144 | }, | ||
| 145 | { | ||
| 146 | name => 'column_changes_ascii', | ||
| 147 | column_info => { data_type => "mediumtext", is_nullable => 1 } | ||
| 148 | }, | ||
| 149 | ) | ||
| 150 | } | ||
| 151 | |||
| 152 | # set 'method' as a direct passthrough to $Context->'name' per default (see DataPoint class) | ||
| 153 | 18 | ▶ | sub _column_context { |
|
Subroutine
_column_context: called CC=1 SCAR=0.0
| |||
| 154 | 18 | map {{ context => 'column', method => $_->{name}, %$_ }} ( | |
| 155 | { | ||
| 156 | name => 'column_name', | ||
| 157 | column_info => { data_type => "varchar", is_nullable => 0, size => 128 } | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | name => 'old_value', | ||
| 161 | column_info => { data_type => "mediumtext", is_nullable => 1 } | ||
| 162 | }, | ||
| 163 | { | ||
| 164 | name => 'new_value', | ||
| 165 | column_info => { data_type => "mediumtext", is_nullable => 1 } | ||
| 166 | }, | ||
| 167 | |||
| 168 | # TODO: add 'diff' datapoint | ||
| 169 | |||
| 170 | ) | ||
| 171 | } | ||
| 172 | |||
| 173 | |||
| 174 | 14 | 1; | |
| 175 | |||
| 176 | __END__ | ||