ORM::ActiveRecord

The latest version of this documentation lives at https://gdonald.github.io/ORM-ActiveRecord/.

The homepage for ORM::ActiveRecord is https://github.com/gdonald/ORM-ActiveRecord.

Synopsis

ORM::ActiveRecord is an object-relational mapping module for Rakudo Perl 6 that mostly follows the Active Record Pattern.

Example Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
use User;
use Page;

my User $user = User.create({fname => 'Greg'});
my Page $page = Page.create({:$user, name => 'Rakuist'});

say $user.pages.first.name;
say $page.user.fname;

my User $alfred = User.create({fname => 'Alfred'});
$page.update({user => $alfred});

say $page.user.fname

Output:

1
2
3
Rakuist
Greg
Alfred

Install

ORM::ActiveRecord can be installed using the zef module installation tool:

1
zef install --/test ORM::ActiveRecord

--/test is suggested because you probably don't have a test database setup. You can of course setup a test database.