Aniki
view release on metacpan or search on metacpan
lib/Aniki/Schema/Table.pm view on Meta::CPAN
package Aniki::Schema::Table;
use 5.014002;
use namespace::autoclean;
use Mouse v2.4.5;
use Carp qw/croak/;
use Aniki::Schema::Relationships;
use Aniki::Schema::Table::Field;
use Aniki::Schema::Table::PrimaryKey;
use SQL::Translator::Schema::Constants;
has _schema => (
is => 'ro',
required => 1,
weak_ref => 1,
);
has _table => (
is => 'ro',
required => 1,
);
has name => (
is => 'ro',
default => sub { shift->_table->name },
);
has relationships => (
is => 'ro',
default => \&_setup_relationships,
);
has primary_key => (
is => 'ro',
default => sub {
my $self = shift;
if (my $primary_key = $self->_table->primary_key) {
return Aniki::Schema::Table::PrimaryKey->new($primary_key);
}
return undef;
},
);
has _fields_cache => (
is => 'ro',
default => sub {
my $self = shift;
return [
map { Aniki::Schema::Table::Field->new($_) } $self->_table->get_fields
]
},
);
has _field_names => (
is => 'ro',
default => sub {
my $self = shift;
return [map { $_->name } @{ $self->_fields_cache }];
},
);
has _fields_map_cache => (
is => 'ro',
default => sub {
( run in 0.549 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )