Documentation
¶
Overview ¶
Package mysql is the MySQL/MariaDB DB driver.
MySQL placeholder syntax (?) matches SQLite, so this driver wraps the SQLite Store implementation and only swaps the migrations FS, dialect, and DSN handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeDSN ¶
NormalizeDSN fills in the three settings every statement in filex assumes, so an operator who writes a bare DSN gets a working server rather than a subtly wrong one.
- parseTime — without it every DATETIME scans into []byte and the row scan fails.
- loc=UTC — how a Go time.Time is rendered on the way in.
- time_zone='+00:00' — what the SERVER thinks now() is. The two are independent: with only loc=UTC, CURRENT_TIMESTAMP defaults and comparisons still run in the server's local zone, so a queued op's not_before (written as a UTC string) would be read hours early or late.
An explicit value in the DSN always wins; this only adds what is missing.
Types ¶
type Driver ¶
type Driver struct{}
Driver implements db.Driver for MySQL/MariaDB.
func (Driver) MigrationsFS ¶
MigrationsFS returns the embedded MySQL migrations.
func (Driver) NewStore ¶
NewStore reuses the SQLite Store in MySQL mode: the placeholder syntax (?), the column names and the CURRENT_TIMESTAMP literals are shared, and the one construct the two engines spell differently — the upsert — is rewritten by sqlite.Store.upsert rather than kept as a second copy of every statement.
⚠ That sharing is only true while someone checks it. It was not checked until issue #19, and by then MySQL could not create its schema at all, let alone write to it. backend/internal/db runs the migrations, a schema-parity comparison and the first-five-minutes write path against a real MySQL server; point FILEX_TEST_MYSQL_DSN at one before trusting a change here.