Skip to content

Commit e2304bf

Browse files
committed
[docs] Document changes in Kysely plugin
1 parent 0f549fb commit e2304bf

2 files changed

Lines changed: 201 additions & 0 deletions

File tree

docs/content/docs/plugins/kysely.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ plugins:
1919
# 可选的数据库连接选项,除了 open 选项之外的其他选项都会被传递给 DatabaseSync 的构造函数
2020
# 详见 Node.js 官方文档:https://nodejs.org/api/sqlite.html#new-databasesyncpath-options
2121
# nodeSqliteOptions:
22+
# 自动清理数据库(运行 VACUUM 命令)的相关配置
23+
autoVacuum:
24+
# 是否启用自动清理功能,默认为 true
25+
# 若为 false,则不会自动清理数据库
26+
enabled: true
27+
# 自动清理的时间间隔,单位为分钟,默认为 60
28+
intervalMinutes: 60
2229
```
2330
2431
如果你是插件开发者,请将本插件添加到项目的 `peerDependencies` 中,并在自己的插件中声明依赖:
@@ -240,6 +247,8 @@ ctx.kysely.schemas.register({
240247

241248
完成表结构声明和迁移注册之后,`KyselyService` 会在应用启动时自动完成迁移工作,随后就可以通过 `ctx.kysely.db` 来访问 Kysely 实例,并使用它来执行各种数据库操作了。下面介绍一些基本的 CRUD 操作,你可以查看 Kysely 文档的 [Examples](https://kysely.dev/docs/category/examples) 章节来了解更多用法。
242249

250+
启用自动 vacuum 后,插件会在迁移完成后立即整理一次数据库文件,并按配置的时间间隔重复执行。默认情况下该功能处于启用状态;如果不希望插件自动执行,可以设置 `autoVacuum.enabled``false`。也可以在需要时直接调用 `KyselyService``vacuum()` 方法。
251+
243252
{/* prettier-ignore */}
244253
<Callout>
245254
如果你的插件在数据库中定义了新的结构,同时又希望外界能够对这些数据进行查询或修改,不要直接暴露这些表,而应把这些操作封装成一个新的 `Service`,在其中使用 `ctx.kysely.db` 来访问数据库,并且使用 `provides` 属性和 `ctx.provide` 来提供这个服务。

plugins.json

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"chatsalt": {
3+
"name": "fraq-plugin-chatsalt",
4+
"version": "0.1.1",
5+
"description": "通用 AI 对话插件",
6+
"category": "ai",
7+
"repository": "https://github.com/fraqjs/plugin-chatsalt",
8+
"market": {
9+
"unlisted": false
10+
}
11+
},
12+
"drift-bottle": {
13+
"name": "fraq-plugin-drift-bottle",
14+
"version": "0.2.3",
15+
"description": "Fraq 漂流瓶插件",
16+
"category": null,
17+
"repository": "https://github.com/zhongwen-4-fraq-plugins/fraq-plugin-drift-bottle",
18+
"market": {
19+
"unlisted": true
20+
}
21+
},
22+
"face-reaction": {
23+
"name": "fraq-plugin-face-reaction",
24+
"version": "0.1.1",
25+
"description": "让机器人回应(贴)任何表情",
26+
"category": "utilities",
27+
"repository": "https://github.com/fraqjs/plugin-face-reaction",
28+
"market": {
29+
"unlisted": false
30+
}
31+
},
32+
"fraqjs/ai": {
33+
"name": "@fraqjs/plugin-ai",
34+
"version": "0.5.1",
35+
"description": "提供配置 AI 模型提供商和 API Key 的统一入口",
36+
"category": "infrastructure",
37+
"repository": "https://github.com/fraqjs/fraq",
38+
"market": {
39+
"unlisted": false
40+
}
41+
},
42+
"fraqjs/conversation": {
43+
"name": "@fraqjs/plugin-conversation",
44+
"version": "0.7.1",
45+
"description": "提供对多轮对话的支持,帮助开发者编写交互式机器人功能",
46+
"category": "infrastructure",
47+
"repository": "https://github.com/fraqjs/fraq",
48+
"market": {
49+
"unlisted": false
50+
}
51+
},
52+
"fraqjs/hono": {
53+
"name": "@fraqjs/plugin-hono",
54+
"version": "0.2.1",
55+
"description": "提供基于 Hono 的 HTTP 服务器集成",
56+
"category": "infrastructure",
57+
"repository": "https://github.com/fraqjs/fraq",
58+
"market": {
59+
"unlisted": false
60+
}
61+
},
62+
"fraqjs/kysely": {
63+
"name": "@fraqjs/plugin-kysely",
64+
"version": "0.2.2",
65+
"description": "提供基于 Kysely 的 SQLite 数据库服务",
66+
"category": "infrastructure",
67+
"repository": "https://github.com/fraqjs/fraq",
68+
"market": {
69+
"unlisted": false
70+
}
71+
},
72+
"fraqjs/message-store": {
73+
"name": "@fraqjs/plugin-message-store",
74+
"version": "0.3.1",
75+
"description": "提供将消息存储在本地数据库的能力",
76+
"category": "infrastructure",
77+
"repository": "https://github.com/fraqjs/fraq",
78+
"market": {
79+
"unlisted": false
80+
}
81+
},
82+
"fraqjs/milky-server": {
83+
"name": "@fraqjs/plugin-milky-server",
84+
"version": "0.1.1",
85+
"description": "提供在 Fraq 上代理上游 Milky 服务的能力",
86+
"category": "infrastructure",
87+
"repository": "https://github.com/fraqjs/fraq",
88+
"market": {
89+
"unlisted": false
90+
}
91+
},
92+
"fraqjs/milky-webhook": {
93+
"name": "@fraqjs/plugin-milky-webhook",
94+
"version": "0.1.1",
95+
"description": "提供将 Fraq 接入 Milky 协议端 Webhook 事件推送的能力",
96+
"category": "infrastructure",
97+
"repository": "https://github.com/fraqjs/fraq",
98+
"market": {
99+
"unlisted": false
100+
}
101+
},
102+
"fraqjs/random": {
103+
"name": "@fraqjs/plugin-random",
104+
"version": "0.1.3",
105+
"description": "提供基于 PCG32 算法的伪随机数生成器及其封装",
106+
"category": "infrastructure",
107+
"repository": "https://github.com/fraqjs/fraq",
108+
"market": {
109+
"unlisted": false
110+
}
111+
},
112+
"fraqjs/takumi": {
113+
"name": "@fraqjs/plugin-takumi",
114+
"version": "0.4.1",
115+
"description": "提供基于 Takumi 的图片渲染服务",
116+
"category": "infrastructure",
117+
"repository": "https://github.com/fraqjs/fraq",
118+
"market": {
119+
"unlisted": false
120+
}
121+
},
122+
"github": {
123+
"name": "fraq-plugin-github",
124+
"version": "0.1.0",
125+
"description": "Forward GitHub App events to QQ groups with Fraq",
126+
"category": null,
127+
"repository": "https://github.com/zhongwen-4-fraq-plugins/fraq-plugin-github",
128+
"market": {
129+
"unlisted": true
130+
}
131+
},
132+
"group-admin": {
133+
"name": "fraq-plugin-group-admin",
134+
"version": "0.8.2",
135+
"description": "Fraq group administration plugin for Milky bots.",
136+
"category": null,
137+
"repository": "https://github.com/zhongwen-4-fraq-plugins/fraq-plugin-group-admin",
138+
"market": {
139+
"unlisted": true
140+
}
141+
},
142+
"onebot-server": {
143+
"name": "fraq-plugin-onebot-server",
144+
"version": "0.1.1",
145+
"description": "OneBot 11 server plugin for Fraq",
146+
"category": null,
147+
"repository": "https://github.com/greepar/fraq-plugin-onebot-server",
148+
"market": {
149+
"unlisted": true
150+
}
151+
},
152+
"ostracism": {
153+
"name": "fraq-plugin-ostracism",
154+
"version": "0.2.1",
155+
"description": "陶片放逐(禁言)你的群友",
156+
"category": "entertainment",
157+
"repository": "https://github.com/fraqjs/plugin-ostracism",
158+
"market": {
159+
"unlisted": false
160+
}
161+
},
162+
"retrieve": {
163+
"name": "fraq-plugin-retrieve",
164+
"version": "0.1.2",
165+
"description": "获取消息的 Milky 消息段形式",
166+
"category": "development",
167+
"repository": "https://github.com/fraqjs/plugin-retrieve",
168+
"market": {
169+
"unlisted": false
170+
}
171+
},
172+
"status": {
173+
"name": "fraq-plugin-status",
174+
"version": "0.1.3",
175+
"description": "查询 Fraq 的运行状态",
176+
"category": "development",
177+
"repository": "https://github.com/fraqjs/plugin-status",
178+
"market": {
179+
"unlisted": false
180+
}
181+
},
182+
"title-grant": {
183+
"name": "fraq-plugin-title-grant",
184+
"version": "0.1.1",
185+
"description": "让群友自助获取群专属头衔",
186+
"category": "management",
187+
"repository": "https://github.com/fraqjs/plugin-title-grant",
188+
"market": {
189+
"unlisted": false
190+
}
191+
}
192+
}

0 commit comments

Comments
 (0)