Skip to content

Instantly share code, notes, and snippets.


FCO/2.p6 Secret

Last active December 1, 2018 19:42
What would you like to do?
use Red;
model Person { ... }
model Wishlist {
has UInt $!id is serial;
has UInt $!wisher-id is referencing{ };
has Person $.wisher is relationship{ .wisher-id };
has Str:D $.name is column is required;
has Str $.link is column;
model Person is rw {
has UInt $.id is serial;
has Str $.name is column;
has Str $.email is column;
has Wishlist @.wishes is relationship{ .wisher-id }
my $*RED-DB = database "SQLite";
my \fernando = Person.^create: :name<Fernando>, :email<>;
fernando.wishes.create: :name<Comma>, :link<>;
fernando.wishes.create: :name("perl6 books"), :link<>;
fernando.wishes.create: :name("mac book pro"), :link<>;
my \aline = Person.^create: :name<Aline>, :email<>;
aline.wishes.create: :name("a new closet"), :link<>;
my \fernanda = Person.^create: :name<Fernanda>, :email<>;
fernanda.wishes.create: :name("mimikyu plush"), :link<é-plush-%28standard-size%29---10-701-02831>;
fernanda.wishes.create: :name("camelia plush"), :link<>;
my \sophia = Person.^create: :name<Sophia>, :email<>;
sophia.wishes.create: :name("baby alive"), :link<>;
say "\n{ .name }\n{{" { .name } => { .link }" }).join("\n").indent: 3 }" for Person.^all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment