Documentation
¶
Overview ¶
Package mysql connects rio to MySQL through the github.com/go-sql-driver/mysql driver.
The package is deliberately thin: it constructs handles, keeps the DSN honest about parseTime, and translates the driver's error numbers into rio's sentinel errors. All SQL generation lives in github.com/go-rio/rio.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New wraps an existing *sql.DB in a rio handle with the MySQL dialect and this package's error translator installed. The caller's options apply after the translator, so a rio.WithErrorTranslator among them replaces it. New performs no DSN hygiene — the *sql.DB is the caller's; make sure it was opened with parseTime=true, or time.Time columns will fail to scan.
func Open ¶
Open opens a MySQL database for rio. The DSN uses the go-sql-driver format: user:password@tcp(host:port)/dbname?param=value.
rio scans DATETIME and TIMESTAMP columns into time.Time, which requires the driver option parseTime=true. Open therefore appends parseTime=true when the DSN does not mention the option, and returns an error when the DSN explicitly sets parseTime=false instead of silently overriding a choice the caller spelled out. Every other option — including loc — passes through untouched, so existing data keeps its meaning; the README explains why new applications should store UTC.
Like database/sql, Open validates its arguments without connecting; ping the handle returned by Unwrap to verify the server is reachable.
Types ¶
This section is empty.