{"id":19479219,"url":"https://github.com/pmb0/mojo-pg-orm","last_synced_at":"2026-04-16T09:39:33.212Z","repository":{"id":31388636,"uuid":"34951758","full_name":"pmb0/mojo-pg-orm","owner":"pmb0","description":"A simple blocking and non-blocking object relational mapper for Mojolicious and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2016-02-25T08:46:25.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T16:45:41.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pmb0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-02T14:59:07.000Z","updated_at":"2017-07-13T12:58:18.000Z","dependencies_parsed_at":"2022-08-17T18:30:59.306Z","dependency_job_id":null,"html_url":"https://github.com/pmb0/mojo-pg-orm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pmb0/mojo-pg-orm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb0%2Fmojo-pg-orm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb0%2Fmojo-pg-orm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb0%2Fmojo-pg-orm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb0%2Fmojo-pg-orm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmb0","download_url":"https://codeload.github.com/pmb0/mojo-pg-orm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmb0%2Fmojo-pg-orm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31880869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T09:23:21.276Z","status":"ssl_error","status_checked_at":"2026-04-16T09:23:15.028Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T19:53:23.149Z","updated_at":"2026-04-16T09:39:33.194Z","avatar_url":"https://github.com/pmb0.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mojo::Pg::ORM [![Build Status](https://travis-ci.org/pmb0/mojo-pg-orm.svg?branch=master)](https://travis-ci.org/pmb0/mojo-pg-orm)\n\nA simple blocking and non-blocking object relational mapper for Mojolicious\nand PostgreSQL.\n\n*THIS IS EXPERIMENTAL SOFTWARE. USE AT YOUR OWN RISK.*\n\n1. Create a `Mojolicious` application\n\n    ```perl\n    # Mojolicious::Lite example app\n    package main;\n    use Mojolicious::Lite;\n    use experimental 'signatures';\n\n    use Mojo::Pg::ORM;\n    use My::Model;\n\n    helper orm =\u003e sub { state $orm = My::Model-\u003enew($connection) };\n\n    # non-blocking\n    get '/postings/:id' =\u003e sub($c) {\n        $c-\u003eorm-\u003emodel('Posting')-\u003efind($c-\u003eparam('id'), sub($err, $posting) {\n            $c-\u003erender(text =\u003e $posting-\u003e{title});\n        });\n    };\n\n    # non-blocking\n    get '/postings' =\u003e sub($c) {\n        $c-\u003eorm-\u003emodel('Posting')-\u003esearch(undef, sub($err, $posting) {\n            $c-\u003estash(postings =\u003e $postings);\n            $c-\u003erender;\n        });\n    };\n\n    # blocking\n    get '/postings' =\u003e sub($c) {\n        $c-\u003estash(postings =\u003e $c-\u003eorm-\u003emodel('Posting')-\u003eall);\n        $c-\u003erender;\n    };\n    ```\n\n2. Create `My::Model` class\n\n    ```perl\n    # Base class to be instantiated in main\n    package My::Model;\n    use Mojo::Base 'Mojo::Pg::ORM';\n    ```\n\n3. Create `Mojo::Pg::ORM::Model` classes\n\n    ```perl\n    # Model class for the table \"postings\"\n    package My::Model::Posting;\n    use Mojo::Base 'Mojo::Pg::ORM::Model';\n    use experimental 'signatures';\n\n    use Mojo::Date;\n\n    hook before_create =\u003e sub($self) {\n        $self-\u003e{created} = Mojo::Date-\u003enew;\n    }\n\n    sub hello($self) {\n        return 'Hello, ' . $self-\u003e{title};\n    }\n    ```\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmb0%2Fmojo-pg-orm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmb0%2Fmojo-pg-orm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmb0%2Fmojo-pg-orm/lists"}