{"id":14969061,"url":"https://github.com/nyxcode/ormx","last_synced_at":"2025-05-16T10:09:00.319Z","repository":{"id":40661833,"uuid":"279191543","full_name":"NyxCode/ormx","owner":"NyxCode","description":"bringing orm-like features to sqlx","archived":false,"fork":false,"pushed_at":"2024-09-08T21:23:20.000Z","size":110,"stargazers_count":296,"open_issues_count":4,"forks_count":33,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-16T10:08:49.312Z","etag":null,"topics":["macros","mariadb","mysql","orm","postgres","rust","sqlx"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NyxCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-07-13T02:39:31.000Z","updated_at":"2025-04-23T03:06:40.000Z","dependencies_parsed_at":"2024-09-08T06:33:49.909Z","dependency_job_id":"6c599291-9c38-4a5a-8084-4f1d699869b6","html_url":"https://github.com/NyxCode/ormx","commit_stats":{"total_commits":61,"total_committers":7,"mean_commits":8.714285714285714,"dds":0.4098360655737705,"last_synced_commit":"e82432e803dfcfdb5967569bb3dad26d7b48e7b3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyxCode%2Formx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyxCode%2Formx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyxCode%2Formx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NyxCode%2Formx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NyxCode","download_url":"https://codeload.github.com/NyxCode/ormx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509476,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["macros","mariadb","mysql","orm","postgres","rust","sqlx"],"created_at":"2024-09-24T13:41:04.312Z","updated_at":"2025-05-16T10:08:55.300Z","avatar_url":"https://github.com/NyxCode.png","language":"Rust","readme":"\u003ch1 align=\"center\"\u003eormx\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n \u003cstrong\u003e\n   lightweight macros for \u003ca href=\"https://github.com/launchbadge/sqlx\"\u003esqlx\u003c/a\u003e  \n \u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003c!-- Version --\u003e\n  \u003ca href=\"https://crates.io/crates/ormx\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/ormx.svg?style=flat-square\"\n    alt=\"Crates.io version\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Discord --\u003e\n  \u003ca href=\"https://discord.gg/mrZz4Wv8r2\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/665528275556106240?style=flat-square\" alt=\"chat\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Docs --\u003e\n  \u003ca href=\"https://docs.rs/ormx\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\"\n      alt=\"docs.rs docs\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Downloads --\u003e\n  \u003ca href=\"https://crates.io/crates/ormx\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/d/ormx.svg?style=flat-square\"\n      alt=\"Download\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n## getting started\nAdd ormx and sqlx to your `Cargo.toml`\n```toml\n[dependencies.ormx]\nversion = \"0.11\"\nfeatures = [\"postgres\"]\n\n[dependencies.sqlx]\nversion = \"0.8\"\nfeatures = [\"postgres\", \"runtime-tokio-rustls\"]\n```\n\n## what does it do? \normx provides macros for generating commonly used sql queries at compile time.  \normx is meant to be used together with sqlx. Everything it generates uses `sqlx::query!` under the hood, so every generated query will be checked against your database at compile time.\n\n## what doesn't it do?\normx is not a full-fledged ORM nor a query builder. For everything except simple CRUD, you can always just use sqlx.  \n\nit is required that every table contains an id column, which uniquely\nidentifies a row. probably, you would want to use an auto-incrementing integer for this.\nthis is a central requirement of ormx, and if your table does not fulfill this requirement, ormx\nis not what you are looking for.\n\n## databases\n\n| database   | cargo feature             |\n|------------|---------------------------|\n| PostgreSQL | postgres[^1]              |\n| MariaDB    | mariadb                   |\n| MySQL      | mysql[^2]                 |\n| SQLite     | *currently not supported* |\n\n[^1]: out of these three, the `postgres` backend is the most mature.   \n[^2]: the `mysql` backend *does* work with both MariaDB and MySQL, though the `mariadb` backend emits cleaner and probably faster queries.\n\n\n## [example](https://github.com/NyxCode/ormx/tree/master/example-postgres/src/main.rs)\nfirst, start a postgres database.  \nif you have docker installed, you can do so using `./scripts/postgres.sh`.  \nnext, set the `DATABASE_URL` environment variable: `export DATABASE_URL=postgres://postgres:admin@localhost/ormx`.  \nnow, inside `example-postgres`, use the sqlx cli to setup the database schema: `cargo sqlx db setup`.  \nfinally, run `cargo run`.\n\n## help\nif you encounter an issue or have questions, feel free to ask in [`#ormx` on the sqlx discord](https://discord.gg/mrZz4Wv8r2).  \nThe documentation currently is not what it should be, so don't be afraid to ask for help.\n\n## migrate\n### to 0.11\nv0.11 updated the sqlx dependency to v0.8.  \nmost notably, the semantics of the `sqlx::Executor` trait have somewhat changed. in most cases, this is fixed by adding a `*` here or there.\n\n### to 0.7\nSince 0.7, id columns are not special anymore - if they are generated by the database, you must annotate them with `#[ormx(default)]`.\n\n## a note on reborrowing\nif you run into the issue that the compiler tells you that you can't re-use a `\u0026mut Connection` because  \n- `use of moved value` and\n- `move occurs because 'con' has type '\u0026mut Connection', which does not implement the 'Copy' trait`  \n\nyou'll have to manually reborrow the connection with `\u0026mut *con`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxcode%2Formx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyxcode%2Formx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyxcode%2Formx/lists"}