From: Matt S Trout Date: Tue, 1 Oct 2019 02:26:52 +0000 (+0000) Subject: document remaining methods X-Git-Tag: v2.000000~3^2~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2bd5cb9efd09874c1d43cdd04fe92969c35c61b8;p=dbsrgits%2FSQL-Abstract.git document remaining methods --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index fa6583c..0c02622 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -3484,6 +3484,13 @@ Top level means avoid parens on statement AQT. my $res = $self->render_aqt($aqt, $top_level); my ($sql, @bind) = @$res; +=head2 join_query_parts + +Similar to join() but will render hashrefs as nodes for both join and parts, +and treats arrayref as a nested C<[ $join, @parts ]> structure. + + my $part = $self->join_query_parts($join, @parts); + =head1 NEW EXTENSION SYSTEM =head2 clone @@ -3589,6 +3596,39 @@ but excessive depth is avoided. my @list = $sqla->statement_list; +=head2 make_unop_expander + + my $exp = $sqla->make_unop_expander(sub { ... }); + +If the op is found as a binop, assumes it wants a default comparison, so +the inner expander sub can reliably operate as + + sub { my ($self, $name, $body) = @_; ... } + +=head2 make_binop_expander + + my $exp = $sqla->make_binop_expander(sub { ... }); + +If the op is found as a unop, assumes the value will be an arrayref with the +LHS as the first entry, and converts that to an ident node if it's a simple +scalar. So the inner expander sub looks like + + sub { + my ($self, $name, $body, $k) = @_; + { -blah => [ map $self->expand_expr($_), $k, $body ] } + } + +=head2 unop_expander + +=head2 unop_expanders + +=head2 binop_expander + +=head2 binop_expanders + +The above methods operate exactly like the op_ versions but wrap the coderef +using the appropriate make_ method first. + =head1 PERFORMANCE Thanks to some benchmarking by Mark Stosberg, it turns out that