remove unneeded MooseX::Types::Moose imports
[dbsrgits/SQL-Translator-2.0-ish.git] / lib / SQL / Translator / Object / Index.pm
CommitLineData
4f4fd192 1use MooseX::Declare;
ebf2721d 2class SQL::Translator::Object::Index extends SQL::Translator::Object {
b750d2f1 3 use MooseX::Types::Moose qw(ArrayRef HashRef Str);
4f4fd192 4 use MooseX::AttributeHelpers;
f49a2a49 5 use SQL::Translator::Types qw(Column Table);
f49a2a49 6
7 has 'table' => (
8 is => 'rw',
9 isa => Table,
10 required => 1,
11 weak_ref => 1,
12 );
4f4fd192 13
14 has 'name' => (
15 is => 'rw',
16 isa => Str,
17 required => 1
18 );
2850baeb 19
4f4fd192 20 has 'columns' => (
21 metaclass => 'Collection::Hash',
22 is => 'rw',
23 isa => HashRef[Column],
24 provides => {
25 exists => 'exists_column',
26 keys => 'column_ids',
65061e1b 27 values => 'get_columns',
4f4fd192 28 get => 'get_column',
51700db2 29 set => 'add_column',
4f4fd192 30 },
31 default => sub { my %hash = (); tie %hash, 'Tie::IxHash'; return \%hash },
32 );
2850baeb 33
4f4fd192 34 has 'type' => (
35 is => 'rw',
36 isa => Str,
37 required => 1
38 );
65061e1b 39
51700db2 40 around add_column(Column $column) { $self->$orig($column->name, $column) }
41
6b4be44b 42 method get_fields { $self->get_columns }
43 method fields { $self->column_ids }
4f4fd192 44}