Build database models in Perl 6, easily.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2f4c137 Apr 25, 2017
Failed to load latest commit information.
lib/DB/Model Split Row class into own file, added S11 provides. Feb 18, 2014
.gitignore Split off of WWW::App::MVC Feb 28, 2013
META6.json Use modern META filename Apr 25, 2017 link Feb 28, 2013



A simple set of base classes for building easy database models.

Example Model Library

    use DB::Model::Easy;
    class MyModel::User is DB::Model::Easy::Row {
      has $.id;
      has $.name is rw;
      has $.age  is rw;
      has $.job  is rw;

      ## Rules for mapping database columns to object attributes.
      ## 'id' is a primary key, auto-generated. The column for 'job' is called 'position'.
      has @.fields = 'id' => {:primary, :auto}, 'name', 'age', 'job' => 'position';
    class MyModel is DB::Model::Easy {
      has $.rowclass = MyModel::User;
      method getUserById ($id) {

    my $model =$table, driver => $db<driver>, opts => $db<opts>);
    my $user = $model.getUserById($uid);

    ## Let's get a list of other users with the same job as our own.
    my $others = $model.get.with(:job($user.job)).and.not(:id($;



This was originally a part of WWW::App::MVC, but I've split it off as its own library for those who may want to use it separately.


  • Add tests.


Timothy Totten. Catch me on #perl6 as 'supernovus'.


Artistic License 2.0