{"body":"$ perl6 -e '\n\n\nuse Red;\n  \nmodel Foo {\n    has Int $.id is serial;\n    has Str $.foo is column{ :nullable };\n}\n\nmy $*RED-DEBUG          = $_ with %*ENV<RED_DEBUG>;\nmy $*RED-DB             = database \"SQLite\", |(:database($_) with %*ENV<RED_DATABASE>);\n\nFoo.^create-table;\n\nFoo.^create(foo => \"one\");\nFoo.^create(foo => \"two\");\nFoo.^create;\nsub formatter(Red::ResultSeq:D $rs --> Str ) {\n    my @cols   = $rs.of.^attributes.grep(Red::Attr::Column).map( -> $c { $c.name.substr(2) });\n\n    my $str = @cols.join(\"\\t\\t|\");\n    $str ~= \"\\n\" ~ ( \"-\" x 50 ) ~ \"\\n\";\n    for $rs -> $row {\n        $str ~= @cols.map( -> $n { $row.\"$n\"() // \"\" }).join(\"\\t\\t|\") ~ \"\\n\";\n    }\n\n   $str;\n}\nsay formatter(Foo.^rs);\n\n\n'\nid\t\t|foo\n--------------------------------------------------\n1\t\t|one\n2\t\t|two\n3\t\t|","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/1AY5DXAu","modified":1552982790,"id":"1AY5DXAu","size":784,"lines":38,"own_paste":false,"theme":"","date":1552982790}