{"id":51159087,"url":"https://github.com/ultimaweapon/porm","last_synced_at":"2026-06-26T12:30:42.753Z","repository":{"id":345898556,"uuid":"1187772554","full_name":"ultimaweapon/porm","owner":"ultimaweapon","description":"ORM for PostgreSQL that derive models from migration scripts","archived":false,"fork":false,"pushed_at":"2026-06-21T16:44:37.000Z","size":143,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-21T18:21:06.201Z","etag":null,"topics":["orm","postgresql","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ultimaweapon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ultimaweapon"}},"created_at":"2026-03-21T06:18:04.000Z","updated_at":"2026-06-21T16:44:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ultimaweapon/porm","commit_stats":null,"previous_names":["ultimaweapon/porm"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ultimaweapon/porm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fporm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fporm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fporm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fporm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ultimaweapon","download_url":"https://codeload.github.com/ultimaweapon/porm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ultimaweapon%2Fporm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34817640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["orm","postgresql","rust"],"created_at":"2026-06-26T12:30:41.808Z","updated_at":"2026-06-26T12:30:42.740Z","avatar_url":"https://github.com/ultimaweapon.png","language":"Rust","funding_links":["https://github.com/sponsors/ultimaweapon"],"categories":[],"sub_categories":[],"readme":"# Porm\n[![Crates.io Version](https://img.shields.io/crates/v/porm?label=porm)](https://crates.io/crates/porm)\n[![Crates.io Version](https://img.shields.io/crates/v/porm-parser?label=porm-parser)](https://crates.io/crates/porm-parser)\n[![docs.rs](https://img.shields.io/docsrs/porm)](https://docs.rs/porm)\n\nPorm is a new type of ORM for PostgreSQL. Instead of defining some models in Rust, Porm parse migration scripts and generate models from it.\n\n\u003e [!WARNING]\n\u003e Porm currently in a pre-1.0 so prepare for a lot of breaking changes!\n\n## Features\n\n- Lightweight.\n  - The generated models in a thin layer on top of [tokio-postgres](https://crates.io/crates/tokio-postgres) API.\n- Database is a single source of truth.\n- Built-in schema migration.\n- Use actual parser from PostgreSQL.\n\n## How it works\n\nSuppose you have the following migration scripts:\n\n```sql\n-- 0.sql\nCREATE TABLE post (\n    id serial NOT NULL,\n    title text NOT NULL,\n    body text NOT NULL,\n    PRIMARY KEY (id)\n);\n```\n\n```sql\n-- 1.sql\nALTER TABLE post ADD published boolean NOT NULL DEFAULT FALSE;\n\nCREATE INDEX ON post (published);\n```\n\nPorm will generate a corresponding struct for you:\n\n```rust\npub struct Post\u003c'a\u003e {\n    pub id: i32,\n    pub title: Cow\u003c'a, str\u003e,\n    pub body: Cow\u003c'a, str\u003e,\n    pub published: bool,\n}\n```\n\nThe generated struct will have methods to query PostgreSQL based on table indexes:\n\n```rust\nimpl\u003c'a\u003e Post\u003c'a\u003e {\n    pub async fn find\u003cT: GenericClient\u003e(client: \u0026T, id: i32) -\u003e Result\u003cOption\u003cSelf\u003e, Error\u003e;\n    pub async fn select_by_published\u003cT: GenericClient\u003e(\n        client: \u0026T,\n        published: bool,\n    ) -\u003e Result\u003cPin\u003cBox\u003cimpl Stream\u003cItem = Result\u003cSelf, Error\u003e\u003e + use\u003c'a, T\u003e\u003e\u003e, Error\u003e;\n}\n```\n\nPorm also generate a helper struct to insert a new row with default values:\n\n```rust\npub struct PostBuilder\u003c'a\u003e { ... }\n\nimpl\u003c'a\u003e PostBuilder\u003c'a\u003e {\n    pub fn new(title: \u0026'a str, body: \u0026'a str) -\u003e Self;\n    pub fn set_id(\u0026mut self, v: i32) -\u003e \u0026mut Self;\n    pub fn set_title(\u0026mut self, v: \u0026'a str) -\u003e \u0026mut Self;\n    pub fn set_body(\u0026mut self, v: \u0026'a str) -\u003e \u0026mut Self;\n    pub fn set_published(\u0026mut self, v: bool) -\u003e \u0026mut Self;\n    pub async fn create\u003cT: GenericClient\u003e(\u0026self, client: \u0026T) -\u003e Result\u003cPost\u003c'static\u003e, Error\u003e;\n}\n```\n\nNotice `PostBuilder::new` function that requires non-null columns without default value. The following code will insert a new row and construct `Post` value with `id` and `published` loaded from the database:\n\n```rust\nlet post = PostBuilder::new(\"Foo\", \"Bar.\").create(\u0026pg).await.unwrap();\n\nassert_eq!(post.id, 1); // Suppose this is the first row.\nassert_eq!(post.title, \"Foo\");\nassert_eq!(post.body, \"Bar.\");\nassert!(!post.published);\n```\n\n## Non-goals\n\n- Synchronous API.\n- Supports downgrade migration.\n- Supports other databases.\n\n## Breaking changes in parser 0.3\n\n- `ParseError` no longer have migration version on every variants.\n- Migration version will be become a migration name if `Migration::name` return `None`.\n\n## Breaking changes in 0.2\n\n- `Migration::name` no longer optional.\n- `Logger::run` has new signature.\n- `Error::ExecuteMigration` and `Error::UpdateVersion` has been updated.\n\n## License\n\nThis project is licensed under either of\n\n- Apache License, Version 2.0\n- MIT License\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Porm by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fporm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultimaweapon%2Fporm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultimaweapon%2Fporm/lists"}