Commit bf06704b authored by timel's avatar timel

feat: searchCard method

parent 4d239811
Pipeline #22963 failed with stages
in 12 minutes and 29 seconds
......@@ -55,8 +55,33 @@ export async function fetchCard(id: number): Promise<CardMeta> {
return res.selectResult ? res.selectResult : { id, data: {}, text: {} };
}
/*
* 返回卡片元数据
*
* @param id - 卡片id
* @returns 卡片数据
*
* */
export async function searchCard(
query: string,
type?: number
): Promise<CardMeta[]> {
// TODO: 让type支持多种filter类型
console.log({
cmd: sqliteCmd.FTS,
payload: { query, type },
});
const res = await sqliteMiddleWare({
cmd: sqliteCmd.FTS,
payload: { query, type },
});
return res.ftsResult ?? [];
}
// @ts-ignore
window.fetchCard = fetchCard;
// @ts-ignore
window.searchCard = searchCard;
export function getCardStr(meta: CardMeta, idx: number): string | undefined {
switch (idx) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment