Skip to content

Commit c832c96

Browse files
authored
docs(mysql): Document parseTimet=true requirement (#2699)
1 parent b6f785f commit c832c96

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/tutorials/getting-started-mysql.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ import (
9999
func 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

156156
To make that possible, sqlc generates readable, **idiomatic** Go code that you
157157
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.

0 commit comments

Comments
 (0)