@hbtv/file-storage
v1.1.0
Published
ant design pro mock 辅助存储工具
Downloads
1
Keywords
Readme
@hbtv/file-storage
主要解决在 umijs
mock 辅助存储的问题
安装
npm install @hbtv/file-storage
ChangeLog
1.1.0
- 使用打包工具进行重构
使用
import FileStorage from '@hbtv/file-storage';
const fileName = 'users.json';
const fileStorage = new FileStorage(fileName);
// setItem
fileStorage.setItem([
{ id: 1, userName: 'Donald' },
{ id: 2, userName: 'Paul' },
{ id: 3, userName: 'Mark' },
]);
// getItem
fileStorage.getItem();
// create
fileStorage.create({ userName:"John"});
// update
fileStorage.where({id:1}).update({ userName:"Jane"});
// find
fileStorage.where({userName:'Paul'}).find();
// search
fileStorage.search();
// destroy
fileStorage.where({id:1}).destroy();
// orderBy
fileStorage.orderBy('id','desc').search();
// paginate
fileStorage.orderBy('id','desc').paginate();