I have the following Google Go and MySql, where the date_update
field in question often comes back as a NULL
value.
var date_update time.Time
query := `SELECT date_update FROM users WHERE user_id=?`
err := conn.QueryRow(query, user_id).Scan(&date_update)
When I run this query and happen to receive one of the null values for the field, I receive the error unsupported driver -> Scan pair: <nil> -> *time.Time
The way I handle this with other data types (for example INT
) is with
SELECT IFNULL(integer_field, 0) FROM table
But it doesn't seem to work with timestamps or datetime. Any ideas?