{"id":19316788,"url":"https://github.com/rkusa/sqlm","last_synced_at":"2025-09-11T04:33:29.885Z","repository":{"id":243196710,"uuid":"654968428","full_name":"rkusa/sqlm","owner":"rkusa","description":"An `sql!` macro to write compile-time checked database queries similar to how `format!` works","archived":false,"fork":false,"pushed_at":"2025-03-11T17:30:09.000Z","size":318,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T20:33:18.336Z","etag":null,"topics":["postgres","postgresql","rust","sql"],"latest_commit_sha":null,"homepage":"https://docs.rs/sqlm-postgres","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/rkusa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2023-06-17T13:34:13.000Z","updated_at":"2025-03-11T17:30:13.000Z","dependencies_parsed_at":"2024-06-07T09:49:01.603Z","dependency_job_id":"27d8b2c0-b3b3-4e07-8a1a-3df9052b56ad","html_url":"https://github.com/rkusa/sqlm","commit_stats":null,"previous_names":["rkusa/sqlm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkusa%2Fsqlm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkusa%2Fsqlm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkusa%2Fsqlm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkusa%2Fsqlm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkusa","download_url":"https://codeload.github.com/rkusa/sqlm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287338,"owners_count":21405588,"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":["postgres","postgresql","rust","sql"],"created_at":"2024-11-10T01:12:40.026Z","updated_at":"2025-04-22T17:30:29.634Z","avatar_url":"https://github.com/rkusa.png","language":"Rust","readme":"# `sqlm`\n\nAn `sql!` macro to write compile-time checked database queries similar to how `format!` works.\n\n[Documentation](https://docs.rs/sqlm-postgres)\n\n## Example\n\n```rust\nlet id: i64 = 1;\nlet user: User = sql!(\"SELECT * FROM users WHERE id = {id}\").await?;\n\n#[derive(Debug, FromRow)]\nstruct User {\n    id: i64,\n    name: String,\n    role: Role,\n}\n\n#[derive(Debug, Default, FromSql, ToSql, Enum)]\n#[postgres(name = \"role\")]\nenum Role {\n    #[default]\n    #[postgres(name = \"user\")]\n    User,\n    #[postgres(name = \"admin\")]\n    Admin,\n}\n```\n\n## Usage\n\n- Add `sqlm-postgres` to your dependencies\n  ```bash\n  cargo add sqlm-postgres\n  ```\n\n- Make the `DATABASE_URL` env variable available during compile time (e.g. via adding an `.env` file)\n  ```bash\n  echo DATABASE_URL=postgres://your-user@localhost/your-db \u003e .env\n  ```\n\n- Start using the `sql!` macro (no further setup necessary; a connection pool is automatically created for you)\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkusa%2Fsqlm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkusa%2Fsqlm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkusa%2Fsqlm/lists"}