Can,t retrieve an date column from mysql db using golang?

Given mysql db:

golang code:
connection to mysql db

query all customers

printing the query

error after running query

As I understand the error, you have a NULL in the table and try to parse that as a date, which you can’t.

You can use sql.NullString instead of string type.

https://golang.org/pkg/database/sql/#NullString

But also look at sqlx package which allows to extract values to structs instead of multiple variables.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.