I have a table named package_redeem and a field called expire_at with type TIMESTAMP
my Go method to retrieve value is as follow
// RetrieveRedeemRecord will Retrieve a RedeemCode Record by Code; R of CRUD
func RetrieveRedeemRecord(code string) (anyError error) {
var thisWorks mysql.NullTime
var thisOneNotWork sql.NullTime
stmtStr := `SELECT expire_at FROM package_redeem WHERE code=?`
anyError = dbhelper.GetDB().QueryRow(stmtStr, code).Scan(&thisOneNotWork)
switch anyError {
case nil:
case sql.ErrNoRows:
log.Println("no row found with ", code)
default:
log.Panic("errRow(s) ", anyError.Error())
}
return anyError
}
Weird thing is that using type sql.NullTime will panic!
panic: errRow(s) sql: Scan error on column index 5, name "updated_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time [recovered]
panic: errRow(s) sql: Scan error on column index 5, name "updated_at": unsupported Scan, storing driver.Value type []uint8 into type *time.Time
But using type mysql.NullTime would work, I thought since Go1.3 that mysql.NullTime is just sql.NullTime. Am I missing something here?