1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

release 0.3.4

This commit is contained in:
songjunxi
2023-11-10 14:59:47 +08:00
parent 2b456637e9
commit 602f2059fd
161 changed files with 9921 additions and 347 deletions

View File

@@ -0,0 +1,26 @@
import { Note_Storage_Key } from "@/lib/consts";
import { ContentItem } from "@/lib/types/note";
import Dexie, { Table } from "dexie";
const db = new Dexie("database");
db.version(1).stores({
note_storage_data:
"id, title, content, tag, created_at, updated_at, collapsed",
});
export const noteTable = db.table(Note_Storage_Key);
export default db;
export const addNote = async (item: ContentItem) => {
await noteTable.add(item);
};
export const updateNote = async (item: ContentItem) => {
await noteTable.put(item);
};
export const deleteNote = async (id: string) => {
await noteTable.delete(id);
};
export const patchNote = async (data: ContentItem[]) => {
await noteTable.bulkAdd(data);
};