https://github.com/zostay/raku-modeldb
An ORM built on top of DBIish for Raku
https://github.com/zostay/raku-modeldb
Last synced: 5 months ago
JSON representation
An ORM built on top of DBIish for Raku
- Host: GitHub
- URL: https://github.com/zostay/raku-modeldb
- Owner: zostay
- License: artistic-2.0
- Created: 2018-08-15T01:20:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-08T16:37:56.000Z (over 6 years ago)
- Last Synced: 2025-07-27T14:58:13.630Z (11 months ago)
- Language: Perl 6
- Homepage:
- Size: 109 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
NAME
====
ModelDB - an MVP ORM
SYNOPSIS
========
use DBIish;
use ModelDB;
module Model {
use ModelDB::ModelBuilder;
model Person {
has Int $.person-id is column is primary;
has Str $.name is column is rw
has Int $.age is column is rw;
has Str $.favorite-color is column is rw;
}
model Pet {
has Str $.pet-id is column is primary;
has Str $.name is column is rw;
has Str $.animal is column is rw;
}
}
class Schema is ModelDB::Schema {
use ModelDB::SchemaBuilder;
has ModelDB::Table[Person] $.persons is table;
has ModelDB::Table[Pet] $.pets is table;
}
my $dbh = DBIish.connect('SQLite', :database);
my $schema = Schema.new(:$dbh);
my $person = $schema.persons.create(%(
name => 'Steve',
age => 9,
favorite-color => 'cyan',
));
$person.name = 'Alex';
$person.age = 4;
$person.favorite-color = 'green';
$schema.persons.update($person);
my $by-id = $schema.pets.find(pet-id(1));
my @cats = $schema.pets.search(:animal).all;
DESCRIPTION
===========
This is a minimalist object relational mapping tool. It helps with mapping your database objects into Perl from an RDBMS. I am experimenting with this API to see what I can learn about RDBMS patterns, problems, and specific issues as related to Perl 6.
As such, this is highly experimental and I make no promises as regards the API. Though, I do use it in some production-ish code, so I don't want to change too much too fast.
My intent, though, is to use what I learn here to build a different library in a different namespace that does what I really want based on what I learn here.
My goals include:
over
====
Pod::Defn<140403348404624>
Pod::Defn<140403348404568>
Pod::Defn<140403332796200>
Pod::Defn<140403332796256>
Pod::Defn<140403332796312>
back
====
Performance and multiple RDBMS support are anti-goals. This will likely only support MySQL (and forks) and SQLite because that's what I care about. I do not plan to make performance improvements unless required and I especially do not intend to add any optimizations that harm code readability of even the internals unless required.