{"id":17929705,"url":"https://github.com/ojford/rusqlite-model","last_synced_at":"2026-02-22T23:03:47.151Z","repository":{"id":81321361,"uuid":"343246454","full_name":"OJFord/rusqlite-model","owner":"OJFord","description":"Model trait and derive implementation for rusqlite","archived":false,"fork":false,"pushed_at":"2023-01-11T01:58:00.000Z","size":15,"stargazers_count":12,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-19T01:45:25.630Z","etag":null,"topics":["database","orm","rusqlite","rust","sqlite"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rusqlite-model","language":"Rust","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/OJFord.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"OJFord"}},"created_at":"2021-03-01T00:24:04.000Z","updated_at":"2024-12-25T08:54:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"c1f1d8de-1b99-4dc6-a36c-26ee5a366fd3","html_url":"https://github.com/OJFord/rusqlite-model","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OJFord%2Frusqlite-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OJFord%2Frusqlite-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OJFord%2Frusqlite-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OJFord%2Frusqlite-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OJFord","download_url":"https://codeload.github.com/OJFord/rusqlite-model/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245210967,"owners_count":20578321,"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":["database","orm","rusqlite","rust","sqlite"],"created_at":"2024-10-28T21:10:13.180Z","updated_at":"2026-02-22T23:03:42.105Z","avatar_url":"https://github.com/OJFord.png","language":"Rust","funding_links":["https://github.com/sponsors/OJFord"],"categories":[],"sub_categories":[],"readme":"# rusqlite-model\n\n[![Crates.io](https://img.shields.io/crates/v/rusqlite-model?style=flat-square)](//crates.io/crates/rusqlite-model) [![docs.rs](https://img.shields.io/docsrs/rusqlite-model?style=flat-square)](//docs.rs/rusqlite-model)\n\nFor when serialising/deserialising a struct into/from your ([rusqlite](//github.com/rusqlite/rusqlite)) database queries would be convenient, but you don't need all of [diesel](//diesel.rs).\n\n## Usage\n\n```toml\n[dependencies]\nrusqlite-model = \"0.1\"\n```\n\n```rust\nuse rusqlite_model::Model;\n\n#[derive(Model)]\nstruct User {\n    name: String,\n    email: String,\n    is_active: bool,\n    #[sql_type(DATE)]\n    last_login: String,\n}\n\nfn ensure_exactly_one_user(conn: \u0026rusqlite::Connection) -\u003e rusqlite::Result\u003cusize\u003e {\n    User::drop_table(\u0026conn)?;\n    User::create_table(\u0026conn)?;\n\n    User {\n        name: \"OJFord\".into(),\n        email: \"foo@example.com\".into(),\n        is_active: true,\n        last_login: \"2021/02/28\".into(),\n    }\n    .insert(\u0026conn)\n}\n\nfn get_active_users(conn: \u0026rusqlite::Connection) -\u003e rusqlite::Result\u003cVec\u003cUser\u003e\u003e {\n    let mut stmt = conn.prepare(\"SELECT * FROM users WHERE is_active = ?\")?;\n    stmt.query_map(params![true], |row| row.try_into::\u003cUser\u003e())\n}\n```\n\n## To do\n\n- Docs \u0026 tests\n- More types (String -\u003e TEXT; bool -\u003e BOOL currently supported, anything else requires explicit `#[sql_type(...)]`)\n- Some kind of `::from_query` helper (connection \u0026 query string -\u003e maybe model)\n\n## Won't do\n\n- Not intending to be a full ORM with much DSL, use `diesel` if that's wanted;\n- I like `rusqlite`'s simplicity when only SQLite is needed, this is just intended to reduce boilerplate around inserting (`VALUES (?,?,?,?,`.. how many `?` again?) and parsing results into structs for better ergonomics;\n- Migrations\n- Pan-DBMS portability (`rusqlite`, and hence SQLite, only)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojford%2Frusqlite-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fojford%2Frusqlite-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojford%2Frusqlite-model/lists"}