fix: scan timestamptz into time.Time in users repository

Same pgx v5 binary protocol issue as admin service — created_at
in transactions cannot be scanned into *string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
emil
2026-05-01 17:10:41 +03:00
co-authored by Claude Sonnet 4.6
parent e2e8afd07a
commit 094c8953b6
+4 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"time"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
@@ -95,9 +96,11 @@ func (r *Repository) ListTransactions(ctx context.Context, userID string, limit,
var txs []Transaction
for rows.Next() {
var t Transaction
if err := rows.Scan(&t.ID, &t.Amount, &t.Type, &t.Description, &t.PartnerID, &t.CreatedAt); err != nil {
var createdAt time.Time
if err := rows.Scan(&t.ID, &t.Amount, &t.Type, &t.Description, &t.PartnerID, &createdAt); err != nil {
return nil, fmt.Errorf("repository.ListTransactions: scan: %w", err)
}
t.CreatedAt = createdAt.UTC().Format(time.RFC3339)
txs = append(txs, t)
}
if err := rows.Err(); err != nil {