From: Matt S Trout Date: Fri, 17 May 2019 02:21:59 +0000 (+0000) Subject: add CAST() to ExtraClauses X-Git-Tag: v2.000000~3^2~167 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7b56075393f4805c610b0f14c17a78116eef4ca2;p=dbsrgits%2FSQL-Abstract.git add CAST() to ExtraClauses --- diff --git a/lib/SQL/Abstract/ExtraClauses.pm b/lib/SQL/Abstract/ExtraClauses.pm index 2dafda1..a632896 100644 --- a/lib/SQL/Abstract/ExtraClauses.pm +++ b/lib/SQL/Abstract/ExtraClauses.pm @@ -176,6 +176,13 @@ sub register_defaults { for qw(with with_recursive); $self->clause_renderer("${stmt}.with", $with_renderer); } + $self->expander(cast => sub { + my ($cast, $to) = @{$_[2]}; + +{ -func => [ cast => { -as => [ + $self->expand_expr($cast), + $self->expand_expr($to, -ident), + ] } ] }; + }); return $self; }