-
-
Notifications
You must be signed in to change notification settings - Fork 984
Description
I was migrating my project to v5 today and I hit a roadblock. I was trying to move from Tstzrange to the Range[Timestamptz] generic interface but my tests were failing with:
name "systime": unsupported Scan, storing driver.Value type string into type *pgtype.Range[github.com/jackc/pgx/v5/pgtype.Timestamptz]
for my struct
type TelemetryMapHistory struct { HistoryID uint 'gorm:"primarykey"' Systime pgtype.Range[pgtype.Timestamptz] 'gorm:"not null; type:tstzrange"' ... }
So I did some digging and found that the Range type does not implement the scan interface.
so I made my own type and implemented it myself and it works.
type Tstzrange pgtype.Range[pgtype.Timestamptz]
It seems as though this has been asked for in the past (#2421) but was denied due to upcoming golang changes (#2403) which are now no longer happening. Am I doing something wrong here? Is it expected that any users who want to use range types have to implement these functions themselves?