Skip to content

Instantly share code, notes, and snippets.

@plutov
Created August 21, 2018 05:05
Show Gist options
  • Save plutov/7755871af7ac99b095e887ad55e0b28c to your computer and use it in GitHub Desktop.
Save plutov/7755871af7ac99b095e887ad55e0b28c to your computer and use it in GitHub Desktop.
working-with-db-time-in-go1.go
var nt mysql.NullTime
err := db.QueryRow("SELECT time FROM foo WHERE id = ?", id).Scan(&nt)
if nt.Valid {
// use nt.Time
} else {
// NULL value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment