Engine/Builder/IndexCreate.pm untested

filter: Statementstmt 0.0% 0 / 45 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 63 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package SQL::Engine::Builder::IndexCreate;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry;
9 use routines;
10  
11 use Data::Object::Class;
12 use Data::Object::ClassHas;
13  
14 extends 'SQL::Engine::Builder';
15  
16 use SQL::Validator;
17  
18 our $VERSION = '0.01'; # VERSION
19  
20 # ATTRIBUTES
21  
22 has name => (
23 is => 'ro',
24 isa => 'Str',
25 opt => 1
26 );
27  
28 has for => (
29 is => 'ro',
30 isa => 'HashRef',
31 req => 1
32 );
33  
34 has columns => (
35 is => 'ro',
36 isa => 'ArrayRef[HashRef]',
37 req => 1
38 );
39  
40 has unique => (
41 is => 'ro',
42 isa => 'Bool',
43 opt => 1
44 );
45  
46 has safe => (
47 is => 'ro',
48 isa => 'Bool',
49 opt => 1
50 );
51  
52 # METHODS
53  
54 method data() {
55 my $schema = {};
56  
57 if ($self->name) {
58 $schema->{"name"} = $self->name;
59 }
60  
61 if ($self->for) {
62 $schema->{"for"} = $self->for;
63 }
64  
65 if ($self->columns) {
66 $schema->{"columns"} = $self->columns;
67 }
68  
69 if ($self->unique) {
70 $schema->{"unique"} = $self->unique;
71 }
72  
73 if ($self->safe) {
74 $schema->{"safe"} = $self->safe;
75 }
76  
77 return {
78 "index-create" => $schema
79 }
80 }
81  
82 1;