diff --git a/docs/tutorials/getting-started-mysql.md b/docs/tutorials/getting-started-mysql.md index f9e7f82567..2f86a7bd39 100644 --- a/docs/tutorials/getting-started-mysql.md +++ b/docs/tutorials/getting-started-mysql.md @@ -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 } @@ -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.