From: Justin Hunter Date: Tue, 16 Jun 2009 00:12:11 +0000 (-0700) Subject: add DBIHandle X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a336288a92f839becf9a92d01dbbe4ce7f36f3f5;p=dbsrgits%2FSQL-Translator-2.0-ish.git add DBIHandle --- diff --git a/lib/SQL/Translator/Types.pm b/lib/SQL/Translator/Types.pm index 7625f85..765b0fc 100644 --- a/lib/SQL/Translator/Types.pm +++ b/lib/SQL/Translator/Types.pm @@ -1,5 +1,6 @@ package SQL::Translator::Types; -use MooseX::Types -declare, [qw(Column Constraint Index Procedure Schema Table Trigger View)]; +use MooseX::Types::Moose qw(ArrayRef CodeRef Str); +use MooseX::Types -declare, [qw(Column Constraint Index Procedure Schema Table Trigger View DBIHandle)]; class_type Column, { class => 'SQL::Translator::Object::Column' }; class_type Constraint, { class => 'SQL::Translator::Object::Constraint' }; @@ -10,4 +11,19 @@ class_type Table, { class => 'SQL::Translator::Object::Table' }; class_type Trigger, { class => 'SQL::Translator::Object::Trigger' }; class_type View, { class => 'SQL::Translator::Object::View' }; +subtype DBIHandle, as 'DBI::db'; + +coerce DBIHandle, + from Str, + via(\&_coerce_dbihandle_from_str), + from ArrayRef, + via(\&_coerce_dbihandle_from_arrayref); + from CodeRef, + via(\&_coerce_dbihandle_from_coderef); + + +sub coerce_dbihandle_from_str { } +sub coerce_dbihandle_from_arrayref { } +sub coerce_dbihandle_from_coderef { } + 1;