@lark-apaas/coding-steering 0.1.55 → 0.1.57
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/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/coding-steering",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"description": "Stack-specific steering content for miaoda-coding templates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"steering"
|
|
8
8
|
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
|
|
11
|
-
},
|
|
12
9
|
"devDependencies": {
|
|
13
10
|
"markdownlint-cli": "^0.47.0"
|
|
14
11
|
},
|
|
@@ -20,5 +17,8 @@
|
|
|
20
17
|
"miaoda",
|
|
21
18
|
"coding-steering"
|
|
22
19
|
],
|
|
23
|
-
"license": "MIT"
|
|
24
|
-
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"lint:md": "markdownlint 'steering/**/*.md' --ignore 'steering/**/skills/**' --ignore 'steering/**/skills_common/**' --ignore 'steering/**/skills_local/**'"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -359,7 +359,15 @@ await db.select().from(users).where(eq(users.adminUser, userId));
|
|
|
359
359
|
| 按月 / 按天筛 date、timestamptz | 半开区间 `and(gte(col, "2026-08-01"), lt(col, "2026-09-01"))`;日期列不能用 `like(col, "2026-08%")` |
|
|
360
360
|
| 数字列过滤(`@Query` 取到的是 string) | 先 `Number(q)` 再进 `eq` |
|
|
361
361
|
|
|
362
|
-
-
|
|
362
|
+
- **区分 Drizzle helper 与原生 SQL `COUNT()`**:当前模板的 `drizzle-orm@0.44.6` 中,`count()` helper 返回 `number`;原生 SQL `COUNT()` 返回 PostgreSQL `bigint`,驱动结果可能是 `string`。需要保留超过 `Number.MAX_SAFE_INTEGER` 的精确值时,使用 `BigInt` 或保留字符串,不要转成 `Number`。
|
|
363
|
+
|
|
364
|
+
```typescript
|
|
365
|
+
const [{ total }] = await db.select({ total: count() }).from(users); // total: number
|
|
366
|
+
|
|
367
|
+
const rawTotal = '9007199254740993';
|
|
368
|
+
const exactTotal = BigInt(rawTotal); // ✅ 9007199254740993n
|
|
369
|
+
const unsafeTotal = Number(rawTotal); // ❌ 9007199254740992,精度丢失
|
|
370
|
+
```
|
|
363
371
|
|
|
364
372
|
- **UUID 多值过滤不要直接插值数组到 `ANY(...::uuid[])`**:在 sql 模板中直接插入 ids 这类 JS 数组,可能被展开成 `($1, $2, ...)::uuid[]`,运行时报 `42846: cannot cast type record to uuid[]`。
|
|
365
373
|
|
|
@@ -316,7 +316,15 @@ await db.select().from(users).where(eq(users.adminUser, userId));
|
|
|
316
316
|
|
|
317
317
|
### 使用侧边界陷阱
|
|
318
318
|
|
|
319
|
-
-
|
|
319
|
+
- **区分 Drizzle helper 与原生 SQL `COUNT()`**:当前模板的 `drizzle-orm@0.44.6` 中,`count()` helper 返回 `number`;原生 SQL `COUNT()` 返回 PostgreSQL `bigint`,驱动结果可能是 `string`。需要保留超过 `Number.MAX_SAFE_INTEGER` 的精确值时,使用 `BigInt` 或保留字符串,不要转成 `Number`。
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
const [{ total }] = await db.select({ total: count() }).from(users); // total: number
|
|
323
|
+
|
|
324
|
+
const rawTotal = '9007199254740993';
|
|
325
|
+
const exactTotal = BigInt(rawTotal); // ✅ 9007199254740993n
|
|
326
|
+
const unsafeTotal = Number(rawTotal); // ❌ 9007199254740992,精度丢失
|
|
327
|
+
```
|
|
320
328
|
|
|
321
329
|
- **UUID 列 `inArray` 必须显式 `::uuid[]`**:标准 `inArray(col, ids)` 会运行时报 `42809: op ANY/ALL (array) requires array on right side`。
|
|
322
330
|
|