Help us shape the future of Go! Take the 2026 Go Developer Survey

mysql

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package mysql is the MySQL and MariaDB driver for Anetos's db package, using github.com/go-sql-driver/mysql.

database, err := db.Connect(ctx, app, mysql.Driver())

The connection is built from DB_HOST, DB_PORT (default 3306), DB_DATABASE, DB_USERNAME and DB_PASSWORD, or taken from DB_URL in the driver's DSN format (user:password@tcp(host:3306)/app?tls=true). Either way, times are read as time.Time in UTC (parseTime=true, loc=UTC), and updates report the rows they matched (clientFoundRows=true), which the db package relies on. Sessions use UTC (time_zone='+00:00') unless the DSN sets time_zone. Built from DB_HOST, the connection uses TLS as DB_TLS says (db.Config.TLSMode): verified for any host but this machine's, unless DB_TLS=skip-verify or none.

For vector search on MariaDB 11.7+, each session sets mhnsw_ef_search to 1000 (MariaDB's default is 20), so a vector index returns the candidates the query builder asks for (db.SimilarCandidates) even when the query's conditions keep few of the chunks it visits. It applies to the app's own vector queries too; MySQL and older MariaDB ignore it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DSN

func DSN(cfg db.Config) (string, error)

DSN returns the go-sql-driver/mysql DSN for cfg. Built from DB_HOST and the others, its tls follows cfg.TLSMode: true (or the CAs of DB_TLS_CA), skip-verify, or false.

func Driver

func Driver() db.Driver

Driver returns the MySQL/MariaDB driver, selected by DB_CONNECTION=mysql.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL