{"id":16586500,"url":"https://github.com/romgrk/sqlite-objects","last_synced_at":"2026-04-16T04:03:53.141Z","repository":{"id":145088803,"uuid":"301557980","full_name":"romgrk/sqlite-objects","owner":"romgrk","description":"Usable wrappers around SQLite","archived":false,"fork":false,"pushed_at":"2020-12-09T17:05:06.000Z","size":45,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-16T11:57:41.771Z","etag":null,"topics":["database","key-value-store","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/romgrk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2020-10-05T22:48:19.000Z","updated_at":"2020-12-09T17:05:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"91fcae7a-4c2e-4119-8d1e-403afa628f0c","html_url":"https://github.com/romgrk/sqlite-objects","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/romgrk/sqlite-objects","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romgrk%2Fsqlite-objects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romgrk%2Fsqlite-objects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romgrk%2Fsqlite-objects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romgrk%2Fsqlite-objects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romgrk","download_url":"https://codeload.github.com/romgrk/sqlite-objects/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romgrk%2Fsqlite-objects/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["database","key-value-store","sqlite","sqlite3"],"created_at":"2024-10-11T22:51:44.382Z","updated_at":"2026-04-16T04:03:53.102Z","avatar_url":"https://github.com/romgrk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# sqlite-objects\n\nThis package contains **usable** SQLite wrappers.\n\nWhat does it mean:\n - Promise-based\n - Sane placeholders: `db.findOne('SELECT * FROM items WHERE id = @id', { id: 1 })`\n - Setup with `new Database(dbPath)` and that's it\n\n#### Objects\n - [Database](#database)\n - [Key-value Store](#key-value-store)\n\n## Database\n\nThis is a wrapper around a SQLite database.\n\n```javascript\nconst Database = require('sqlite-objects').Database\n\n;(async () =\u003e {\n\n  const db = new Database(\n    __dirname + '/database.db'\n    // , schemaPath /* optional */\n  )\n\n  // await db.ready /* if schemaPath is provided */\n\n  await db.run(`CREATE TABLE IF NOT EXISTS items (\n      id    integer  primary key,\n      value text     not null\n  )`)\n\n  await db.insert(\n    `INSERT OR REPLACE INTO items VALUES (@id, @value)`,\n    { id: 42, value: 'some value' }\n  )\n\n  await db.insertMany(\n    `INSERT OR REPLACE INTO items VALUES (@id, @value)`, [\n      { id: 43, value: 'fourty-three' },\n      { id: 44, value: 'fourty-four' },\n    ]\n  )\n\n  // Variable placeholders use the @name syntax\n  const row = await db.findOne(`SELECT * FROM items WHERE id = @id`, { id: 42 })\n  // row === { id: 42, value: 'some value' }\n\n  const rows = await db.findAll(`SELECT * FROM items`)\n  // rows === [{ id: 42, value: 'some value' }]\n\n  console.log({ row, rows })\n})()\n```\n\n## Key-value Store\n\n```javascript\nconst KeyValueStore = require('sqlite-objects').KeyValueStore\n\n;(async () =\u003e {\n\n  const store = new KeyValueStore(__dirname + '/key-value-store.db')\n\n  await store.ready\n\n  await store.set(42, { value: 'some value' })\n  await store.set(43, { value: 'other value' })\n  await store.set(44, { value: 'final value' })\n\n  const item = await store.get(42)\n\n  const updateItem = await store.update(42, { content: 'other content' })\n\n  const items = await store.values()\n\n  await store.delete(43)\n\n  const updatedItemsKeys = await store.keys()\n\n  for (let [key, value] of await store.entries()) {\n    console.log(key, value)\n  }\n\n  console.log({\n    item,\n    updateItem,\n    items,\n    updatedItemsKeys,\n  })\n})()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromgrk%2Fsqlite-objects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromgrk%2Fsqlite-objects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromgrk%2Fsqlite-objects/lists"}