# indexedDB **Repository Path**: orientboy/indexed-db ## Basic Information - **Project Name**: indexedDB - **Description**: indexedDB,动态更新数据 - **Primary Language**: JavaScript - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-08-04 - **Last Updated**: 2023-04-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # indexedDB ## 支持功能 1. 动态创建数据表 2. 最大存储数据量 3. 支持数据过期 4. 支持添加,批量添加,按条件查询,删除,批量删除, 更新,批量更新 5. 支持导出数据 ## demo ```js import indexedDB from '@kui/indexedDB'; const instance = new indexedDB('dbName', { maxAge: 10, // 默认保存10天, maxLength: 1000, // 默认每个数据表保存1000 条数据 tables: { // 表结构 tableName: { keyPath: "$id", // 默认主键 autoIncrement: true, // 自增 indexNames: { // 索引 indexName: true } } } }) instance.add('tableName', data, { multi: false, ...tableConfig }) => Promise instance.query('tableName', { value: any, indexName: string | null, count: number; keyRange: IDBKeyRange, direction: IDBCursorDirection }) => Promise instance.delete('tableName', { value: any, indexName: string | null, count: number; keyRange: IDBKeyRange, direction: IDBCursorDirection }) => Promise instance.update('tableName', { value: any, indexName: string | null, count: number; keyRange: IDBKeyRange, direction: IDBCursorDirection }) => Promise // 导出 instance.export('tableName') ``` ### todo 1. 内置config 表数据