fix(仓储): 修复 BatchUpdateLastUsed 时间戳类型不匹配

在原生 SQL 的 CASE WHEN 语句中,PostgreSQL 无法自动推断占位符参数类型,
导致 time.Time 被当作 text 类型处理,与 last_used_at 列的 timestamptz 类型不匹配。

添加显式类型转换 ::timestamptz 解决此问题。
This commit is contained in:
shaw
2025-12-30 23:11:49 +08:00
parent 1ecef269f7
commit 4319cf7f31

View File

@@ -334,7 +334,7 @@ func (r *accountRepository) BatchUpdateLastUsed(ctx context.Context, updates map
idx := 1
for id, ts := range updates {
caseSQL += " WHEN $" + itoa(idx) + " THEN $" + itoa(idx+1)
caseSQL += " WHEN $" + itoa(idx) + " THEN $" + itoa(idx+1) + "::timestamptz"
args = append(args, id, ts)
ids = append(ids, id)
idx += 2