From: Matt S Trout Date: Mon, 30 Sep 2019 19:23:32 +0000 (+0000) Subject: doc is op expander X-Git-Tag: v1.90_01~59 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b49ddc3237d4efe1948503b1a90b869a0c51d4a;p=dbsrgits%2FSQL-Abstract.git doc is op expander --- diff --git a/lib/SQL/Abstract/Reference.pm b/lib/SQL/Abstract/Reference.pm index e1ed68a..343f60a 100644 --- a/lib/SQL/Abstract/Reference.pm +++ b/lib/SQL/Abstract/Reference.pm @@ -854,4 +854,33 @@ A non-trivial LHS is expanded with ident as the default rather than value: (x, y) IN ( (?, ?), (?, ?) ) [ 1, 2, 3, 4 ] +=head2 and/or ops + +expands the same way as a plain arrayref/hashref expression but with the +logic type set to the op name. + +=head2 is op + +Expands is and is_not to null checks, RHS value must be undef: + + # expr + { -is => [ 'foo', undef ] } + + # aqt + { -op => [ 'is_null', { -ident => [ 'foo' ] } ] } + + # query + foo IS NULL + [] + + # expr + { bar => { -is_not => undef } } + + # aqt + { -op => [ 'is_not_null', { -ident => [ 'bar' ] } ] } + + # query + bar IS NOT NULL + [] + =cut