{"id":38502191,"url":"https://github.com/nathaniel-daniel/nd-async-rusqlite-rs","last_synced_at":"2026-01-17T06:01:43.726Z","repository":{"id":148563436,"uuid":"620594634","full_name":"nathaniel-daniel/nd-async-rusqlite-rs","owner":"nathaniel-daniel","description":"Utilities for accessing an sqlite database via rusqlite in an async runtime.","archived":false,"fork":false,"pushed_at":"2026-01-12T07:29:05.000Z","size":1660,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-12T17:36:19.335Z","etag":null,"topics":["async","rust","sqlite"],"latest_commit_sha":null,"homepage":"https://nathaniel-daniel.github.io/nd-async-rusqlite-rs/nd_async_rusqlite/","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/nathaniel-daniel.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-29T01:52:03.000Z","updated_at":"2026-01-12T07:28:35.000Z","dependencies_parsed_at":"2023-05-20T13:30:39.574Z","dependency_job_id":"1363a829-9d34-41cc-b7fa-e913c71b417f","html_url":"https://github.com/nathaniel-daniel/nd-async-rusqlite-rs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nathaniel-daniel/nd-async-rusqlite-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathaniel-daniel%2Fnd-async-rusqlite-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathaniel-daniel%2Fnd-async-rusqlite-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathaniel-daniel%2Fnd-async-rusqlite-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathaniel-daniel%2Fnd-async-rusqlite-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nathaniel-daniel","download_url":"https://codeload.github.com/nathaniel-daniel/nd-async-rusqlite-rs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nathaniel-daniel%2Fnd-async-rusqlite-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28501430,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"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":["async","rust","sqlite"],"created_at":"2026-01-17T06:01:43.600Z","updated_at":"2026-01-17T06:01:43.698Z","avatar_url":"https://github.com/nathaniel-daniel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nd-async-rusqlite\nUtilities for accessing an sqlite database via [rusqlite](https://docs.rs/rusqlite/latest/rusqlite/) in an async runtime.\n\nBlocking should not be done in async code.\nHowever, sqlite (and therefore rusqlite) blocks and cannot be used in async code.\nThis library offers a solution by creating a background thread for sqlite calls and communicating with it via channels, allowing rusqlite to be used in async code.\n\n## Examples\n\n### Simple\n```rust\nuse nd_async_rusqlite::AsyncConnection;\nuse rusqlite::named_params;\n\nconst SETUP_SQL: \u0026str = \"\nPRAGMA foreign_keys = ON; \nCREATE TABLE user (\n    id INTEGER PRIMARY KEY, \n    first_name TEXT NOT NULL, \n    last_name TEXT NOT NULL\n) STRICT;\n\";\n\nconst INSERT_USER_SQL: \u0026str = \"\nINSERT INTO user (\n    first_name,\n    last_name\n) VALUES (\n    :first_name,\n    :last_name\n);\n\";\n\nconst GET_USER_BY_FIRST_NAME_SQL: \u0026str = \"\nSELECT\n    id,\n    first_name,\n    last_name\nFROM\n    user\nWHERE\n    first_name = :first_name;\n\";\n\n#[tokio::main(flavor = \"current_thread\")]\nasync fn main() {\n    // Remember, don't use expect in real code.\n    let connection = AsyncConnection::builder()\n        .open(\"database.db\")\n        .await\n        .expect(\"connection should be open\");\n\n    connection\n        .access(|connection| connection.execute_batch(SETUP_SQL))\n        .await\n        .expect(\"failed to access database\")\n        .expect(\"failed to setup sql\");\n\n    connection\n        .access(|connection| {\n            connection.execute(\n                INSERT_USER_SQL,\n                named_params! {\n                    \":first_name\": \"John\",\n                    \":last_name\": \"Doe\",\n                },\n            )\n        })\n        .await\n        .expect(\"failed to access database\")\n        .expect(\"failed to insert row\");\n\n    let (id, first_name, last_name) = connection\n        .access(|connection| {\n            connection.query_one(\n                GET_USER_BY_FIRST_NAME_SQL,\n                named_params! {\n                    \":first_name\": \"John\",\n                },\n                |row| {\n                    let id: i64 = row.get(\"id\")?;\n                    let first_name: String = row.get(\"first_name\")?;\n                    let last_name: String = row.get(\"last_name\")?;\n\n                    Ok((id, first_name, last_name))\n                },\n            )\n        })\n        .await\n        .expect(\"failed to access database\")\n        .expect(\"failed to get row\");\n\n    println!(\"Id: {id}, first_name: {first_name}, last_name: {last_name}\");\n\n    connection\n        .close()\n        .await\n        .expect(\"an error occured while closing\");\n}\n```\n\n### WalPool\n```rust\n#[tokio::main(flavor = \"current_thread\")]\nasync fn main() {\n    use nd_async_rusqlite::WalPool;\n    use rusqlite::named_params;\n\n    const SETUP_SQL: \u0026str = \"\nPRAGMA foreign_keys = ON; \nCREATE TABLE user (\n    id INTEGER PRIMARY KEY, \n    first_name TEXT NOT NULL, \n    last_name TEXT NOT NULL\n) STRICT;\n\";\n\n    const INSERT_USER_SQL: \u0026str = \"\nINSERT INTO user (\n    first_name,\n    last_name\n) VALUES (\n    :first_name,\n    :last_name\n);\n\";\n\n    const GET_USER_BY_FIRST_NAME_SQL: \u0026str = \"\nSELECT\n    id,\n    first_name,\n    last_name\nFROM\n    user\nWHERE\n    first_name = :first_name;\n\";\n\n    // Remember, don't use expect in real code.\n    let pool = WalPool::builder()\n        .readers(4)\n        .writer_setup(|connection| {\n            println!(\"Writer connection starting up!\");\n            connection.execute_batch(SETUP_SQL)?;\n            Ok(())\n        })\n        .reader_setup(|_connection| {\n            println!(\"Reader connection starting up!\");\n            Ok(())\n        })\n        .open(\"database.db\")\n        .await\n        .expect(\"connection should be open\");\n\n    pool.write(|connection| {\n        connection.execute(\n            INSERT_USER_SQL,\n            named_params! {\n                \":first_name\": \"John\",\n                \":last_name\": \"Doe\",\n            },\n        )\n    })\n    .await\n    .expect(\"failed to access database\")\n    .expect(\"failed to insert row\");\n\n    let (id, first_name, last_name) = pool\n        .read(|connection| {\n            connection.query_one(\n                GET_USER_BY_FIRST_NAME_SQL,\n                named_params! {\n                    \":first_name\": \"John\",\n                },\n                |row| {\n                    let id: i64 = row.get(\"id\")?;\n                    let first_name: String = row.get(\"first_name\")?;\n                    let last_name: String = row.get(\"last_name\")?;\n\n                    Ok((id, first_name, last_name))\n                },\n            )\n        })\n        .await\n        .expect(\"failed to access database\")\n        .expect(\"failed to get row\");\n\n    println!(\"Id: {id}, first_name: {first_name}, last_name: {last_name}\");\n\n    pool.close().await.expect(\"an error occured while closing\");\n}\n```\n\n## Features\n| Name      | Description                                                             |\n|-----------|-------------------------------------------------------------------------|\n| backup    | Enable rusqlite's backup feature                                        |\n| bundled   | Enable rusqlite's bundled feature                                       |\n| functions | Enable rusqlite's function feature                                      |\n| time      | Enable rusqlite's time feature                                          |\n| trace     | Enable rusqlite's trace feature                                         |\n| url       | Enable rusqlite's url feature                                           |\n| wal-pool  | Enable the WalPool type, a concurrent connection pool for WAL databases | \n\n## License\nLicensed under either of\n * Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contributing\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathaniel-daniel%2Fnd-async-rusqlite-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathaniel-daniel%2Fnd-async-rusqlite-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathaniel-daniel%2Fnd-async-rusqlite-rs/lists"}