{"id":23609671,"url":"https://github.com/xygengcn/ts-database","last_synced_at":"2025-11-05T22:30:27.928Z","repository":{"id":57702571,"uuid":"497266294","full_name":"xygengcn/ts-database","owner":"xygengcn","description":"这是基于typesciprt的indexedDB的数据库的操作函数","archived":false,"fork":false,"pushed_at":"2023-03-08T15:22:28.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T18:15:53.109Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xygengcn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-28T09:01:53.000Z","updated_at":"2022-05-28T09:03:58.000Z","dependencies_parsed_at":"2022-09-26T21:11:23.525Z","dependency_job_id":null,"html_url":"https://github.com/xygengcn/ts-database","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/xygengcn%2Fts-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xygengcn%2Fts-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xygengcn%2Fts-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xygengcn%2Fts-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xygengcn","download_url":"https://codeload.github.com/xygengcn/ts-database/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239475960,"owners_count":19645041,"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":[],"created_at":"2024-12-27T15:14:04.184Z","updated_at":"2025-11-05T22:30:27.886Z","avatar_url":"https://github.com/xygengcn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 这是基于 typesciprt 的 indexedDB 的数据库的操作函数\n\n本项目基于 typescript 封装了 indexedDB 基本操作函数，并返回 Promise 操作\n\n### 实例\n\n```ts\nimport Database from 'ts-database';\n\n// 创建数据库,并创建一个用户表，设置主键为id\nconst database = new Database({\n    name: 'TS_STORE',\n    version: 1,\n    modules: [{ name: 'users', primary: 'id', columns: [] }]\n});\n\n// 造数据\nconst user = {\n    id: 'user0001',\n    name: 'XY笔记',\n    updatedAt: new Date().getTime()\n};\n\n// 创建用户\nconst createUser = () =\u003e {\n    console.log('创建用户');\n    return database.module('users').then((model) =\u003e {\n        return model.bulkCreate([user]).then((result) =\u003e {\n            console.error('创建成功', result);\n        });\n    });\n};\n\ncreateUser();\n```\n\n### 接口文档\n\n#### 1、批量保存，存在更新\n\n```js\nmoduel.bulkCreate();\n```\n\n#### 2、数据更新\n\n```js\nmoduel.update();\n```\n\n#### 3、批量数据拉取\n\n```js\nmoduel.findAll();\n```\n\n#### 4、根据主键拉取\n\n```js\nmoduel.findByPk();\n```\n\n#### 5、 关键词搜索\n\n```js\nmoduel.findAllLike();\n```\n\n#### 6、 删除\n\n```js\nmoduel.destory();\n```\n\n#### 7、 表长度\n\n```js\nmoduel.count();\n```\n\n#### 8、 清表\n\n```js\nmoduel.clear();\n```\n\n#### 9、 数据库备份\n\n```js\ndatabase.backup();\n```\n\n#### 10、 数据库恢复\n\n```js\ndatabase.recovery();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxygengcn%2Fts-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxygengcn%2Fts-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxygengcn%2Fts-database/lists"}