line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Model::DB; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
4
|
1
|
|
|
1
|
|
550
|
use Type::Tiny; |
|
1
|
|
|
|
|
14206
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
534
|
use Types::Standard qw/ArrayRef Int Str/; |
|
1
|
|
|
|
|
33698
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
1089
|
use Moo; |
|
1
|
|
|
|
|
8859
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
1325
|
use DBIx::Model::Table; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
233
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.0.1_1'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $Table = Type::Tiny->new( |
12
|
|
|
|
|
|
|
name => 'Table', |
13
|
|
|
|
|
|
|
constraint => sub { ref($_) eq 'table' }, |
14
|
|
|
|
|
|
|
message => sub { "$_ ain't a table" }, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has chains => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
isa => Int, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has _tables => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => ArrayRef [$Table], |
25
|
|
|
|
|
|
|
default => sub { [] }, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has name => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => Str, |
31
|
|
|
|
|
|
|
required => 1, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub add_table { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
my $table = DBIx::Model::Table->new( @_, db => $self ); |
37
|
0
|
|
|
|
|
|
push( @{ $self->_tables }, $table ); |
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $table; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub tables { |
42
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
43
|
0
|
0
|
|
|
|
|
return @{ $self->_tables } if wantarray; |
|
0
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return $self->_tables; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub as_string { |
48
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
49
|
0
|
|
|
|
|
|
my $str = $self->name; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
foreach my $table ( $self->tables ) { |
52
|
0
|
|
|
|
|
|
$str .= "\n" . $table->as_string(' '); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $str; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |