add some docs for the role
[dbsrgits/SQL-Abstract.git] / lib / DBIx / Class / SQLMaker / Role / SQLA2Passthrough.pm
index 572184f..d7db581 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 use Exporter 'import';
 
-our @EXPORT = qw('on');
+our @EXPORT = qw(on);
 
 sub on (&) {
   my ($on) = @_;
@@ -31,7 +31,7 @@ around select => sub {
               my %f = %$_;
               my $as = delete $f{-as};
               my ($f, $rhs) = %f;
-              my $func = +{ "-${f}" => $rhs };
+              my $func = +{ ($f =~ /^-/ ? $f : "-${f}") => $rhs };
               ($as
                 ? +{ -op => [ 'as', $func, { -ident => [ $as ] } ] }
                 : $func)
@@ -46,7 +46,7 @@ around select => sub {
     };
   }
   $self->$orig($table, $fields, $where, $rs_attrs, $limit, $offset);
-});
+};
 
 sub expand_join_condition {
   my ($self, $cond, $args) = @_;
@@ -69,6 +69,22 @@ sub expand_join_condition {
 
 __END__
 
+=head1 NAME
+
+DBIx::Class::SQLMaker::Role::SQLA2Passthrough - A test of future possibilities
+
+=head1 SYNOPSIS
+
+=over 4
+
+=item * select and group_by options are processed using the richer SQLA2 code
+
+=item * expand_join_condition is provided to more easily express rich joins
+
+=back
+
+See C<examples/sqla2passthrough.pl> for a small amount of running code.
+
 =head1 SETUP
 
   (on_connect_call => sub {
@@ -121,3 +137,5 @@ becomes
           'foreign.priority' => { '>=', { -value => $_{min_priority} } } }
       }]
   );
+
+=cut