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 (
9999func run() error {
100100 ctx := context.Background()
101101
102- db, err := sql.Open("mysql", "user:password@/dbname")
102+ db, err := sql.Open("mysql", "user:password@/dbname?parseTime=true ")
103103 if err != nil {
104104 return err
105105 }
@@ -155,3 +155,8 @@ go build ./...
155155
156156To make that possible, sqlc generates readable, ** idiomatic** Go code that you
157157otherwise 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