@maiyunnet/kebab 9.1.2 → 9.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.1.2";
8
+ export declare const VER = "9.1.3";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.1.2';
9
+ export const VER = '9.1.3';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/sql.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare enum EJSON {
28
28
  export declare class Sql {
29
29
  /** --- ctr 对象 --- */
30
30
  private readonly _ctr?;
31
- /** --- 前置 --- */
31
+ /** --- 前置:MySQL 时为表前缀(如 prefix_),PostgreSQL 时为 Schema 名 --- */
32
32
  private readonly _pre;
33
33
  /** --- 服务商 --- */
34
34
  private readonly _service;
@@ -45,6 +45,7 @@ export declare class Sql {
45
45
  constructor(opt: {
46
46
  'service': ESERVICE;
47
47
  'ctr'?: ctr.Ctr;
48
+ /** --- 表前缀/Schema 名:MySQL 中作为表前缀(如 prefix_),PostgreSQL 中作为 Schema 名 --- */
48
49
  'pre'?: string;
49
50
  'data'?: kebab.DbValue[];
50
51
  'sql'?: string[];
@@ -103,7 +104,7 @@ export declare class Sql {
103
104
  * @param s ON 信息
104
105
  * @param type 类型
105
106
  * @param suf 表后缀
106
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
107
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
107
108
  */
108
109
  join(f: string, s?: kebab.Json, type?: string, suf?: string, pre?: string): this;
109
110
  /**
@@ -111,7 +112,7 @@ export declare class Sql {
111
112
  * @param f 表名
112
113
  * @param s ON 信息
113
114
  * @param suf 表后缀
114
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
115
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
115
116
  */
116
117
  leftJoin(f: string, s?: kebab.Json, suf?: string, pre?: string): this;
117
118
  /**
@@ -119,7 +120,7 @@ export declare class Sql {
119
120
  * @param f 表名
120
121
  * @param s ON 信息
121
122
  * @param suf 表后缀
122
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
123
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
123
124
  */
124
125
  rightJoin(f: string, s?: kebab.Json, suf?: string, pre?: string): this;
125
126
  /**
@@ -127,7 +128,7 @@ export declare class Sql {
127
128
  * @param f 表名
128
129
  * @param s ON 信息
129
130
  * @param suf 表后缀
130
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
131
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
131
132
  */
132
133
  innerJoin(f: string, s?: kebab.Json, suf?: string, pre?: string): this;
133
134
  /**
@@ -135,7 +136,7 @@ export declare class Sql {
135
136
  * @param f 表名
136
137
  * @param s ON 信息
137
138
  * @param suf 表后缀
138
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
139
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
139
140
  */
140
141
  fullJoin(f: string, s?: kebab.Json, suf?: string, pre?: string): this;
141
142
  /**
@@ -143,7 +144,7 @@ export declare class Sql {
143
144
  * @param f 表名
144
145
  * @param s ON 信息
145
146
  * @param suf 表后缀
146
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
147
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
147
148
  */
148
149
  crossJoin(f: string, s?: kebab.Json, suf?: string, pre?: string): this;
149
150
  /**
@@ -220,7 +221,7 @@ export declare class Sql {
220
221
  /**
221
222
  * --- 对字段进行包裹 ---
222
223
  * @param str
223
- * @param pre 表前缀,仅请在 field 表名时倒入前缀
224
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅请在 field 表名时倒入前缀/Schema
224
225
  * @param suf 表后缀,仅请在 field 表名时倒入后缀,前面加 # 代表要强制 AS,可能是分表查询时用
225
226
  */
226
227
  field(str: string | number | [string, string[]], pre?: string, suf?: string): string;
@@ -240,6 +241,7 @@ export declare class Sql {
240
241
  /**
241
242
  * --- 创建 sql 对象 ---
242
243
  * @param opt 参数
244
+ * @param opt.pre MySQL 时作为表前缀(如 prefix_),PostgreSQL 时作为 Schema 名。MySQL 会自动补充末尾下划线
243
245
  */
244
246
  export declare function get(opt: {
245
247
  'service': ESERVICE;
package/lib/sql.js CHANGED
@@ -29,7 +29,7 @@ let columnToken = '';
29
29
  export class Sql {
30
30
  /** --- ctr 对象 --- */
31
31
  _ctr;
32
- /** --- 前置 --- */
32
+ /** --- 前置:MySQL 时为表前缀(如 prefix_),PostgreSQL 时为 Schema 名 --- */
33
33
  _pre = '';
34
34
  /** --- 服务商 --- */
35
35
  _service;
@@ -312,7 +312,7 @@ export class Sql {
312
312
  * @param s ON 信息
313
313
  * @param type 类型
314
314
  * @param suf 表后缀
315
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
315
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
316
316
  */
317
317
  join(f, s = [], type = 'INNER', suf = '', pre = '') {
318
318
  let field = this.field(f, pre || this._pre, suf ? ('#' + suf) : '');
@@ -337,7 +337,7 @@ export class Sql {
337
337
  * @param f 表名
338
338
  * @param s ON 信息
339
339
  * @param suf 表后缀
340
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
340
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
341
341
  */
342
342
  leftJoin(f, s = [], suf = '', pre = '') {
343
343
  return this.join(f, s, 'LEFT', suf, pre);
@@ -347,7 +347,7 @@ export class Sql {
347
347
  * @param f 表名
348
348
  * @param s ON 信息
349
349
  * @param suf 表后缀
350
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
350
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
351
351
  */
352
352
  rightJoin(f, s = [], suf = '', pre = '') {
353
353
  return this.join(f, s, 'RIGHT', suf, pre);
@@ -357,7 +357,7 @@ export class Sql {
357
357
  * @param f 表名
358
358
  * @param s ON 信息
359
359
  * @param suf 表后缀
360
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
360
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
361
361
  */
362
362
  innerJoin(f, s = [], suf = '', pre = '') {
363
363
  return this.join(f, s, 'INNER', suf, pre);
@@ -367,7 +367,7 @@ export class Sql {
367
367
  * @param f 表名
368
368
  * @param s ON 信息
369
369
  * @param suf 表后缀
370
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
370
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
371
371
  */
372
372
  fullJoin(f, s = [], suf = '', pre = '') {
373
373
  return this.join(f, s, 'FULL', suf, pre);
@@ -377,7 +377,7 @@ export class Sql {
377
377
  * @param f 表名
378
378
  * @param s ON 信息
379
379
  * @param suf 表后缀
380
- * @param pre 表前缀,仅在 join 非默认表前缀时填写
380
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅在 join 非默认前缀时填写
381
381
  */
382
382
  crossJoin(f, s = [], suf = '', pre = '') {
383
383
  return this.join(f, s, 'CROSS', suf, pre);
@@ -843,7 +843,7 @@ export class Sql {
843
843
  /**
844
844
  * --- 对字段进行包裹 ---
845
845
  * @param str
846
- * @param pre 表前缀,仅请在 field 表名时倒入前缀
846
+ * @param pre MySQL 时为表前缀,PostgreSQL 时为 Schema 名,仅请在 field 表名时倒入前缀/Schema
847
847
  * @param suf 表后缀,仅请在 field 表名时倒入后缀,前面加 # 代表要强制 AS,可能是分表查询时用
848
848
  */
849
849
  field(str, pre = '', suf = '') {
@@ -1083,6 +1083,7 @@ export class Sql {
1083
1083
  /**
1084
1084
  * --- 创建 sql 对象 ---
1085
1085
  * @param opt 参数
1086
+ * @param opt.pre MySQL 时作为表前缀(如 prefix_),PostgreSQL 时作为 Schema 名。MySQL 会自动补充末尾下划线
1086
1087
  */
1087
1088
  export function get(opt) {
1088
1089
  let pre = opt.pre ?? opt.ctr?.getPrototype('_config').sql.pre;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.1.2",
3
+ "version": "9.1.3",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [
package/sys/cmd.js CHANGED
@@ -394,18 +394,24 @@ async function run() {
394
394
  }
395
395
  }
396
396
  else {
397
- // --- 未指定目录:递归扫描所有站点的 www/*/stc/ ---
398
- const wwwItems = await lFs.readDir(kebab.WWW_CWD);
399
- for (const wwwItem of wwwItems) {
400
- if (wwwItem.name === '.' || wwwItem.name === '..' || !wwwItem.isDirectory()) {
401
- continue;
402
- }
403
- const stcPath = `${kebab.WWW_CWD}${wwwItem.name}/stc`;
404
- if (!await lFs.isDir(stcPath)) {
405
- continue;
397
+ // --- 未指定目录:递归在 www/ 下找所有 stc/ 目录并扫描(支持任意深度,如 www/*/stc、www/*/*/stc)---
398
+ const findStcDirs = async (dir) => {
399
+ const items = await lFs.readDir(dir);
400
+ for (const item of items) {
401
+ if (item.name === '.' || item.name === '..' || !item.isDirectory()) {
402
+ continue;
403
+ }
404
+ const sub = `${dir}/${item.name}`;
405
+ if (item.name === 'stc') {
406
+ await scanDir(sub);
407
+ }
408
+ else {
409
+ await findStcDirs(sub);
410
+ }
406
411
  }
407
- await scanDir(stcPath);
408
- }
412
+ };
413
+ // --- kebab.WWW_CWD 末尾含 /,去掉再传入保持路径格式统一 ---
414
+ await findStcDirs(kebab.WWW_CWD.replace(/\/$/, ''));
409
415
  }
410
416
  if (entryPoints.length === 0) {
411
417
  lCore.display('KEBAB', 'BUILD', 'No .tsx files found.');
package/sys/mod.d.ts CHANGED
@@ -40,7 +40,7 @@ export default class Mod {
40
40
  protected static _$key: string;
41
41
  /** --- 若使用 _$key 并且有多个 unique 索引,这里指定 _$key 的索引名 --- */
42
42
  protected static _$index: string;
43
- /** --- 前缀,顺序:选项前缀 -> 本前缀 -> 配置文件前缀 --- */
43
+ /** --- 前缀,MySQL 时为表前缀(如 prefix_),PostgreSQL 时为 Schema 名。顺序:选项前缀 -> 本前缀 -> 配置文件前缀 --- */
44
44
  protected static _$pre?: string;
45
45
  /** --- 要 update 的内容 --- */
46
46
  protected _updates: Record<string, boolean>;
@@ -80,6 +80,7 @@ export default class Mod {
80
80
  'key': string;
81
81
  'list': string[];
82
82
  };
83
+ /** --- MySQL 表前缀或 PostgreSQL Schema 名,优先级:选项 > 类属性 > 配置 --- */
83
84
  'pre'?: string;
84
85
  });
85
86
  /** --- 创建字段对象 --- */
@@ -95,7 +96,7 @@ export default class Mod {
95
96
  * @param db 数据库对象
96
97
  * @param cs 字段列表
97
98
  * @param vs 数据列表
98
- * @param opt 选项
99
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
99
100
  */
100
101
  static insert(db: lDb.Pool | lDb.Transaction, cs: string[] | Record<string, any>, vs?: any[] | any[][], opt?: {
101
102
  'pre'?: string;
@@ -108,7 +109,7 @@ export default class Mod {
108
109
  * @param db 数据库对象
109
110
  * @param cs 字段列表
110
111
  * @param vs 数据列表
111
- * @param opt 选项
112
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
112
113
  */
113
114
  static insertSql(db: lDb.Pool | lDb.Transaction, cs: string[] | Record<string, any>, vs?: any[] | any[][], opt?: {
114
115
  'pre'?: string;
@@ -120,7 +121,7 @@ export default class Mod {
120
121
  * --- 根据条件移除条目 ---
121
122
  * @param db 数据库对象
122
123
  * @param where 筛选条件
123
- * @param opt 选项
124
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
124
125
  */
125
126
  static removeByWhere(db: lDb.Pool | lDb.Transaction, where: string | kebab.Json, opt?: {
126
127
  'pre'?: string;
@@ -133,7 +134,7 @@ export default class Mod {
133
134
  * --- 根据条件移除条目(仅获取 SQL 对象) ---
134
135
  * @param db 数据库对象
135
136
  * @param where 筛选条件
136
- * @param opt 选项
137
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
137
138
  */
138
139
  static removeByWhereSql(db: lDb.Pool | lDb.Transaction, where: string | kebab.Json, opt?: {
139
140
  'pre'?: string;
@@ -147,7 +148,7 @@ export default class Mod {
147
148
  * @param db 数据库对象
148
149
  * @param data 要更新的数据
149
150
  * @param where 筛选条件
150
- * @param opt 选项
151
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
151
152
  */
152
153
  static updateByWhere(db: lDb.Pool | lDb.Transaction, data: kebab.Json, where: string | kebab.Json, opt?: {
153
154
  'pre'?: string;
@@ -161,7 +162,7 @@ export default class Mod {
161
162
  * @param db 数据库对象
162
163
  * @param data 要更新的数据
163
164
  * @param where 筛选条件
164
- * @param opt 选项
165
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
165
166
  */
166
167
  static updateByWhereSql(db: lDb.Pool | lDb.Transaction, data: kebab.Json, where: string | kebab.Json, opt?: {
167
168
  'pre'?: string;
@@ -175,7 +176,7 @@ export default class Mod {
175
176
  * @param db 数据库对象
176
177
  * @param data 数据列表
177
178
  * @param key 用于定位的主键或唯一键字段名
178
- * @param opt 选项
179
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
179
180
  */
180
181
  static updateList(db: lDb.Pool | lDb.Transaction, data: Array<Record<string, any>>, key: string, opt?: {
181
182
  'ctr'?: sCtr.Ctr;
@@ -186,7 +187,7 @@ export default class Mod {
186
187
  * --- select 自定字段 ---
187
188
  * @param db 数据库对象
188
189
  * @param c 字段字符串或字段数组
189
- * @param opt 选项
190
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
190
191
  */
191
192
  static select<T extends Mod>(db: lDb.Pool | lDb.Transaction, c: string | string[], opt?: {
192
193
  'ctr'?: sCtr.Ctr;
@@ -202,7 +203,7 @@ export default class Mod {
202
203
  * --- 通过 where 条件获取模型 ---
203
204
  * @param db 数据库对象
204
205
  * @param s 筛选条件数组或字符串
205
- * @param opt 选项
206
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
206
207
  */
207
208
  static where<T extends Mod>(db: lDb.Pool | lDb.Transaction, s?: string | kebab.Json, opt?: {
208
209
  'ctr'?: sCtr.Ctr;
@@ -217,7 +218,7 @@ export default class Mod {
217
218
  /**
218
219
  * --- 获取创建对象,通常用于新建数据库条目 ---
219
220
  * @param db 数据库对象
220
- * @param opt 选项
221
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
221
222
  */
222
223
  static getCreate<T extends Mod>(db: lDb.Pool | lDb.Transaction, opt?: {
223
224
  'ctr'?: sCtr.Ctr;
@@ -228,7 +229,7 @@ export default class Mod {
228
229
  * --- 根据主键(或 key 字段)获取对象 ---
229
230
  * @param db 数据库对象
230
231
  * @param val 主键值
231
- * @param opt 选项
232
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
232
233
  */
233
234
  static find<T extends Mod>(db: lDb.Pool | lDb.Transaction, val: string | number | null, opt?: {
234
235
  'ctr'?: sCtr.Ctr;
@@ -260,7 +261,7 @@ export default class Mod {
260
261
  * --- 通过 where 条件筛选单条数据返回原生对象 ---
261
262
  * @param db 数据库对象
262
263
  * @param s 筛选条件数组或字符串
263
- * @param opt 选项
264
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
264
265
  */
265
266
  static oneArray(db: lDb.Pool | lDb.Transaction, s: string | kebab.Json, opt?: {
266
267
  'ctr'?: sCtr.Ctr;
@@ -273,7 +274,7 @@ export default class Mod {
273
274
  * --- 根据 where 条件获取主键值列表 ---
274
275
  * @param db 数据库对象
275
276
  * @param where where 条件
276
- * @param opt 选项
277
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
277
278
  */
278
279
  static primarys(db: lDb.Pool | lDb.Transaction, where?: string | kebab.Json, opt?: {
279
280
  'ctr'?: sCtr.Ctr;
package/sys/mod.js CHANGED
@@ -54,7 +54,7 @@ export default class Mod {
54
54
  static _$key = '';
55
55
  /** --- 若使用 _$key 并且有多个 unique 索引,这里指定 _$key 的索引名 --- */
56
56
  static _$index = '';
57
- /** --- 前缀,顺序:选项前缀 -> 本前缀 -> 配置文件前缀 --- */
57
+ /** --- 前缀,MySQL 时为表前缀(如 prefix_),PostgreSQL 时为 Schema 名。顺序:选项前缀 -> 本前缀 -> 配置文件前缀 --- */
58
58
  static _$pre;
59
59
  /** --- 要 update 的内容 --- */
60
60
  _updates = {};
@@ -128,7 +128,7 @@ export default class Mod {
128
128
  * @param db 数据库对象
129
129
  * @param cs 字段列表
130
130
  * @param vs 数据列表
131
- * @param opt 选项
131
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
132
132
  */
133
133
  static async insert(db, cs, vs, opt = {}) {
134
134
  const sq = lSql.get({
@@ -177,7 +177,7 @@ export default class Mod {
177
177
  * @param db 数据库对象
178
178
  * @param cs 字段列表
179
179
  * @param vs 数据列表
180
- * @param opt 选项
180
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
181
181
  */
182
182
  static insertSql(db, cs, vs, opt = {}) {
183
183
  const sq = lSql.get({
@@ -192,7 +192,7 @@ export default class Mod {
192
192
  * --- 根据条件移除条目 ---
193
193
  * @param db 数据库对象
194
194
  * @param where 筛选条件
195
- * @param opt 选项
195
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
196
196
  */
197
197
  static async removeByWhere(db, where, opt = {}) {
198
198
  const indexs = opt.index ? (typeof opt.index === 'string' ? [opt.index] : [...new Set(opt.index)]) : [''];
@@ -225,7 +225,7 @@ export default class Mod {
225
225
  * --- 根据条件移除条目(仅获取 SQL 对象) ---
226
226
  * @param db 数据库对象
227
227
  * @param where 筛选条件
228
- * @param opt 选项
228
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
229
229
  */
230
230
  static removeByWhereSql(db, where, opt = {}) {
231
231
  const sq = lSql.get({
@@ -247,7 +247,7 @@ export default class Mod {
247
247
  * @param db 数据库对象
248
248
  * @param data 要更新的数据
249
249
  * @param where 筛选条件
250
- * @param opt 选项
250
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
251
251
  */
252
252
  static async updateByWhere(db, data, where, opt = {}) {
253
253
  const indexs = opt.index ? (typeof opt.index === 'string' ? [opt.index] : [...new Set(opt.index)]) : [''];
@@ -281,7 +281,7 @@ export default class Mod {
281
281
  * @param db 数据库对象
282
282
  * @param data 要更新的数据
283
283
  * @param where 筛选条件
284
- * @param opt 选项
284
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
285
285
  */
286
286
  static updateByWhereSql(db, data, where, opt = {}) {
287
287
  const sq = lSql.get({
@@ -303,7 +303,7 @@ export default class Mod {
303
303
  * @param db 数据库对象
304
304
  * @param data 数据列表
305
305
  * @param key 用于定位的主键或唯一键字段名
306
- * @param opt 选项
306
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
307
307
  */
308
308
  static async updateList(db, data, key, opt = {}) {
309
309
  if (!data.length) {
@@ -376,7 +376,7 @@ export default class Mod {
376
376
  * --- select 自定字段 ---
377
377
  * @param db 数据库对象
378
378
  * @param c 字段字符串或字段数组
379
- * @param opt 选项
379
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
380
380
  */
381
381
  static select(db, c, opt = {}) {
382
382
  return new this({
@@ -393,7 +393,7 @@ export default class Mod {
393
393
  * --- 通过 where 条件获取模型 ---
394
394
  * @param db 数据库对象
395
395
  * @param s 筛选条件数组或字符串
396
- * @param opt 选项
396
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
397
397
  */
398
398
  static where(db, s = '', opt = {}) {
399
399
  return new this({
@@ -409,7 +409,7 @@ export default class Mod {
409
409
  /**
410
410
  * --- 获取创建对象,通常用于新建数据库条目 ---
411
411
  * @param db 数据库对象
412
- * @param opt 选项
412
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
413
413
  */
414
414
  static getCreate(db, opt = {}) {
415
415
  return new this({
@@ -423,7 +423,7 @@ export default class Mod {
423
423
  * --- 根据主键(或 key 字段)获取对象 ---
424
424
  * @param db 数据库对象
425
425
  * @param val 主键值
426
- * @param opt 选项
426
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
427
427
  */
428
428
  static async find(db, val, opt = {}) {
429
429
  if (opt.key && !this._$key) {
@@ -444,7 +444,7 @@ export default class Mod {
444
444
  * --- 通过 where 条件筛选单条数据 ---
445
445
  * @param db 数据库对象
446
446
  * @param s 筛选条件数组或字符串
447
- * @param opt 选项,lock 需确保 where 条件命中索引,否则可能退化为表锁
447
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名;lock 需确保 where 条件命中索引,否则可能退化为表锁)
448
448
  */
449
449
  static async one(db, s, opt = {}) {
450
450
  if (!opt.index) {
@@ -489,7 +489,7 @@ export default class Mod {
489
489
  * --- 通过 where 条件筛选单条数据返回原生对象 ---
490
490
  * @param db 数据库对象
491
491
  * @param s 筛选条件数组或字符串
492
- * @param opt 选项
492
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
493
493
  */
494
494
  static async oneArray(db, s, opt = {}) {
495
495
  opt.array = true;
@@ -499,7 +499,7 @@ export default class Mod {
499
499
  * --- 根据 where 条件获取主键值列表 ---
500
500
  * @param db 数据库对象
501
501
  * @param where where 条件
502
- * @param opt 选项
502
+ * @param opt 选项(opt.pre: MySQL 表前缀/PostgreSQL Schema 名)
503
503
  */
504
504
  static async primarys(db, where = '', opt = {}) {
505
505
  const sq = lSql.get({