gdonald / ORM-ActiveRecord

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

Home Page:https://gregdonald.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ORM::ActiveRecord

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

Documentation

https://gdonald.github.io/ORM-ActiveRecord/

Install using zef

zef install --/test ORM::ActiveRecord

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

Simple Example

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

say $user.pages.first.name;
Rakuist

say $page.user.fname;
Greg

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

say $page.user.fname;
Fred

Please see the documentation for more examples.

Build Status

.github/workflows/raku.yml

License

ORM::ActiveRecord is released under the Artistic License 2.0

Features

  • Model:
    • belongs-to
    • has-many
    • has-many -> through
    • where: all, first, count
    • Validations
      • Conditionals: if, unless, on, create, update
      • Acceptance
      • Confirmation
      • Exclusion
      • Format
      • Inclusion
      • Length
      • Minimum
      • Maximum
      • In a range
      • Is exactly
      • Numericality
      • Less than
      • Less than or equal
      • Greater than
      • Greater than or equal
      • In a range
      • Presence
      • Uniqueness
      • Unique Scope
    • Callbacks
      • after: create, save, update
      • before: create, save, update
    • Scopes
    • Dirty
    • Custom Errors
  • Migrations
  • PostgreSQL support

TODO

  • Includes: for has-many records
  • Migration generator
  • Model generator
  • Support for MySQL, SQLite, and Oracle.

About

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

https://gregdonald.com

License:Artistic License 2.0


Languages

Language:Raku 99.9%Language:Shell 0.1%