@maiyunnet/kebab 8.5.1 → 8.5.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/doc/kebab-rag.md CHANGED
@@ -1410,7 +1410,7 @@ index/variables/VER.md
1410
1410
 
1411
1411
  # Variable: VER
1412
1412
 
1413
- > `const` **VER**: `"8.5.1"` = `'8.5.1'`
1413
+ > `const` **VER**: `"8.5.3"` = `'8.5.3'`
1414
1414
 
1415
1415
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1416
1416
 
@@ -13153,7 +13153,7 @@ Defined in: [lib/sql.ts:66](https://github.com/maiyunnet/kebab/blob/master/lib/s
13153
13153
 
13154
13154
  > **append**(`sql`): `this`
13155
13155
 
13156
- Defined in: [lib/sql.ts:879](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L879)
13156
+ Defined in: [lib/sql.ts:916](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L916)
13157
13157
 
13158
13158
  在 sql 最后追加字符串
13159
13159
 
@@ -13291,7 +13291,7 @@ Defined in: [lib/sql.ts:315](https://github.com/maiyunnet/kebab/blob/master/lib/
13291
13291
 
13292
13292
  > **field**(`str`, `pre?`, `suf?`): `string`
13293
13293
 
13294
- Defined in: [lib/sql.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L890)
13294
+ Defined in: [lib/sql.ts:927](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L927)
13295
13295
 
13296
13296
  对字段进行包裹
13297
13297
 
@@ -13323,7 +13323,7 @@ Defined in: [lib/sql.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/
13323
13323
 
13324
13324
  > **format**(`sql?`, `data?`): `string`
13325
13325
 
13326
- Defined in: [lib/sql.ts:869](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L869)
13326
+ Defined in: [lib/sql.ts:906](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L906)
13327
13327
 
13328
13328
  获取带 data 的 sql 语句
13329
13329
 
@@ -13387,7 +13387,7 @@ ON 信息
13387
13387
 
13388
13388
  > **getData**(): [`DbValue`](../../../index/type-aliases/DbValue.md)[]
13389
13389
 
13390
- Defined in: [lib/sql.ts:853](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L853)
13390
+ Defined in: [lib/sql.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L890)
13391
13391
 
13392
13392
  获取全部 data
13393
13393
 
@@ -13401,7 +13401,7 @@ Defined in: [lib/sql.ts:853](https://github.com/maiyunnet/kebab/blob/master/lib/
13401
13401
 
13402
13402
  > **getPre**(): `string`
13403
13403
 
13404
- Defined in: [lib/sql.ts:860](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L860)
13404
+ Defined in: [lib/sql.ts:897](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L897)
13405
13405
 
13406
13406
  获取定义的 pre
13407
13407
 
@@ -13415,7 +13415,7 @@ Defined in: [lib/sql.ts:860](https://github.com/maiyunnet/kebab/blob/master/lib/
13415
13415
 
13416
13416
  > **getSql**(): `string`
13417
13417
 
13418
- Defined in: [lib/sql.ts:837](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L837)
13418
+ Defined in: [lib/sql.ts:874](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L874)
13419
13419
 
13420
13420
  获取 sql 语句
13421
13421
 
@@ -14012,7 +14012,7 @@ lib/sql/functions/aoMix.md
14012
14012
 
14013
14013
  > **aoMix**(`arr`): `Record`\<`string`, `string` \| `number` \| [`Json`](../../../index/type-aliases/Json.md)\>
14014
14014
 
14015
- Defined in: [lib/sql.ts:1216](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1216)
14015
+ Defined in: [lib/sql.ts:1253](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1253)
14016
14016
 
14017
14017
  将数组兑换为组合的对象(Array/Object mix)
14018
14018
 
@@ -14041,7 +14041,7 @@ lib/sql/functions/column.md
14041
14041
 
14042
14042
  > **column**(`field`): `object`
14043
14043
 
14044
- Defined in: [lib/sql.ts:1237](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1237)
14044
+ Defined in: [lib/sql.ts:1274](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1274)
14045
14045
 
14046
14046
  创建字段对象
14047
14047
 
@@ -14080,7 +14080,7 @@ lib/sql/functions/format.md
14080
14080
 
14081
14081
  > **format**(`sql`, `data`, `service?`): `string`
14082
14082
 
14083
- Defined in: [lib/sql.ts:1178](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1178)
14083
+ Defined in: [lib/sql.ts:1215](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1215)
14084
14084
 
14085
14085
  返回代入后的完整 SQL 字符串,这并不安全不能直接执行,只是用来调试打印 sql 语句
14086
14086
 
@@ -14121,7 +14121,7 @@ lib/sql/functions/get.md
14121
14121
 
14122
14122
  > **get**(`opt`): [`Sql`](../classes/Sql.md)
14123
14123
 
14124
- Defined in: [lib/sql.ts:1150](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1150)
14124
+ Defined in: [lib/sql.ts:1187](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1187)
14125
14125
 
14126
14126
  创建 sql 对象
14127
14127
 
@@ -14172,7 +14172,7 @@ lib/sql/functions/json.md
14172
14172
 
14173
14173
  > **json**(`obj`): `any`
14174
14174
 
14175
- Defined in: [lib/sql.ts:1256](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1256)
14175
+ Defined in: [lib/sql.ts:1293](https://github.com/maiyunnet/kebab/blob/master/lib/sql.ts#L1293)
14176
14176
 
14177
14177
  将对象转换为 JSON 字符串并避开类型检查,用于适配 PostgreSQL 的 jsonb 字段
14178
14178
 
@@ -20958,7 +20958,7 @@ Defined in: [sys/mod.ts:65](https://github.com/maiyunnet/kebab/blob/master/sys/m
20958
20958
 
20959
20959
  > **new default**(`opt`): `Mod`
20960
20960
 
20961
- Defined in: [sys/mod.ts:113](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L113)
20961
+ Defined in: [sys/mod.ts:116](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L116)
20962
20962
 
20963
20963
  构造函数
20964
20964
 
@@ -21060,6 +21060,16 @@ Defined in: [sys/mod.ts:101](https://github.com/maiyunnet/kebab/blob/master/sys/
21060
21060
 
21061
21061
  ***
21062
21062
 
21063
+ ### \_fieldPrefix
21064
+
21065
+ > `protected` **\_fieldPrefix**: `string` = `''`
21066
+
21067
+ Defined in: [sys/mod.ts:110](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L110)
21068
+
21069
+ 主表筛选前缀,优先 alias,其次表名
21070
+
21071
+ ***
21072
+
21063
21073
  ### \_index
21064
21074
 
21065
21075
  > `protected` **\_index**: `string`[] \| `null` = `null`
@@ -21154,7 +21164,7 @@ Defined in: [sys/mod.ts:68](https://github.com/maiyunnet/kebab/blob/master/sys/m
21154
21164
 
21155
21165
  > `protected` **\_keyGenerator**(): `string`
21156
21166
 
21157
- Defined in: [sys/mod.ts:1767](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1767)
21167
+ Defined in: [sys/mod.ts:1794](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1794)
21158
21168
 
21159
21169
  当 _key 不为空时,则依据继承此方法的方法自动生成填充 key
21160
21170
 
@@ -21176,7 +21186,7 @@ Defined in: [sys/mod.ts:1767](https://github.com/maiyunnet/kebab/blob/master/sys
21176
21186
 
21177
21187
  > **all**(): `Promise`\<`false` \| [`Rows`](Rows.md)\<`Mod`\>\>
21178
21188
 
21179
- Defined in: [sys/mod.ts:1130](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1130)
21189
+ Defined in: [sys/mod.ts:1136](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1136)
21180
21190
 
21181
21191
  ##### Returns
21182
21192
 
@@ -21186,7 +21196,7 @@ Defined in: [sys/mod.ts:1130](https://github.com/maiyunnet/kebab/blob/master/sys
21186
21196
 
21187
21197
  > **all**(`key`): `Promise`\<`false` \| `Record`\<`string`, `Mod`\>\>
21188
21198
 
21189
- Defined in: [sys/mod.ts:1131](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1131)
21199
+ Defined in: [sys/mod.ts:1137](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1137)
21190
21200
 
21191
21201
  ##### Parameters
21192
21202
 
@@ -21212,7 +21222,7 @@ Defined in: [sys/mod.ts:1131](https://github.com/maiyunnet/kebab/blob/master/sys
21212
21222
 
21213
21223
  > **allArray**(): `Promise`\<`false` \| `Record`\<`string`, `any`\>[]\>
21214
21224
 
21215
- Defined in: [sys/mod.ts:1306](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1306)
21225
+ Defined in: [sys/mod.ts:1315](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1315)
21216
21226
 
21217
21227
  ##### Returns
21218
21228
 
@@ -21222,7 +21232,7 @@ Defined in: [sys/mod.ts:1306](https://github.com/maiyunnet/kebab/blob/master/sys
21222
21232
 
21223
21233
  > **allArray**(`key`): `Promise`\<`false` \| `Record`\<`string`, `Record`\<`string`, `any`\>\>\>
21224
21234
 
21225
- Defined in: [sys/mod.ts:1307](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1307)
21235
+ Defined in: [sys/mod.ts:1316](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1316)
21226
21236
 
21227
21237
  ##### Parameters
21228
21238
 
@@ -21240,7 +21250,7 @@ Defined in: [sys/mod.ts:1307](https://github.com/maiyunnet/kebab/blob/master/sys
21240
21250
 
21241
21251
  > **append**(`sql`): `this`
21242
21252
 
21243
- Defined in: [sys/mod.ts:1676](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1676)
21253
+ Defined in: [sys/mod.ts:1703](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1703)
21244
21254
 
21245
21255
  在 sql 最后追加字符串
21246
21256
 
@@ -21260,7 +21270,7 @@ Defined in: [sys/mod.ts:1676](https://github.com/maiyunnet/kebab/blob/master/sys
21260
21270
 
21261
21271
  > **by**(`c`, `d?`): `this`
21262
21272
 
21263
- Defined in: [sys/mod.ts:1632](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1632)
21273
+ Defined in: [sys/mod.ts:1659](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1659)
21264
21274
 
21265
21275
  ORDER BY
21266
21276
 
@@ -21288,7 +21298,7 @@ ORDER BY
21288
21298
 
21289
21299
  > **contain**(`contain`): `this`
21290
21300
 
21291
- Defined in: [sys/mod.ts:1685](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1685)
21301
+ Defined in: [sys/mod.ts:1712](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1712)
21292
21302
 
21293
21303
  设置闭包含数据
21294
21304
 
@@ -21316,7 +21326,7 @@ Defined in: [sys/mod.ts:1685](https://github.com/maiyunnet/kebab/blob/master/sys
21316
21326
 
21317
21327
  > **count**(): `Promise`\<`number`\>
21318
21328
 
21319
- Defined in: [sys/mod.ts:1496](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1496)
21329
+ Defined in: [sys/mod.ts:1523](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1523)
21320
21330
 
21321
21331
  根据当前条件,筛选出当前条目该有的数据条数
21322
21332
 
@@ -21330,7 +21340,7 @@ Defined in: [sys/mod.ts:1496](https://github.com/maiyunnet/kebab/blob/master/sys
21330
21340
 
21331
21341
  > **countSql**(): `string`
21332
21342
 
21333
- Defined in: [sys/mod.ts:1517](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1517)
21343
+ Defined in: [sys/mod.ts:1544](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1544)
21334
21344
 
21335
21345
  获取当前条件下的 count 的 SQL 语句
21336
21346
 
@@ -21344,7 +21354,7 @@ Defined in: [sys/mod.ts:1517](https://github.com/maiyunnet/kebab/blob/master/sys
21344
21354
 
21345
21355
  > **create**(): `Promise`\<`boolean` \| `null`\>
21346
21356
 
21347
- Defined in: [sys/mod.ts:824](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L824)
21357
+ Defined in: [sys/mod.ts:830](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L830)
21348
21358
 
21349
21359
  创建数据
21350
21360
 
@@ -21360,7 +21370,7 @@ true-成功,false-报错,null-唯一键非 _$key 键冲突
21360
21370
 
21361
21371
  > **crossJoin**(`f`, `s`, `index?`, `pre?`): `this`
21362
21372
 
21363
- Defined in: [sys/mod.ts:1592](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1592)
21373
+ Defined in: [sys/mod.ts:1619](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1619)
21364
21374
 
21365
21375
  cross join 方法
21366
21376
 
@@ -21408,7 +21418,7 @@ ON 信息
21408
21418
 
21409
21419
  > **explain**(`all?`): `Promise`\<`string` \| `false`\>
21410
21420
 
21411
- Defined in: [sys/mod.ts:1429](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1429)
21421
+ Defined in: [sys/mod.ts:1441](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1441)
21412
21422
 
21413
21423
  ##### Parameters
21414
21424
 
@@ -21424,7 +21434,7 @@ Defined in: [sys/mod.ts:1429](https://github.com/maiyunnet/kebab/blob/master/sys
21424
21434
 
21425
21435
  > **explain**(`all`): `Promise`\<`false` \| `Record`\<`string`, `any`\>\>
21426
21436
 
21427
- Defined in: [sys/mod.ts:1430](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1430)
21437
+ Defined in: [sys/mod.ts:1442](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1442)
21428
21438
 
21429
21439
  ##### Parameters
21430
21440
 
@@ -21442,7 +21452,7 @@ Defined in: [sys/mod.ts:1430](https://github.com/maiyunnet/kebab/blob/master/sys
21442
21452
 
21443
21453
  > **filter**(`s`): `this`
21444
21454
 
21445
- Defined in: [sys/mod.ts:1610](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1610)
21455
+ Defined in: [sys/mod.ts:1637](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1637)
21446
21456
 
21447
21457
  筛选器
21448
21458
 
@@ -21476,7 +21486,7 @@ Defined in: [sys/mod.ts:1610](https://github.com/maiyunnet/kebab/blob/master/sys
21476
21486
 
21477
21487
  > **first**(`lock`, `array`): `Promise`\<`false` \| `Record`\<`string`, `any`\> \| `null`\>
21478
21488
 
21479
- Defined in: [sys/mod.ts:1019](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1019)
21489
+ Defined in: [sys/mod.ts:1025](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1025)
21480
21490
 
21481
21491
  ##### Parameters
21482
21492
 
@@ -21496,7 +21506,7 @@ Defined in: [sys/mod.ts:1019](https://github.com/maiyunnet/kebab/blob/master/sys
21496
21506
 
21497
21507
  > **first**(`lock?`, `array?`): `Promise`\<`false` \| `Mod` & `Record`\<`string`, `any`\> \| `null`\>
21498
21508
 
21499
- Defined in: [sys/mod.ts:1023](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1023)
21509
+ Defined in: [sys/mod.ts:1029](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1029)
21500
21510
 
21501
21511
  ##### Parameters
21502
21512
 
@@ -21518,7 +21528,7 @@ Defined in: [sys/mod.ts:1023](https://github.com/maiyunnet/kebab/blob/master/sys
21518
21528
 
21519
21529
  > **firstArray**(`lock?`): `Promise`\<`false` \| `Record`\<`string`, `any`\> \| `null`\>
21520
21530
 
21521
- Defined in: [sys/mod.ts:1063](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1063)
21531
+ Defined in: [sys/mod.ts:1069](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1069)
21522
21532
 
21523
21533
  获取数据库第一个原生对象
21524
21534
 
@@ -21540,7 +21550,7 @@ Defined in: [sys/mod.ts:1063](https://github.com/maiyunnet/kebab/blob/master/sys
21540
21550
 
21541
21551
  > **format**(`sql?`, `data?`): `string`
21542
21552
 
21543
- Defined in: [sys/mod.ts:1712](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1712)
21553
+ Defined in: [sys/mod.ts:1739](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1739)
21544
21554
 
21545
21555
  获取带 data 的 sql 语句
21546
21556
 
@@ -21568,7 +21578,7 @@ sql 语句
21568
21578
 
21569
21579
  > **fullJoin**(`f`, `s`, `index?`, `pre?`): `this`
21570
21580
 
21571
- Defined in: [sys/mod.ts:1580](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1580)
21581
+ Defined in: [sys/mod.ts:1607](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1607)
21572
21582
 
21573
21583
  full join 方法
21574
21584
 
@@ -21608,7 +21618,7 @@ ON 信息
21608
21618
 
21609
21619
  > **get**(`n`): `any`
21610
21620
 
21611
- Defined in: [sys/mod.ts:816](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L816)
21621
+ Defined in: [sys/mod.ts:822](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L822)
21612
21622
 
21613
21623
  获取一个字段值
21614
21624
 
@@ -21630,7 +21640,7 @@ Defined in: [sys/mod.ts:816](https://github.com/maiyunnet/kebab/blob/master/sys/
21630
21640
 
21631
21641
  > **getData**(): `any`[]
21632
21642
 
21633
- Defined in: [sys/mod.ts:1703](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1703)
21643
+ Defined in: [sys/mod.ts:1730](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1730)
21634
21644
 
21635
21645
  获取全部 data
21636
21646
 
@@ -21644,7 +21654,7 @@ Defined in: [sys/mod.ts:1703](https://github.com/maiyunnet/kebab/blob/master/sys
21644
21654
 
21645
21655
  > **getSql**(): `string`
21646
21656
 
21647
- Defined in: [sys/mod.ts:1696](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1696)
21657
+ Defined in: [sys/mod.ts:1723](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1723)
21648
21658
 
21649
21659
  获取 sql 语句
21650
21660
 
@@ -21658,7 +21668,7 @@ Defined in: [sys/mod.ts:1696](https://github.com/maiyunnet/kebab/blob/master/sys
21658
21668
 
21659
21669
  > **group**(`c`): `this`
21660
21670
 
21661
- Defined in: [sys/mod.ts:1641](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1641)
21671
+ Defined in: [sys/mod.ts:1668](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1668)
21662
21672
 
21663
21673
  GROUP BY
21664
21674
 
@@ -21680,7 +21690,7 @@ GROUP BY
21680
21690
 
21681
21691
  > **having**(`s`): `this`
21682
21692
 
21683
- Defined in: [sys/mod.ts:1601](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1601)
21693
+ Defined in: [sys/mod.ts:1628](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1628)
21684
21694
 
21685
21695
  筛选器
21686
21696
 
@@ -21702,7 +21712,7 @@ Defined in: [sys/mod.ts:1601](https://github.com/maiyunnet/kebab/blob/master/sys
21702
21712
 
21703
21713
  > **innerJoin**(`f`, `s`, `index?`, `pre?`): `this`
21704
21714
 
21705
- Defined in: [sys/mod.ts:1568](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1568)
21715
+ Defined in: [sys/mod.ts:1595](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1595)
21706
21716
 
21707
21717
  inner join 方法
21708
21718
 
@@ -21742,7 +21752,7 @@ ON 信息
21742
21752
 
21743
21753
  > **join**(`f`, `s?`, `type?`, `index?`, `pre?`): `this`
21744
21754
 
21745
- Defined in: [sys/mod.ts:1532](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1532)
21755
+ Defined in: [sys/mod.ts:1559](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1559)
21746
21756
 
21747
21757
  #### Parameters
21748
21758
 
@@ -21786,7 +21796,7 @@ ON 信息
21786
21796
 
21787
21797
  > **langText**(`col`, `lang`): `string`
21788
21798
 
21789
- Defined in: [sys/mod.ts:1747](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1747)
21799
+ Defined in: [sys/mod.ts:1774](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1774)
21790
21800
 
21791
21801
  获取字段的可用语种文本
21792
21802
 
@@ -21814,7 +21824,7 @@ Defined in: [sys/mod.ts:1747](https://github.com/maiyunnet/kebab/blob/master/sys
21814
21824
 
21815
21825
  > **leftJoin**(`f`, `s`, `index?`, `pre?`): `this`
21816
21826
 
21817
- Defined in: [sys/mod.ts:1544](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1544)
21827
+ Defined in: [sys/mod.ts:1571](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1571)
21818
21828
 
21819
21829
  left join 方法
21820
21830
 
@@ -21854,7 +21864,7 @@ ON 信息
21854
21864
 
21855
21865
  > **limit**(`a`, `b?`): `this`
21856
21866
 
21857
- Defined in: [sys/mod.ts:1654](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1654)
21867
+ Defined in: [sys/mod.ts:1681](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1681)
21858
21868
 
21859
21869
  LIMIT
21860
21870
 
@@ -21882,7 +21892,7 @@ LIMIT
21882
21892
 
21883
21893
  > **page**(`count`, `page?`): `this`
21884
21894
 
21885
- Defined in: [sys/mod.ts:1665](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1665)
21895
+ Defined in: [sys/mod.ts:1692](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1692)
21886
21896
 
21887
21897
  分页
21888
21898
 
@@ -21910,7 +21920,7 @@ Defined in: [sys/mod.ts:1665](https://github.com/maiyunnet/kebab/blob/master/sys
21910
21920
 
21911
21921
  > **refresh**(`lock?`): `Promise`\<`boolean` \| `null`\>
21912
21922
 
21913
- Defined in: [sys/mod.ts:944](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L944)
21923
+ Defined in: [sys/mod.ts:950](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L950)
21914
21924
 
21915
21925
  刷新当前模型获取最新数据
21916
21926
 
@@ -21932,7 +21942,7 @@ Defined in: [sys/mod.ts:944](https://github.com/maiyunnet/kebab/blob/master/sys/
21932
21942
 
21933
21943
  > **remove**(): `Promise`\<`boolean`\>
21934
21944
 
21935
- Defined in: [sys/mod.ts:1001](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1001)
21945
+ Defined in: [sys/mod.ts:1007](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1007)
21936
21946
 
21937
21947
  移除本条目
21938
21948
 
@@ -21946,7 +21956,7 @@ Defined in: [sys/mod.ts:1001](https://github.com/maiyunnet/kebab/blob/master/sys
21946
21956
 
21947
21957
  > **rightJoin**(`f`, `s`, `index?`, `pre?`): `this`
21948
21958
 
21949
- Defined in: [sys/mod.ts:1556](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1556)
21959
+ Defined in: [sys/mod.ts:1583](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1583)
21950
21960
 
21951
21961
  right join 方法
21952
21962
 
@@ -21986,7 +21996,7 @@ ON 信息
21986
21996
 
21987
21997
  > **save**(`where?`): `Promise`\<`boolean`\>
21988
21998
 
21989
- Defined in: [sys/mod.ts:972](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L972)
21999
+ Defined in: [sys/mod.ts:978](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L978)
21990
22000
 
21991
22001
  更新 set 的数据到数据库,有未保存数据时才保存
21992
22002
 
@@ -22020,7 +22030,7 @@ Defined in: [sys/mod.ts:972](https://github.com/maiyunnet/kebab/blob/master/sys/
22020
22030
 
22021
22031
  > **set**\<`T`, `TK`\>(`n`): `void`
22022
22032
 
22023
- Defined in: [sys/mod.ts:777](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L777)
22033
+ Defined in: [sys/mod.ts:783](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L783)
22024
22034
 
22025
22035
  ##### Type Parameters
22026
22036
 
@@ -22046,7 +22056,7 @@ Defined in: [sys/mod.ts:777](https://github.com/maiyunnet/kebab/blob/master/sys/
22046
22056
 
22047
22057
  > **set**\<`T`, `TK`\>(`n`, `v`): `void`
22048
22058
 
22049
- Defined in: [sys/mod.ts:778](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L778)
22059
+ Defined in: [sys/mod.ts:784](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L784)
22050
22060
 
22051
22061
  ##### Type Parameters
22052
22062
 
@@ -22078,7 +22088,7 @@ Defined in: [sys/mod.ts:778](https://github.com/maiyunnet/kebab/blob/master/sys/
22078
22088
 
22079
22089
  > **toArray**\<`TC`\>(): [`TOnlyProperties`](../type-aliases/TOnlyProperties.md)\<`InstanceType`\<`TC`\>\> & `Record`\<`string`, `any`\>
22080
22090
 
22081
- Defined in: [sys/mod.ts:1719](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1719)
22091
+ Defined in: [sys/mod.ts:1746](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1746)
22082
22092
 
22083
22093
  获取值对象,获取的是新创建的数组
22084
22094
 
@@ -22098,7 +22108,7 @@ Defined in: [sys/mod.ts:1719](https://github.com/maiyunnet/kebab/blob/master/sys
22098
22108
 
22099
22109
  > **total**(`f?`): `Promise`\<`number`\>
22100
22110
 
22101
- Defined in: [sys/mod.ts:1472](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1472)
22111
+ Defined in: [sys/mod.ts:1499](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1499)
22102
22112
 
22103
22113
  获取总条数,自动抛弃 LIMIT,仅用于获取数据的情况(select)
22104
22114
 
@@ -22118,7 +22128,7 @@ Defined in: [sys/mod.ts:1472](https://github.com/maiyunnet/kebab/blob/master/sys
22118
22128
 
22119
22129
  > **union**(`f`, `type?`): `this`
22120
22130
 
22121
- Defined in: [sys/mod.ts:1074](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1074)
22131
+ Defined in: [sys/mod.ts:1080](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1080)
22122
22132
 
22123
22133
  联合查询表数据
22124
22134
 
@@ -22146,7 +22156,7 @@ Defined in: [sys/mod.ts:1074](https://github.com/maiyunnet/kebab/blob/master/sys
22146
22156
 
22147
22157
  > **unionAll**(`f`): `this`
22148
22158
 
22149
- Defined in: [sys/mod.ts:1104](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1104)
22159
+ Defined in: [sys/mod.ts:1110](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1110)
22150
22160
 
22151
22161
  所有联合查询表数据
22152
22162
 
@@ -22168,7 +22178,7 @@ Defined in: [sys/mod.ts:1104](https://github.com/maiyunnet/kebab/blob/master/sys
22168
22178
 
22169
22179
  > **unsaved**(): `boolean`
22170
22180
 
22171
- Defined in: [sys/mod.ts:1738](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1738)
22181
+ Defined in: [sys/mod.ts:1765](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1765)
22172
22182
 
22173
22183
  当前是否设置了未保存 --=
22174
22184
 
@@ -22182,7 +22192,7 @@ Defined in: [sys/mod.ts:1738](https://github.com/maiyunnet/kebab/blob/master/sys
22182
22192
 
22183
22193
  > **updates**(): `Record`\<`string`, `any`\>
22184
22194
 
22185
- Defined in: [sys/mod.ts:1727](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1727)
22195
+ Defined in: [sys/mod.ts:1754](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1754)
22186
22196
 
22187
22197
  获取当前设置要提交的数据
22188
22198
 
@@ -22196,7 +22206,7 @@ Defined in: [sys/mod.ts:1727](https://github.com/maiyunnet/kebab/blob/master/sys
22196
22206
 
22197
22207
  > **upsert**(`conflict`): `Promise`\<`boolean`\>
22198
22208
 
22199
- Defined in: [sys/mod.ts:914](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L914)
22209
+ Defined in: [sys/mod.ts:920](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L920)
22200
22210
 
22201
22211
  插入数据,如果存在则更新(UPSERT)
22202
22212
 
@@ -22218,7 +22228,7 @@ Defined in: [sys/mod.ts:914](https://github.com/maiyunnet/kebab/blob/master/sys/
22218
22228
 
22219
22229
  > **where**(`s`): `this`
22220
22230
 
22221
- Defined in: [sys/mod.ts:1621](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1621)
22231
+ Defined in: [sys/mod.ts:1648](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1648)
22222
22232
 
22223
22233
  是 filter 的别名
22224
22234
 
@@ -22240,7 +22250,7 @@ Defined in: [sys/mod.ts:1621](https://github.com/maiyunnet/kebab/blob/master/sys
22240
22250
 
22241
22251
  > `static` **column**(`field`): `object`
22242
22252
 
22243
- Defined in: [sys/mod.ts:168](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L168)
22253
+ Defined in: [sys/mod.ts:174](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L174)
22244
22254
 
22245
22255
  创建字段对象
22246
22256
 
@@ -22272,7 +22282,7 @@ Defined in: [sys/mod.ts:168](https://github.com/maiyunnet/kebab/blob/master/sys/
22272
22282
 
22273
22283
  > `static` **find**\<`T`\>(`db`, `val`, `opt?`): `Promise`\<`false` \| `T` & `Record`\<`string`, `any`\> \| `null`\>
22274
22284
 
22275
- Defined in: [sys/mod.ts:604](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L604)
22285
+ Defined in: [sys/mod.ts:610](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L610)
22276
22286
 
22277
22287
  根据主键(或 key 字段)获取对象
22278
22288
 
@@ -22332,7 +22342,7 @@ Defined in: [sys/mod.ts:604](https://github.com/maiyunnet/kebab/blob/master/sys/
22332
22342
 
22333
22343
  > `static` **getCreate**\<`T`\>(`db`, `opt?`): `T`
22334
22344
 
22335
- Defined in: [sys/mod.ts:586](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L586)
22345
+ Defined in: [sys/mod.ts:592](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L592)
22336
22346
 
22337
22347
  获取创建对象,通常用于新建数据库条目
22338
22348
 
@@ -22376,7 +22386,7 @@ Defined in: [sys/mod.ts:586](https://github.com/maiyunnet/kebab/blob/master/sys/
22376
22386
 
22377
22387
  > `static` **insert**(`db`, `cs`, `vs?`, `opt?`): `Promise`\<`boolean` \| `null`\>
22378
22388
 
22379
- Defined in: [sys/mod.ts:188](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L188)
22389
+ Defined in: [sys/mod.ts:194](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L194)
22380
22390
 
22381
22391
  添加一个序列(允许超过 65536 的占位符会被拆分多次执行)
22382
22392
 
@@ -22430,7 +22440,7 @@ Defined in: [sys/mod.ts:188](https://github.com/maiyunnet/kebab/blob/master/sys/
22430
22440
 
22431
22441
  > `static` **insertSql**(`db`, `cs`, `vs?`, `opt?`): `string`
22432
22442
 
22433
- Defined in: [sys/mod.ts:248](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L248)
22443
+ Defined in: [sys/mod.ts:254](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L254)
22434
22444
 
22435
22445
  获取添加一个序列的模拟 SQL
22436
22446
 
@@ -22484,7 +22494,7 @@ Defined in: [sys/mod.ts:248](https://github.com/maiyunnet/kebab/blob/master/sys/
22484
22494
 
22485
22495
  > `static` **json**(`obj`): `any`
22486
22496
 
22487
- Defined in: [sys/mod.ts:177](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L177)
22497
+ Defined in: [sys/mod.ts:183](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L183)
22488
22498
 
22489
22499
  创建 JSON 字符串对象,用于 PGSQL 的 jsonb 字段
22490
22500
 
@@ -22520,7 +22530,7 @@ Defined in: [sys/mod.ts:177](https://github.com/maiyunnet/kebab/blob/master/sys/
22520
22530
 
22521
22531
  > `static` **one**(`db`, `s`, `opt`): `Promise`\<`false` \| `Record`\<`string`, `any`\> \| `null`\>
22522
22532
 
22523
- Defined in: [sys/mod.ts:631](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L631)
22533
+ Defined in: [sys/mod.ts:637](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L637)
22524
22534
 
22525
22535
  ##### Parameters
22526
22536
 
@@ -22566,7 +22576,7 @@ Defined in: [sys/mod.ts:631](https://github.com/maiyunnet/kebab/blob/master/sys/
22566
22576
 
22567
22577
  > `static` **one**\<`T`\>(`db`, `s`, `opt`): `Promise`\<`false` \| `T` & `Record`\<`string`, `any`\> \| `null`\>
22568
22578
 
22569
- Defined in: [sys/mod.ts:643](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L643)
22579
+ Defined in: [sys/mod.ts:649](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L649)
22570
22580
 
22571
22581
  ##### Type Parameters
22572
22582
 
@@ -22620,7 +22630,7 @@ Defined in: [sys/mod.ts:643](https://github.com/maiyunnet/kebab/blob/master/sys/
22620
22630
 
22621
22631
  > `static` **oneArray**(`db`, `s`, `opt?`): `Promise`\<`false` \| `Record`\<`string`, `any`\> \| `null`\>
22622
22632
 
22623
- Defined in: [sys/mod.ts:718](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L718)
22633
+ Defined in: [sys/mod.ts:724](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L724)
22624
22634
 
22625
22635
  通过 where 条件筛选单条数据返回原生对象
22626
22636
 
@@ -22668,7 +22678,7 @@ Defined in: [sys/mod.ts:718](https://github.com/maiyunnet/kebab/blob/master/sys/
22668
22678
 
22669
22679
  > `static` **primarys**(`db`, `where?`, `opt?`): `Promise`\<`false` \| `any`[]\>
22670
22680
 
22671
- Defined in: [sys/mod.ts:738](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L738)
22681
+ Defined in: [sys/mod.ts:744](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L744)
22672
22682
 
22673
22683
  根据 where 条件获取主键值列表
22674
22684
 
@@ -22712,7 +22722,7 @@ where 条件
22712
22722
 
22713
22723
  > `static` **removeByWhere**(`db`, `where`, `opt?`): `Promise`\<`number` \| `false` \| `null`\>
22714
22724
 
22715
- Defined in: [sys/mod.ts:274](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L274)
22725
+ Defined in: [sys/mod.ts:280](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L280)
22716
22726
 
22717
22727
  根据条件移除条目
22718
22728
 
@@ -22764,7 +22774,7 @@ Defined in: [sys/mod.ts:274](https://github.com/maiyunnet/kebab/blob/master/sys/
22764
22774
 
22765
22775
  > `static` **removeByWhereSql**(`db`, `where`, `opt?`): [`Sql`](../../../lib/sql/classes/Sql.md)
22766
22776
 
22767
- Defined in: [sys/mod.ts:318](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L318)
22777
+ Defined in: [sys/mod.ts:324](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L324)
22768
22778
 
22769
22779
  根据条件移除条目(仅获取 SQL 对象)
22770
22780
 
@@ -22816,7 +22826,7 @@ Defined in: [sys/mod.ts:318](https://github.com/maiyunnet/kebab/blob/master/sys/
22816
22826
 
22817
22827
  > `static` **select**\<`T`\>(`db`, `c`, `opt?`): `T` & `Record`\<`string`, `any`\>
22818
22828
 
22819
- Defined in: [sys/mod.ts:527](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L527)
22829
+ Defined in: [sys/mod.ts:533](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L533)
22820
22830
 
22821
22831
  select 自定字段
22822
22832
 
@@ -22882,7 +22892,7 @@ select 自定字段
22882
22892
 
22883
22893
  > `static` **toArrayByRecord**\<`T`\>(`obj`): `Record`\<`string`, `Record`\<`string`, `any`\>\>
22884
22894
 
22885
- Defined in: [sys/mod.ts:765](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L765)
22895
+ Defined in: [sys/mod.ts:771](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L771)
22886
22896
 
22887
22897
  将 key val 组成的数据列表转换为原生对象模式,获取的是新创建的数组
22888
22898
 
@@ -22910,7 +22920,7 @@ Defined in: [sys/mod.ts:765](https://github.com/maiyunnet/kebab/blob/master/sys/
22910
22920
 
22911
22921
  > `static` **updateByWhere**(`db`, `data`, `where`, `opt?`): `Promise`\<`number` \| `false` \| `null`\>
22912
22922
 
22913
- Defined in: [sys/mod.ts:351](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L351)
22923
+ Defined in: [sys/mod.ts:357](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L357)
22914
22924
 
22915
22925
  根据条件更新数据
22916
22926
 
@@ -22968,7 +22978,7 @@ Defined in: [sys/mod.ts:351](https://github.com/maiyunnet/kebab/blob/master/sys/
22968
22978
 
22969
22979
  > `static` **updateByWhereSql**(`db`, `data`, `where`, `opt?`): [`Sql`](../../../lib/sql/classes/Sql.md)
22970
22980
 
22971
- Defined in: [sys/mod.ts:397](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L397)
22981
+ Defined in: [sys/mod.ts:403](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L403)
22972
22982
 
22973
22983
  根据条件更新数据(仅获取 SQL 对象)
22974
22984
 
@@ -23026,7 +23036,7 @@ Defined in: [sys/mod.ts:397](https://github.com/maiyunnet/kebab/blob/master/sys/
23026
23036
 
23027
23037
  > `static` **updateList**(`db`, `data`, `key`, `opt?`): `Promise`\<`boolean` \| `null`\>
23028
23038
 
23029
- Defined in: [sys/mod.ts:431](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L431)
23039
+ Defined in: [sys/mod.ts:437](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L437)
23030
23040
 
23031
23041
  批量更新数据
23032
23042
 
@@ -23076,7 +23086,7 @@ Defined in: [sys/mod.ts:431](https://github.com/maiyunnet/kebab/blob/master/sys/
23076
23086
 
23077
23087
  > `static` **where**\<`T`\>(`db`, `s?`, `opt?`): `T` & `Record`\<`string`, `any`\>
23078
23088
 
23079
- Defined in: [sys/mod.ts:557](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L557)
23089
+ Defined in: [sys/mod.ts:563](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L563)
23080
23090
 
23081
23091
  通过 where 条件获取模型
23082
23092
 
@@ -23341,7 +23351,7 @@ sys/mod/interfaces/IModUnionItem.md
23341
23351
 
23342
23352
  # Interface: IModUnionItem
23343
23353
 
23344
- Defined in: [sys/mod.ts:1781](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1781)
23354
+ Defined in: [sys/mod.ts:1808](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1808)
23345
23355
 
23346
23356
  ## Properties
23347
23357
 
@@ -23349,7 +23359,7 @@ Defined in: [sys/mod.ts:1781](https://github.com/maiyunnet/kebab/blob/master/sys
23349
23359
 
23350
23360
  > **field**: `string`
23351
23361
 
23352
- Defined in: [sys/mod.ts:1782](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1782)
23362
+ Defined in: [sys/mod.ts:1809](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1809)
23353
23363
 
23354
23364
  ***
23355
23365
 
@@ -23357,7 +23367,7 @@ Defined in: [sys/mod.ts:1782](https://github.com/maiyunnet/kebab/blob/master/sys
23357
23367
 
23358
23368
  > `optional` **where**: `any`
23359
23369
 
23360
- Defined in: [sys/mod.ts:1783](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1783)
23370
+ Defined in: [sys/mod.ts:1810](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1810)
23361
23371
 
23362
23372
  sys/mod/interfaces/IRows.md
23363
23373
  ---
@@ -23370,7 +23380,7 @@ sys/mod/interfaces/IRows.md
23370
23380
 
23371
23381
  # Interface: IRows\<T\>
23372
23382
 
23373
- Defined in: [sys/mod.ts:1775](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1775)
23383
+ Defined in: [sys/mod.ts:1802](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1802)
23374
23384
 
23375
23385
  ## Extends
23376
23386
 
@@ -23388,7 +23398,7 @@ Defined in: [sys/mod.ts:1775](https://github.com/maiyunnet/kebab/blob/master/sys
23388
23398
 
23389
23399
  > `readonly` **length**: `number`
23390
23400
 
23391
- Defined in: [sys/mod.ts:1776](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1776)
23401
+ Defined in: [sys/mod.ts:1803](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1803)
23392
23402
 
23393
23403
  ## Methods
23394
23404
 
@@ -23396,7 +23406,7 @@ Defined in: [sys/mod.ts:1776](https://github.com/maiyunnet/kebab/blob/master/sys
23396
23406
 
23397
23407
  > **item**(`index`): `T`
23398
23408
 
23399
- Defined in: [sys/mod.ts:1777](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1777)
23409
+ Defined in: [sys/mod.ts:1804](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1804)
23400
23410
 
23401
23411
  #### Parameters
23402
23412
 
@@ -23414,7 +23424,7 @@ Defined in: [sys/mod.ts:1777](https://github.com/maiyunnet/kebab/blob/master/sys
23414
23424
 
23415
23425
  > **toArray**(): `Record`\<`string`, `any`\>[]
23416
23426
 
23417
- Defined in: [sys/mod.ts:1778](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1778)
23427
+ Defined in: [sys/mod.ts:1805](https://github.com/maiyunnet/kebab/blob/master/sys/mod.ts#L1805)
23418
23428
 
23419
23429
  #### Returns
23420
23430
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "8.5.1";
8
+ export declare const VER = "8.5.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 = '8.5.1';
9
+ export const VER = '8.5.3';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/lib/sql.js CHANGED
@@ -687,16 +687,32 @@ export class Sql {
687
687
  const sql = lCore.clone(this._sql);
688
688
  const data = lCore.clone(this._data);
689
689
  if (opt.where !== undefined) {
690
+ let found = false;
690
691
  if (typeof opt.where === 'string') {
691
692
  // --- string ---
692
693
  for (let i = 0; i < sql.length; ++i) {
693
694
  if (!sql[i].startsWith(' WHERE ')) {
694
695
  continue;
695
696
  }
697
+ found = true;
696
698
  sql[i] = opt.where ? (' WHERE ' + opt.where) : '';
697
699
  data.splice(this._whereDataPosition[0], this._whereDataPosition[1] - this._whereDataPosition[0]);
698
700
  break;
699
701
  }
702
+ if (!found && opt.where) {
703
+ // --- 没找到原来的且现在要加(有可能 opt.where 是空字符串,所以这里必须判断一次) ---
704
+ let index = sql.length;
705
+ for (let i = 0; i < sql.length; ++i) {
706
+ if (sql[i].startsWith(' ORDER BY ') ||
707
+ sql[i].startsWith(' GROUP BY ') ||
708
+ sql[i].startsWith(' LIMIT ') ||
709
+ sql[i].startsWith(' FOR UPDATE')) {
710
+ index = i;
711
+ break;
712
+ }
713
+ }
714
+ sql.splice(index, 0, ' WHERE ' + opt.where);
715
+ }
700
716
  }
701
717
  else {
702
718
  // --- array ---
@@ -716,6 +732,7 @@ export class Sql {
716
732
  if (!sql[i].startsWith(' WHERE ')) {
717
733
  continue;
718
734
  }
735
+ found = true;
719
736
  if (go) {
720
737
  // --- 修改 where ---
721
738
  const d = [];
@@ -729,6 +746,22 @@ export class Sql {
729
746
  }
730
747
  break;
731
748
  }
749
+ if (!found && go) {
750
+ // --- 没找到原来的且现在要加 ---
751
+ let index = sql.length;
752
+ for (let i = 0; i < sql.length; ++i) {
753
+ if (sql[i].startsWith(' ORDER BY ') ||
754
+ sql[i].startsWith(' GROUP BY ') ||
755
+ sql[i].startsWith(' LIMIT ') ||
756
+ sql[i].startsWith(' FOR UPDATE')) {
757
+ index = i;
758
+ break;
759
+ }
760
+ }
761
+ const d = [];
762
+ sql.splice(index, 0, ' WHERE ' + this._whereSub(opt.where, d));
763
+ data.push(...d);
764
+ }
732
765
  }
733
766
  }
734
767
  // --- 替换表名 ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "8.5.1",
3
+ "version": "8.5.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/child.js CHANGED
@@ -118,9 +118,8 @@ async function run() {
118
118
  const host = (req.headers[':authority'] ?? req.headers['host'] ?? '');
119
119
  if (!host) {
120
120
  lCore.writeHead(res, 403);
121
- res.end('403 Forbidden', () => {
122
- req.socket.destroy();
123
- });
121
+ // --- 不能用 req.socket.destroy() 可能会导致底层复用(如 CDN) 的连接被直接断开 ---
122
+ res.end('403 Forbidden');
124
123
  return;
125
124
  }
126
125
  wrapWithLinkCount(host + req.url, () => requestHandler(req, res, true), '[CHILD][http2][request]', req.method ?? 'GET');
@@ -139,14 +138,17 @@ async function run() {
139
138
  if (!host) {
140
139
  res.setHeader('x-kebab-error', '0');
141
140
  lCore.writeHead(res, 403);
142
- res.end('403 Forbidden', () => {
143
- req.socket.destroy();
144
- });
141
+ // --- 不能用 req.socket.destroy() 可能会导致底层复用(如 CDN) 的连接被直接断开 ---
142
+ res.end('403 Forbidden');
145
143
  return;
146
144
  }
147
145
  wrapWithLinkCount(host + (req.url ?? ''), () => requestHandler(req, res, false), '[CHILD][http][request]', req.method ?? 'GET');
148
146
  }).on('clientError', (err, socket) => {
149
- socket.destroy();
147
+ // --- 不能用 socket.destroy() 可能会导致底层复用(如 CDN) 的连接被直接断开 ---
148
+ if (err.code === 'ECONNRESET' || !socket.writable) {
149
+ return;
150
+ }
151
+ socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
150
152
  }).on('upgrade', function (req, socket, head) {
151
153
  const host = (req.headers['host'] ?? '');
152
154
  if (!host) {
@@ -195,7 +197,7 @@ async function requestHandler(req, res, https) {
195
197
  host = req.headers['host'];
196
198
  }
197
199
  if (host === undefined) {
198
- res.end();
200
+ res.end('403 Forbidden');
199
201
  return;
200
202
  }
201
203
  const hostInfo = lText.parseHost(host);
@@ -210,9 +212,8 @@ async function requestHandler(req, res, https) {
210
212
  if (!vhost) {
211
213
  res.setHeader('x-kebab-error', '1');
212
214
  lCore.writeHead(res, 403);
213
- res.end('403 Forbidden', () => {
214
- req.socket.destroy();
215
- });
215
+ // --- 不能用 req.socket.destroy() 可能会导致底层复用(如 CDN) 的连接被直接断开 ---
216
+ res.end('403 Forbidden');
216
217
  return;
217
218
  /*
218
219
  const text = '<h1>Kebab: No permissions</h1>host: ' + (req.headers[':authority'] as string | undefined ?? req.headers['host'] ?? '') + '<br>url: ' + (lText.htmlescape(req.url ?? ''));
@@ -358,7 +359,7 @@ async function upgradeHandler(req, socket, https, head) {
358
359
  /** --- 当前的 vhost 配置文件 --- */
359
360
  const vhost = await getVhostByHostname(uri.hostname ?? '');
360
361
  if (!vhost) {
361
- socket.destroy();
362
+ socket.end();
362
363
  return;
363
364
  }
364
365
  /** --- 请求的路径部分,前导带 / 末尾不一定,用户怎么请求就是什么 --- */
@@ -378,7 +379,7 @@ async function upgradeHandler(req, socket, https, head) {
378
379
  /** --- 'abc' / 'def.json' --- */
379
380
  let stat = await lFs.stats(vhost.real + now + item);
380
381
  if (!stat) {
381
- socket.destroy();
382
+ socket.end();
382
383
  return;
383
384
  }
384
385
  if (stat.isDirectory()) {
@@ -402,7 +403,7 @@ async function upgradeHandler(req, socket, https, head) {
402
403
  }
403
404
  else {
404
405
  // --- 文件,报错 ---
405
- socket.destroy();
406
+ socket.end();
406
407
  return;
407
408
  }
408
409
  }
@@ -430,7 +431,7 @@ async function upgradeHandler(req, socket, https, head) {
430
431
  }
431
432
  }
432
433
  // --- 最后一层,又不是动态层 ---
433
- socket.destroy();
434
+ socket.end();
434
435
  }
435
436
  /**
436
437
  * --- 加载/重载 vhosts 信息、重新加载全局 config、重新加载证书。(清除动态 kebab.json 信息、data 信息、语言包信息) ---
package/sys/mod.d.ts CHANGED
@@ -61,6 +61,8 @@ export default class Mod {
61
61
  protected _sql: lSql.Sql;
62
62
  /** --- ctr 对象 --- */
63
63
  protected _ctr?: sCtr.Ctr;
64
+ /** --- 主表筛选前缀,优先 alias,其次表名 --- */
65
+ protected _fieldPrefix: string;
64
66
  /**
65
67
  * --- 构造函数 ---
66
68
  * @param opt 选项
@@ -335,6 +337,8 @@ export default class Mod {
335
337
  allArray(key: string): Promise<false | Record<string, Record<string, any>>>;
336
338
  explain(all?: false): Promise<false | string>;
337
339
  explain(all: true): Promise<false | Record<string, any>>;
340
+ /** --- 获取 contain 补查时使用的 where key(联表且无前缀时自动补主表前缀) --- */
341
+ private _getContainWhereKey;
338
342
  private _formatTotal;
339
343
  /**
340
344
  * --- 获取总条数,自动抛弃 LIMIT,仅用于获取数据的情况(select) ---
package/sys/mod.js CHANGED
@@ -72,6 +72,8 @@ export default class Mod {
72
72
  _sql;
73
73
  /** --- ctr 对象 --- */
74
74
  _ctr = undefined;
75
+ /** --- 主表筛选前缀,优先 alias,其次表名 --- */
76
+ _fieldPrefix = '';
75
77
  /**
76
78
  * --- 构造函数 ---
77
79
  * @param opt 选项
@@ -103,8 +105,10 @@ export default class Mod {
103
105
  }
104
106
  /** --- 是否有 select --- */
105
107
  const select = opt.select ?? (opt.where ? '*' : '');
106
- this._sql.select(select, this.constructor._$table +
107
- (this._index !== null ? ('_' + this._index[0]) : '') +
108
+ const table = this.constructor._$table +
109
+ (this._index !== null ? ('_' + this._index[0]) : '');
110
+ this._fieldPrefix = opt.alias ?? table;
111
+ this._sql.select(select, table +
108
112
  (opt.alias ? ' ' + opt.alias : ''));
109
113
  if (opt.where !== undefined) {
110
114
  this._sql.where(opt.where);
@@ -955,10 +959,13 @@ export default class Mod {
955
959
  if (this._contain && contain?.length) {
956
960
  const csql = this._sql.copy(undefined, {
957
961
  'where': {
958
- [this._contain.key]: contain,
962
+ [this._getContainWhereKey()]: contain,
959
963
  }
960
964
  });
961
965
  cr = await this._db.query(csql.getSql(), csql.getData());
966
+ if (cr.rows === null) {
967
+ lCore.log(this._ctr ?? {}, '[MOD][all] ' + (lText.stringifyJson(cr.error?.message ?? '').slice(1, -1) + ' - ' + csql.format()).replaceAll('"', '""'), '-error');
968
+ }
962
969
  }
963
970
  if (key) {
964
971
  const list = {};
@@ -1103,10 +1110,13 @@ export default class Mod {
1103
1110
  if (this._contain && contain?.length) {
1104
1111
  const csql = this._sql.copy(undefined, {
1105
1112
  'where': {
1106
- [this._contain.key]: contain,
1113
+ [this._getContainWhereKey()]: contain,
1107
1114
  }
1108
1115
  });
1109
1116
  cr = await this._db.query(csql.getSql(), csql.getData());
1117
+ if (cr.rows === null) {
1118
+ lCore.log(this._ctr ?? {}, '[MOD][allArray] ' + (lText.stringifyJson(cr.error?.message ?? '').slice(1, -1) + ' - ' + csql.format()).replaceAll('"', '""'), '-error');
1119
+ }
1110
1120
  }
1111
1121
  if (key) {
1112
1122
  const list = {};
@@ -1154,6 +1164,20 @@ export default class Mod {
1154
1164
  'filter': r.rows[1]['QUERY PLAN'],
1155
1165
  };
1156
1166
  }
1167
+ /** --- 获取 contain 补查时使用的 where key(联表且无前缀时自动补主表前缀) --- */
1168
+ _getContainWhereKey() {
1169
+ if (!this._contain) {
1170
+ return '';
1171
+ }
1172
+ if (this._contain.key.includes('.')) {
1173
+ return this._contain.key;
1174
+ }
1175
+ // --- 有 join 时统一补前缀,兼容 pgsql 并保持 mysql 行为一致 ---
1176
+ if (!/\sJOIN\s/i.test(this._sql.getSql())) {
1177
+ return this._contain.key;
1178
+ }
1179
+ return `${this._fieldPrefix}.${this._contain.key}`;
1180
+ }
1157
1181
  _formatTotal(sql, f = '*') {
1158
1182
  const q = this._db.getService() === lDb.ESERVICE.MYSQL ? '`' : '"';
1159
1183
  sql = sql
@@ -1035,23 +1035,43 @@ const res2 = await test2.upsert('name');</pre>Result: ${res2}<br><br>`);
1035
1035
  }) : lDb.get(this);
1036
1036
  echo.push('<br><br><b>Testing mod.contain with leftJoin and AS clauses:</b><br>');
1037
1037
  const pre = this._get['s'] === 'pgsql' ? 'm' : undefined;
1038
- const q = mTest.select(db, [
1038
+ const index = this._get['s'] === 'pgsql' ? undefined : '0';
1039
+ const q1 = mTest.select(db, [
1040
+ 'a.id', 'a.name', 'a.token', 'g.content', 'a.time_add'
1041
+ ], {
1042
+ 'ctr': this,
1043
+ 'alias': 'a',
1044
+ 'contain': {
1045
+ 'key': 'token',
1046
+ 'list': ['test_0', 'test_3', 'test_10']
1047
+ },
1048
+ 'pre': pre,
1049
+ }).leftJoin('test_data g', {
1050
+ 'a.id': mTest.column('g.test_id')
1051
+ }, index).limit(2);
1052
+ const rows1 = await q1.allArray();
1053
+ echo.push('<b>Case 1: contain.key = token (without prefix)</b>');
1054
+ echo.push(`<pre><b>SQL generated:</b>\n<code>${q1.getSql()}</code></pre>`);
1055
+ echo.push('<b>Result Data:</b>');
1056
+ echo.push(`<pre><code>${lText.stringifyJson(rows1, 4)}</code></pre>`);
1057
+ const q2 = mTest.select(db, [
1039
1058
  'a.id', 'a.name', 'a.token', 'g.content', 'a.time_add'
1040
1059
  ], {
1041
1060
  'ctr': this,
1042
1061
  'alias': 'a',
1043
1062
  'contain': {
1044
1063
  'key': 'a.token',
1045
- 'list': ['ul_token_0', 'ul_token_1']
1064
+ 'list': ['test_0', 'test_3', 'test_10']
1046
1065
  },
1047
1066
  'pre': pre,
1048
- }).leftJoin('testdata g', {
1067
+ }).leftJoin('test_data g', {
1049
1068
  'a.id': mTest.column('g.test_id')
1050
- }, undefined, pre).limit(2);
1051
- echo.push(`<pre><b>SQL generated:</b>\n<code>${q.getSql()}</code></pre>`);
1052
- const rows = await q.allArray('id');
1069
+ }, index).limit(2);
1070
+ const rows2 = await q2.allArray();
1071
+ echo.push('<b>Case 2: contain.key = a.token (with prefix)</b>');
1072
+ echo.push(`<pre><b>SQL generated:</b>\n<code>${q2.getSql()}</code></pre>`);
1053
1073
  echo.push('<b>Result Data:</b>');
1054
- echo.push(`<pre><code>${lText.stringifyJson(rows, 4)}</code></pre>`);
1074
+ echo.push(`<pre><code>${lText.stringifyJson(rows2, 4)}</code></pre>`);
1055
1075
  return echo.join('') + '<br>' + this._getEnd();
1056
1076
  }
1057
1077
  captchaFastbuild() {