Skip to content
Fernando Correa de Oliveira edited this page Jan 2, 2019 · 3 revisions

With the same idea from map grep now its possible to use CASE/WHEN directly from .map. For example:

use Red;

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

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

say M.^all.map: { .b < 10 ?? .a !! .c }

that runs:

SELECT
   CASE 
      WHEN b < 10 THEN a
      ELSE c
   END
    as "data"
FROM
   mmm
Clone this wiki locally