| 1 | package MySQL::Util::Lite::AlternateKey; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | our $VERSION = '0.01'; | |||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Modern::Perl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Method::Signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use Data::Printer alias => 'pdump'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | with 'MySQL::Util::Lite::Roles::NewColumn'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has name => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | isa => 'Str', | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 1 | has columns => ( | |||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | isa => 'ArrayRef[MySQL::Util::Lite::Column]', | ||||||||||
| 22 | lazy => 1, | ||||||||||
| 23 | builder => '_build_columns', | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | 1 | has _util => ( | |||||||||
| 27 | is => 'ro', | ||||||||||
| 28 | isa => 'MySQL::Util', | ||||||||||
| 29 | required => 1, | ||||||||||
| 30 | ); | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | method get_columns { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
get_columns: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | 0 | return @{ $self->columns }; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | method _build_columns { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
Subroutine
_build_columns: not called CC=3 SCAR=21.1
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 0 | my $aref = $self->_util->get_constraint( name => $self->name ); | |||||||||
| 40 | |||||||||||
| 41 | 0 | my @cols; | |||||||||
| 42 | 0 | foreach my $col (@$aref) { | |||||||||
| 43 | my $href = $self->_util->describe_column( | ||||||||||
| 44 | table => $col->{TABLE_NAME}, | ||||||||||
| 45 | column => $col->{COLUMN_NAME} | ||||||||||
| 46 | 0 | ); | |||||||||
| 47 | 0 | push @cols, $self->new_column($href); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | return \@cols; | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||