File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ import (
99
99
func run() error {
100
100
ctx := context.Background()
101
101
102
- db, err := sql.Open("mysql", "user:password@/dbname")
102
+ db, err := sql.Open("mysql", "user:password@/dbname?parseTime=true ")
103
103
if err != nil {
104
104
return err
105
105
}
@@ -155,3 +155,8 @@ go build ./...
155
155
156
156
To make that possible, sqlc generates readable, ** idiomatic** Go code that you
157
157
otherwise would have had to write yourself. Take a look in ` tutorial/query.sql.go ` .
158
+
159
+ If your tables have columns with date or time types, sqlc expects these values
160
+ to scan into ` time.Time ` structs. If you're using
161
+ ` github.com/go-sql-driver/mysql ` , ensure that ` parseTime=true ` has been added to
162
+ the connection string.
You can’t perform that action at this time.
0 commit comments