# general-basic-indexdb

> ```javascript import { Schemas, Database, HandleTable } from "general-basic-indexdb" const { handleData,getData } = HandleTable const { formSchema } = Schemas //储存数据 handleData({ tableName: "formParams", propertiesKey: this.$route.path ||

Latest version **1.0.5** (published 2025-10-23) · Commercial License license · 0 weekly downloads

## Install

```sh
npm install general-basic-indexdb
pnpm add general-basic-indexdb
yarn add general-basic-indexdb
bun add general-basic-indexdb
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2025-10-23 |
| First published | 2025-01-26 |
| Weekly downloads | 0 |
| License | Commercial License |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | chendeli419287484@qq.com |
| Maintainers | alan1034 |
| Keywords | frame, Indexed Database, IndexedDB, npm |

## Links

- npm: https://www.npmjs.com/package/general-basic-indexdb
- npm.io page: https://npm.io/package/general-basic-indexdb

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2025-10-23
- 1.0.4 — 2025-03-09
- 1.0.3 — 2025-01-27
- 1.0.2 — 2025-01-27
- 1.0.1 — 2025-01-26

## README

# GeneralBasicIndexDB



## 使用Getting started

```javascript
import { Schemas, Database, HandleTable } from "general-basic-indexdb"
const { handleData,getData } = HandleTable
const { formSchema } = Schemas
//储存数据
handleData({
    tableName: "formParams", 
    propertiesKey: this.$route.path || "defQueryParams", 
    parameter: { ...searchParams }, 
    primaryKey: "123123", 
    mapDB: formSchema
})
// 获取数据
const DBParams = await getData({
    tableName: "formParams",
    propertiesKey: this.$route.path || "defQueryParams",
    primaryKey: "default",
    mapDB: formSchema
},(DBParams)=>{
  if (!DBParams) { return }
})
```

## mapDB参数示例

```
export default {
  primaryKey: "userId",
  DBName: "mapDB-indexeddb-form-schema",
  DBVersion: 1,
  // DBVersion Use a long long for this value (don't use a float) 必须用整数
  // 更改了stores的内容后必须更新DBVersion以刷新数据库数据
  stores: [
    {
      DBStoreName: "formParams",
      properties: {
        queryParams: { createIndex: { unique: false }, default: {} },
      },
    },
  ],
};
```

## params字段信息


| key           | 作用                                             |
| ------------- | ------------------------------------------------ |
| mapDB         | 参考schema文件mapDB参数示例                      |
| tableName     | 表名                                             |
| primaryKey    | 对主键Primary Key的赋值，建议传入userid作为KEY值 |
| propertiesKey | 表内属性Key值                                    |
| parameter     | propertiesKey对应Value入参                       |
| updateData    | 更新的数据，包含主键primaryKey                   |

## HandleTable

```
插入/全量更新前端数据库中的信息
async function handleData(params, callback)
params字段：
tableName 
primaryKey 
parameter 
propertiesKey 
mapDB 

获取数据
async function getData(params, callback)
params字段：
tableName
propertiesKey
primaryKey
mapDB

增量更新数据(用于对象，解构后更新，效率更高)
async function updateData(params, callback)
params字段：
tableName
propertiesKey
parameter
primaryKey
mapDB

删除数据
async function clearData(params, callback)
params字段：
tableName
primaryKey
mapDB
```


## Database

```
获取,初始化DB
getDB = async (params, callback)
params字段：
mapDB
primaryKey

根据id获取数据
getDataByKey = async (params, callback)
mapDB
tableName
primaryKey

根据id修改数据
updateStore = async (params, callback)
mapDB
tableName
updateData

根据id删除数据
deleteStore = async (params, callback)
mapDB
tableName
primaryKey

// 删库！！
deleteDB = async (params, callback) 
mapDB
```

---
_Source: https://npm.io/package/general-basic-indexdb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
