Skip to content
MasterDuke17 edited this page Sep 7, 2019 · 2 revisions

timotimo gave me a very good idea of how to make maps and greps much better (https://colabti.org/irclogger/irclogger_log/perl6?date=2018-11-12#l1058) so, with this commit it's now possible to do it:

use Red;

model M is table<mmm> {
   has Str $.a is column;
   has Bool $.b is column;
}

my $*RED-DB = database "SQLite";
M.^create-table;
my $*RED-DEBUG = True;

say M.^all.map: { .a if .b }
# say M.^all.map: { next unless .b; .a } # the same

and that will run:

SELECT
   mmm.a as "data"
FROM
   mmm
WHERE
   not (b == 0 OR b IS NULL)
Clone this wiki locally