refactor(ext): prefer link-index get in web and ai modules

Migrate footnote-style collection access to [key](base) (including nested
chains) in ext/web and ext/ai EN/ZH sources.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-09-14 11:55:09 +08:00
1 parent fecaacd5be
commit 5c37d54070
5 files changed
+122 -121

No files matched your search

+2 -1
View File
@@ -25,7 +25,7 @@
| **M0 View** | `InterpPart::Index` → `[k](base)`;`call_display` 修饰表面 | **done** |
| **M1** | 试点 `lib/table` · `lib/text` · `lib/json`(中英)+ public/stdlib | **done** |
| **M2** | 其余 `lib/*` 叙述化;禁新脚注取元 | **done** |
| **M3–M4** | `ext/web`、`ext/ai`:脚注→链接取元;叙述;示例可逐步换括号调用 | pending |
| **M3–M4** | `ext/web`、`ext/ai`:脚注→链接取元;叙述;示例可逐步换括号调用 | **done**(取元迁移) |
| **M5** | quantum / linalg + full gold | pending |
## 2. 验收(出门)
@@ -41,3 +41,4 @@
| 2026-09-14 | 初稿;Call + M0 标 done |
| 2026-09-14 | M1 试点 table/text/json + public/stdlib 标 done |
| 2026-09-14 | M2 其余 lib 叙述化标 done |
| 2026-09-14 | M3–M4 ext/web+ai 脚注→链接取元 |
+14 -14
View File
@@ -22,11 +22,11 @@ Reduce a `complete stream=True` event list to the final `done.result` text (or `
**answer = ""**
- [ev](events)
**t = ev[^type]**
**t = [type](ev)**
1. `t` == "done"
**answer = ev[^result]**
**answer = [result](ev)**
2. `t` == "error"
**answer = ev[^message]**
**answer = [message](ev)**
3. `t` == "delta"
4. *
**_ = 1**
@@ -74,8 +74,8 @@ Chat completion using `self` handle fields.
Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@` row table; headers and optional `stream` use `table.put`. `json` is only for stringify/parse.
**url = self[^base_url] + self[^suffix]**
**auth = self[^bearer] + self[^api_key]**
**url = [base_url](self) + [suffix](self)**
**auth = [bearer](self) + [api_key](self)**
**headers = > table.put in=None at="Authorization" value=`auth`**
`messages` =
@@ -88,28 +88,28 @@ Wire body is `{model, messages:[{role,content}], stream?}`. Messages are an `@`
| model | messages |
|-------|----------|
| self[^model] | `messages` |
| [model](self) | `messages` |
1. `stream`
**req = > table.put in=`req` at="stream" value=True**
**body = > json.stringify value=`req`**
**resp = > net.http_post_sse url=`url` body=`body` headers=`headers` echo=`echo`**
1. resp[^status] == 200
*resp[^events]*
1. [status](resp) == 200
*[events](resp)*
2. *
> print text=ext/ai/llm: HTTP error (stream)
> print text=resp[^status]
> print text=[status](resp)
> sys.exit code=1
2. *
**body = > json.stringify value=`req`**
**resp = > net.http_post url=`url` body=`body` headers=`headers`**
1. resp[^status] == 200
**data = > json.parse text=resp[^body]**
*data[^choices][^1][^message][^content]*
1. [status](resp) == 200
**data = > json.parse text=[body](resp)**
*[content]([message]([1]([choices](data))))*
2. *
> print text=ext/ai/llm: HTTP error
> print text=resp[^status]
> print text=resp[^body]
> print text=[status](resp)
> print text=[body](resp)
> sys.exit code=1
---
+14 -14
View File
@@ -22,11 +22,11 @@ import json:lib/json.mq.md
**answer = ""**
- [ev](事件)
**t = ev[^type]**
**t = [type](ev)**
1. `t` == "done"
**answer = ev[^result]**
**answer = [result](ev)**
2. `t` == "error"
**answer = ev[^message]**
**answer = [message](ev)**
3. `t` == "delta"
4. *
**_ = 1**
@@ -74,8 +74,8 @@ import json:lib/json.mq.md
线上 body 为 `{model, messages:[{role,content}], stream?}`。消息用 `@` 行向表;headers 与可选 `stream` 用 `表.改`。`json` 只做 stringify/parse。
**url = 自[^base_url] + 自[^suffix]**
**auth = 自[^bearer] + 自[^api_key]**
**url = [base_url](自) + [suffix](自)**
**auth = [bearer](自) + [api_key](自)**
**headers = > 表.改 入=None 于="Authorization" 值=`auth`**
`messages` =
@@ -88,28 +88,28 @@ import json:lib/json.mq.md
| model | messages |
|-------|----------|
| 自[^model] | `messages` |
| [model](自) | `messages` |
1. `流式`
**req = > 表.改 入=`req` 于="stream" 值=True**
**body = > json.stringify value=`req`**
**resp = > 网络.提交流式 地址=`url` 内容=`body` headers=`headers` 打印增量=`打印增量`**
1. resp[^status] == 200
*resp[^events]*
1. [status](resp) == 200
*[events](resp)*
2. *
> 打印 内容=ext/ai/大模型: HTTP 错误(流式)
> 打印 内容=resp[^status]
> 打印 内容=[status](resp)
> 系统.退出 码=1
2. *
**body = > json.stringify value=`req`**
**resp = > 网络.提交 地址=`url` 内容=`body` headers=`headers`**
1. resp[^status] == 200
**data = > json.parse text=resp[^body]**
*data[^choices][^1][^message][^content]*
1. [status](resp) == 200
**data = > json.parse text=[body](resp)**
*[content]([message]([1]([choices](data))))*
2. *
> 打印 内容=ext/ai/大模型: HTTP 错误
> 打印 内容=resp[^status]
> 打印 内容=resp[^body]
> 打印 内容=[status](resp)
> 打印 内容=[body](resp)
> 系统.退出 码=1
---
+46 -46
View File
@@ -324,7 +324,7 @@ Embed a form into the page main slot. Optional `target` / `form_slot` (CSS id, e
Offline HTML for tests / previews.
1. `db`
**url = db[^url]**
**url = [url](db)**
*> web_render page=`self` url=`url`*
2. *
*> web_render page=`self`*
@@ -357,7 +357,7 @@ Open a database handle. URL schemes: `sqlite:path` (default), `postgres://…` /
Create a table from a schema table. Optional columns: `唯一`/`unique`, `索引`/`index` (creates UNIQUE / INDEX), `外键`/`fk`/`references` (e.g. `posts.id` or `posts(id)`). Columns named `created_at` / `updated_at` are filled automatically on insert/update when present.
**url = self[^url]**
**url = [url](self)**
*> web_db_init url=`url` name=`name` fields=`fields`*
## insert
@@ -365,7 +365,7 @@ Create a table from a schema table. Optional columns: `唯一`/`unique`, `索引
+ `rows`
+ `txn`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_insert url=`url` table=`table` rows=`rows` txn=`txn`*
## select
@@ -377,9 +377,9 @@ Create a table from a schema table. Optional columns: `唯一`/`unique`, `索引
Simple filters: one-row map of column→value (AND `=`), or rows `|字段|操作|值|` (`=` `!=` `>` `>=` `<` `<=` `like` `in` `between` `is null`; add `|或|` = `是` to join a row with `OR`). `order` is a column name with optional `-` prefix for descending (`"created_at"`, `"-created_at"`), comma-separated for multiple keys. Pass `txn` to read inside an open transaction. For pages (with a total), use `paginate`.
**url = self[^url]**
**url = [url](self)**
**r = > web_db_select url=`url` table=`table` where=`where` limit=`limit` order=`order` offset=None txn=`txn`**
*r[^rows]*
*[rows](r)*
## paginate
+ `table`
@@ -391,7 +391,7 @@ Simple filters: one-row map of column→value (AND `=`), or rows `|字段|操作
Like `select` but returns `{ rows, total }` — the total counts rows matching `where` regardless of `limit`/`跳过`, so you can render `上一页 / 下一页`. Set `跳过` to the number of rows to skip (e.g. page 2 with 10 per page ⇒ `跳过`=10).
**url = self[^url]**
**url = [url](self)**
*> web_db_select url=`url` table=`table` where=`where` limit=`limit` order=`order` offset=`跳过` txn=`txn`*
## get
@@ -399,7 +399,7 @@ Like `select` but returns `{ rows, total }` — the total counts rows matching `
+ `id`
+ `txn`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_get url=`url` table=`table` id=`id` txn=`txn`*
## update
@@ -408,7 +408,7 @@ Like `select` but returns `{ rows, total }` — the total counts rows matching `
+ `row`
+ `txn`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_update url=`url` table=`table` id=`id` row=`row` txn=`txn`*
## delete
@@ -416,7 +416,7 @@ Like `select` but returns `{ rows, total }` — the total counts rows matching `
+ `id`
+ `txn`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_delete url=`url` table=`table` id=`id` txn=`txn`*
## exec
@@ -424,7 +424,7 @@ Like `select` but returns `{ rows, total }` — the total counts rows matching `
+ `args`=None
+ `txn`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_exec url=`url` sql=`sql` args=`args` txn=`txn`*
## query
@@ -434,7 +434,7 @@ Like `select` but returns `{ rows, total }` — the total counts rows matching `
Run bare SQL and return the result set — count / join / group / subqueries. Returns `{ rows, count }`.
**url = self[^url]**
**url = [url](self)**
*> web_db_query url=`url` sql=`sql` args=`args` txn=`txn`*
## count
@@ -444,16 +444,16 @@ Run bare SQL and return the result set — count / join / group / subqueries. Re
Count rows matching a `where` filter (same syntax as `select`). Returns a number.
**url = self[^url]**
**url = [url](self)**
**r = > web_db_count url=`url` table=`table` where=`where` txn=`txn`**
*r[^count]*
*[count](r)*
## migrate
+ `steps`
Apply versioned SQL migrations. `steps` is a `|version|sql|` / `|版本|SQL|` table. Applied versions are recorded in `_marqdo_migrations`. Re-running is a no-op for already-applied versions. SQLite only.
**url = self[^url]**
**url = [url](self)**
*> web_db_migrate url=`url` steps=`steps`*
## fts
@@ -463,7 +463,7 @@ Apply versioned SQL migrations. `steps` is a `|version|sql|` / `|版本|SQL|` ta
Create an FTS5 index on `table` for the listed content columns (CSV string or list). Default FTS name is `{table}_fts`. Keeps the index in sync via triggers. Requires integer `id` PK. SQLite only.
**url = self[^url]**
**url = [url](self)**
*> web_db_fts_create url=`url` table=`table` columns=`columns` name=`name`*
## search
@@ -474,7 +474,7 @@ Create an FTS5 index on `table` for the listed content columns (CSV string or li
Full-text search (`MATCH`) against the FTS5 index from `fts`. Returns `{ rows, count }` with a `rank` column (bm25). SQLite only.
**url = self[^url]**
**url = [url](self)**
*> web_db_search url=`url` table=`table` q=`q` limit=`limit` name=`name`*
## 事务
@@ -483,7 +483,7 @@ Begin a transaction: borrows the pooled connection exclusively and returns a
`txn` handle. Write inside it, then `提交` (commit) or `回滚` (roll back).
Every statement runs on the same connection, so a batch is atomic.
**url = self[^url]**
**url = [url](self)**
*> web_db_begin url=`url`*
# txn
@@ -499,8 +499,8 @@ connection; finish with `提交` or `回滚`.
+ `table`
+ `rows`
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
*> web_db_insert url=`url` table=`table` rows=`rows` txn=`txn`*
## select
@@ -511,17 +511,17 @@ connection; finish with `提交` or `回滚`.
Same filters as `db.select`; runs inside the transaction.
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
**r = > web_db_select url=`url` table=`table` where=`where` limit=`limit` order=`order` offset=None txn=`txn`**
*r[^rows]*
*[rows](r)*
## get
+ `table`
+ `id`
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
*> web_db_get url=`url` table=`table` id=`id` txn=`txn`*
## update
@@ -529,38 +529,38 @@ Same filters as `db.select`; runs inside the transaction.
+ `id`
+ `row`
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
*> web_db_update url=`url` table=`table` id=`id` row=`row` txn=`txn`*
## delete
+ `table`
+ `id`
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
*> web_db_delete url=`url` table=`table` id=`id` txn=`txn`*
## exec
+ `sql`
+ `args`=None
**url = self[^url]**
**txn = self[^txn]**
**url = [url](self)**
**txn = [txn](self)**
*> web_db_exec url=`url` sql=`sql` args=`args` txn=`txn`*
## 提交
Commit the transaction and return its connection to the pool.
**txn = self[^txn]**
**txn = [txn](self)**
*> web_db_commit txn=`txn`*
## 回滚
Roll the transaction back (undo every write) and return its connection.
**txn = self[^txn]**
**txn = [txn](self)**
*> web_db_rollback txn=`txn`*
# form
@@ -600,7 +600,7 @@ Field table + rules table; submit writes through `# db`.
+ `data`
+ `db`
**url = db[^url]**
**url = [url](db)**
*> web_form_submit form=`self` data=`data` url=`url`*
# app
@@ -831,8 +831,8 @@ Session/auth helper. Constructs a config object; `login` validates against the u
Validate credentials against the users table and create a session. Returns `{ok, session_id, username, role}`.
**users = self[^users]**
**ttl = self[^session_ttl]**
**users = [users](self)**
**ttl = [session_ttl](self)**
*> web_auth_login username=`username` password=`password` users=`users` session_ttl=`ttl`*
## check
@@ -867,7 +867,7 @@ Key–value cache. Use `memory:` for in-process (tests / single process) or `red
## get
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_cache_get url=`url` key=`key`*
## set
@@ -877,25 +877,25 @@ Key–value cache. Use `memory:` for in-process (tests / single process) or `red
Optional `ttl` is seconds until expiry.
**url = self[^url]**
**url = [url](self)**
*> web_cache_set url=`url` key=`key` value=`value` ttl=`ttl`*
## del
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_cache_del url=`url` key=`key`*
## exists
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_cache_exists url=`url` key=`key`*
## ttl
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_cache_ttl url=`url` key=`key`*
# storage
@@ -914,25 +914,25 @@ Object storage. `file:dir` stores blobs on disk (offline / gold). `s3://bucket?e
Provide either `body` (text) or `path` (local file to upload).
**url = self[^url]**
**url = [url](self)**
*> web_storage_put url=`url` key=`key` body=`body` path=`path` content_type=`content_type`*
## get
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_storage_get url=`url` key=`key`*
## delete
+ `key`
**url = self[^url]**
**url = [url](self)**
*> web_storage_delete url=`url` key=`key`*
## list
+ `prefix`=""
**url = self[^url]**
**url = [url](self)**
*> web_storage_list url=`url` prefix=`prefix`*
# media
@@ -961,7 +961,7 @@ Offline helpers for upload validation and saving into `# storage` (also used by
**st = storage**
1. `st` == None
**st = self[^storage]**
**st = [storage](self)**
2. *
*> web_upload_save storage=`st` path=`path` key=`key` content_type=`content_type` prefix=`prefix`*
@@ -987,5 +987,5 @@ WebSocket client helper.
Single request–response: connect to `url`, send `message`, collect all server text replies, close. Returns `{ok, messages}`.
**timeout = self[^timeout_sec]**
**timeout = [timeout_sec](self)**
*> web_ws_connect url=`url` message=`message` headers=`headers` timeout_sec=`timeout`*
+46 -46
View File
@@ -304,7 +304,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `数据库`=None
1. `数据库`
**url = 数据库[^url]**
**url = [url](数据库)**
*> web_render page=`self` url=`url`*
2. *
*> web_render page=`self`*
@@ -335,7 +335,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
从表结构创建表。可选列:`唯一`/`unique`、`索引`/`index`、`外键`/`fk`/`references`(如 `posts.id`)。若存在 `created_at` / `updated_at` 列,插入/更新时自动写入。
**url = self[^url]**
**url = [url](self)**
*> web_db_init url=`url` name=`名` fields=`字段`*
## 插入
@@ -343,7 +343,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `行`
+ `事务`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_insert url=`url` table=`表` rows=`行` txn=`事务`*
## 查询
@@ -355,9 +355,9 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
简单条件:单行列→值映射(AND `=`),或 `|字段|操作|值|` 表(`=` `!=` `>` `>=` `<` `<=` `like` `in` `between` `is null`;加 `|或|` 为 `是` 可让该行与前一行用 `OR` 连接)。`排序` 是列名,`-` 前缀表示倒序(`"created_at"`、`"-created_at"`),可逗号分隔多列。传入 `事务` 可在已开启的事务内读取。要分页(带总数)用 `分页`。
**url = self[^url]**
**url = [url](self)**
**r = > web_db_select url=`url` table=`表` where=`条件` limit=`上限` order=`排序` offset=None txn=`事务`**
*r[^rows]*
*[rows](r)*
## 分页
+ `表`
@@ -369,7 +369,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
同 `查询`,但返回 `{ rows, total }`——`total` 是满足 `条件` 的行数(不受 `上限`/`跳过` 影响),供渲染 `上一页 / 下一页`。`跳过` 为要跳过的行数(如每页 10 条的第 2 页 ⇒ `跳过`=10)。
**url = self[^url]**
**url = [url](self)**
*> web_db_select url=`url` table=`表` where=`条件` limit=`上限` order=`排序` offset=`跳过` txn=`事务`*
## 获取
@@ -377,7 +377,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `id`
+ `事务`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_get url=`url` table=`表` id=`id` txn=`事务`*
## 更新
@@ -386,7 +386,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `行`
+ `事务`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_update url=`url` table=`表` id=`id` row=`行` txn=`事务`*
## 删除
@@ -394,7 +394,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `id`
+ `事务`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_delete url=`url` table=`表` id=`id` txn=`事务`*
## 执行
@@ -402,7 +402,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `参数`=None
+ `事务`=None
**url = self[^url]**
**url = [url](self)**
*> web_db_exec url=`url` sql=`sql` args=`参数` txn=`事务`*
## 原生查询
@@ -412,7 +412,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
执行裸 SQL 并返回结果集——count / join / group / 子查询都行。返回 `{ rows, count }`。
**url = self[^url]**
**url = [url](self)**
*> web_db_query url=`url` sql=`sql` args=`参数` txn=`事务`*
## 计数
@@ -422,16 +422,16 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
统计满足 `条件` 的行数(语法同 `查询`)。返回数字。
**url = self[^url]**
**url = [url](self)**
**r = > web_db_count url=`url` table=`表` where=`条件` txn=`事务`**
*r[^count]*
*[count](r)*
## 迁移
+ `步骤`
按版本执行 SQL 迁移。`步骤` 为 `|版本|SQL|` 表;已应用版本记入 `_marqdo_migrations`。重复执行对已应用版本是空操作。仅 SQLite。
**url = self[^url]**
**url = [url](self)**
*> web_db_migrate url=`url` steps=`步骤`*
## 全文
@@ -441,7 +441,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
为 `表` 的内容列创建 FTS5 索引(CSV 或列表)。默认索引名 `{表}_fts`,用触发器保持同步。需要整数 `id` 主键。仅 SQLite。
**url = self[^url]**
**url = [url](self)**
*> web_db_fts_create url=`url` table=`表` columns=`列` name=`名`*
## 搜索
@@ -452,14 +452,14 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
对 `全文` 建立的索引做 `MATCH` 检索。返回 `{ rows, count }`,含 `rank`(bm25)。仅 SQLite。
**url = self[^url]**
**url = [url](self)**
*> web_db_search url=`url` table=`表` q=`关键词` limit=`上限` name=`名`*
## 事务
开启一个事务:从连接池独占借用连接,返回 `事务` 句柄。在事务内写入,然后 `提交` 或 `回滚`。所有语句在同一连接上执行,整批写入是原子的。
**url = self[^url]**
**url = [url](self)**
*> web_db_begin url=`url`*
# 事务
@@ -474,8 +474,8 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `表`
+ `行`
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
*> web_db_insert url=`url` table=`表` rows=`行` txn=`txn`*
## 查询
@@ -486,17 +486,17 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
筛选语法同 `数据库.查询`;在事务内执行。
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
**r = > web_db_select url=`url` table=`表` where=`条件` limit=`上限` order=`排序` offset=None txn=`txn`**
*r[^rows]*
*[rows](r)*
## 获取
+ `表`
+ `id`
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
*> web_db_get url=`url` table=`表` id=`id` txn=`txn`*
## 更新
@@ -504,38 +504,38 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `id`
+ `行`
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
*> web_db_update url=`url` table=`表` id=`id` row=`行` txn=`txn`*
## 删除
+ `表`
+ `id`
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
*> web_db_delete url=`url` table=`表` id=`id` txn=`txn`*
## 执行
+ `sql`
+ `参数`=None
**url = self[^地址]**
**txn = self[^事务]**
**url = [地址](self)**
**txn = [事务](self)**
*> web_db_exec url=`url` sql=`sql` args=`参数` txn=`txn`*
## 提交
提交事务,并把连接归还连接池。
**txn = self[^事务]**
**txn = [事务](self)**
*> web_db_commit txn=`txn`*
## 回滚
回滚事务(撤销所有写入),并归还连接。
**txn = self[^事务]**
**txn = [事务](self)**
*> web_db_rollback txn=`txn`*
# 表单
@@ -575,7 +575,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
+ `数据`
+ `数据库`
**url = 数据库[^url]**
**url = [url](数据库)**
*> web_form_submit form=`self` data=`数据` url=`url`*
# 应用
@@ -801,8 +801,8 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
用用户表校验并创建会话。返回 `{ok, session_id, username}`。
**users = self[^users]**
**ttl = self[^session_ttl]**
**users = [users](self)**
**ttl = [session_ttl](self)**
*> web_auth_login username=`用户名` password=`密码` users=`users` session_ttl=`ttl`*
## 校验
@@ -837,7 +837,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
## 获取
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_cache_get url=`url` key=`键`*
## 设置
@@ -847,25 +847,25 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
过期时间为秒;省略则不过期。
**url = self[^url]**
**url = [url](self)**
*> web_cache_set url=`url` key=`键` value=`值` ttl=`过期`*
## 删除
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_cache_del url=`url` key=`键`*
## 存在
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_cache_exists url=`url` key=`键`*
## 剩余时间
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_cache_ttl url=`url` key=`键`*
# 存储
@@ -884,25 +884,25 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
正文(文本)与路径(本地文件)二选一。
**url = self[^url]**
**url = [url](self)**
*> web_storage_put url=`url` key=`键` body=`正文` path=`路径` content_type=`类型`*
## 下载
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_storage_get url=`url` key=`键`*
## 删除对象
+ `键`
**url = self[^url]**
**url = [url](self)**
*> web_storage_delete url=`url` key=`键`*
## 列出
+ `前缀`=""
**url = self[^url]**
**url = [url](self)**
*> web_storage_list url=`url` prefix=`前缀`*
# 媒体
@@ -931,7 +931,7 @@ SEO / OpenGraph 元数据表(`|键|值|`)。如 `title`、`description`、`c
**st = 存储**
1. `st` == None
**st = self[^storage]**
**st = [storage](self)**
2. *
*> web_upload_save storage=`st` path=`路径` key=`键` content_type=`类型` prefix=`前缀`*
@@ -957,5 +957,5 @@ WebSocket 客户端工具。
单次请求-响应:连接 `地址`,发送 `消息`,收集服务器全部文本回复后关闭。返回 `{ok, messages}`。
**timeout = self[^timeout_sec]**
**timeout = [timeout_sec](self)**
*> web_ws_connect url=`地址` message=`消息` headers=`headers` timeout_sec=`timeout`*