Clean the type library
[dbsrgits/SQL-Abstract-2.0-ish.git] / lib / SQL / Abstract / Types.pm
CommitLineData
cbcfedc1 1use MooseX::Declare;
2class SQL::Abstract::Types {
3 use Moose::Util::TypeConstraints;
cbcfedc1 4 use MooseX::Types::Moose qw/ArrayRef Str Int Ref HashRef/;
5
00a0470e 6 clean;
7
8 use MooseX::Types -declare => [qw/NameSeparator QuoteChars AST/];
9
bad761ba 10 subtype AST, as HashRef,
cbcfedc1 11 where { exists $_->{-type} && is_Str($_->{-type}) },
12 message { "No '-type' key, or it is not a string" };
13
cbcfedc1 14 subtype NameSeparator,
4ee32f41 15 as Str,
16 where { length($_) == 1 };
17
18
19 subtype QuoteChars,
cbcfedc1 20 as ArrayRef[Str];
4ee32f41 21 where { @$_ == 1 || @$_ == 2 },
22 message { "Quote characters must be one or two elements" };
cbcfedc1 23
4ee32f41 24 coerce QuoteChars, from Str, via { [ split //, $_ ] };
cbcfedc1 25
26}
27
281;