Files
mtusi2026lab5/internal/storage/postgres/mapping.go
T
2026-10-29 23:36:12 +03:00

22 lines
318 B
Go

package postgres
import "time"
func toUTCTime(t time.Time) time.Time {
if t.Location() == time.UTC {
return t
}
return t.UTC()
}
func mapAll[S, D any](rows []S, mapRow func(S) D) []D {
mapped := make([]D, 0, len(rows))
for _, row := range rows {
mapped = append(mapped, mapRow(row))
}
return mapped
}