When using the date.Date type with the database/sql package, I get errors like error: scanning database row: sql: Scan error on column index 3: unsupported Scan, storing driver.Value type time.Time into type *date.Date or Unable to encode value 2019-01-02
This can be easily solved by implementing both the driver.Valuer and sql.Scanner interfaces.
When using the
date.Datetype with thedatabase/sqlpackage, I get errors likeerror: scanning database row: sql: Scan error on column index 3: unsupported Scan, storing driver.Value type time.Time into type *date.DateorUnable to encode value 2019-01-02This can be easily solved by implementing both the
driver.Valuerandsql.Scannerinterfaces.