Skip to content

Commit

Permalink
docs(mysql): Document parseTimet=true requirement (#2699)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy authored Sep 6, 2023
1 parent b6f785f commit c832c96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/tutorials/getting-started-mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ import (
func run() error {
ctx := context.Background()
db, err := sql.Open("mysql", "user:password@/dbname")
db, err := sql.Open("mysql", "user:password@/dbname?parseTime=true")
if err != nil {
return err
}
Expand Down Expand Up @@ -155,3 +155,8 @@ go build ./...

To make that possible, sqlc generates readable, **idiomatic** Go code that you
otherwise would have had to write yourself. Take a look in `tutorial/query.sql.go`.

If your tables have columns with date or time types, sqlc expects these values
to scan into `time.Time` structs. If you're using
`github.com/go-sql-driver/mysql`, ensure that `parseTime=true` has been added to
the connection string.

0 comments on commit c832c96

Please sign in to comment.