{"id":18626385,"url":"https://github.com/comonadd/idb-query","last_synced_at":"2025-10-18T06:01:20.785Z","repository":{"id":57271108,"uuid":"408814866","full_name":"comonadd/idb-query","owner":"comonadd","description":"IDB querying library","archived":false,"fork":false,"pushed_at":"2021-09-30T14:14:58.000Z","size":154,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T18:15:30.471Z","etag":null,"topics":["database","idb","javascript","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/comonadd.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}},"created_at":"2021-09-21T12:39:52.000Z","updated_at":"2023-01-09T20:24:57.000Z","dependencies_parsed_at":"2022-09-06T14:50:26.508Z","dependency_job_id":null,"html_url":"https://github.com/comonadd/idb-query","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comonadd%2Fidb-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comonadd%2Fidb-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comonadd%2Fidb-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/comonadd%2Fidb-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/comonadd","download_url":"https://codeload.github.com/comonadd/idb-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239419204,"owners_count":19635350,"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","idb","javascript","typescript"],"created_at":"2024-11-07T04:37:51.956Z","updated_at":"2025-10-18T06:01:15.637Z","avatar_url":"https://github.com/comonadd.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple TypeScript IDB wrapper\n\n## Examples:\n\n### Create an Article entity\n\n```typescript\nimport { createIDBEntity } from \"idb-orm\";\n// create your own database\nconst db = createDb();\n\ninterface IArticle {\n  author: string;\n  string: string;\n  text: string;\n  tags: string[];\n}\nconst Student = createIDBEntity\u003cIStudent, \"id\"\u003e(\n  db, // need to provide database handle\n  \"students\", // store name\n  \"id\" // keyPath\n);\n```\n\n### New entity\n\n```typescript\nStudent.create({\n    author: \"John Smith\";\n    title: \"Ut aliquet facilisis turpis\",\n    text: ` Amet bibendum euismod, leo diam interdum ligula, eu scelerisque sem\n              purus in tellus.\n\n    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In sit amet nunc id\n    quam porta varius. Ut aliquet facilisis turpis. Etiam pellentesque quam et\n    erat. Praesent suscipit justo.\n    `;\n    created: new Date(),\n    tags: [\"stuff\", \"life\", \"cats\"],\n})\n```\n\n### Queries\n\n```typescript\n// Get all articles that\nStudent.query()\n  .byIndex(\"created\")\n  // had been posted in the range from 1st september of 2013\n  .from(new Date(\"2013-09-01\"))\n  // to 1st september of 2014\n  .to(new Date(\"2014-09-01\"))\n  // that were about cars\n  .filter((art) =\u003e art.tags.find(\"cars\"))\n  // then group by month\n  .groupBy(\n    (art) =\u003e\n      new Date(\n        art.created.getFullYear(), //\n        art.created.getMonth()\n      )\n  )\n  // take only the first 10 months\n  .take(10)\n  .all();\n```\n\nMore usage examples can be found in the [tests](./test) directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomonadd%2Fidb-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomonadd%2Fidb-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomonadd%2Fidb-query/lists"}