mysql

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mysql implements a verify.Verifier for MySQL using the go-sql-driver/mysql driver via database/sql. It provides best-effort type refinement via ColumnTypes().DatabaseTypeName() and Nullable().

Origin limitation

MySQL's standard database/sql driver does not expose the origin table/column for a result column (the protocol's org_table/org_name fields are not surfaced by go-sql-driver/mysql via the ColumnType interface). Consequently, MySQL verification is type-only: verify.Column carries DeclType (the DB-reported type name, e.g. "INT", "VARCHAR") but TableName and OriginName are always empty. The overlay's UseDeclType path then refines expression/aggregate columns from DeclType.

Validity (prepare errors) is still surfaced as SeverityError diagnostics.

Integration tests

The live connect/prepare path is skipped when DB_CATALYST_VERIFY_DSN is unset. The core mapping logic (columnTypeToColumn, columnTypesToColumns) is fully unit-tested with constructed fakes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(dsn string) verify.Verifier

New returns a MySQL verify.Verifier that connects via go-sql-driver/mysql. dsn should be a DSN accepted by that driver (e.g. "user:pass@tcp(host:3306)/dbname").

Types

type ColumnTypeLike

type ColumnTypeLike interface {
	ColName() string
	DBTypeName() string
	Nullable() (nullable bool, ok bool)
}

ColumnTypeLike abstracts the parts of *sql.ColumnType that we need so that columnTypeToColumn and columnTypesToColumns can be unit-tested with fakes.

Jump to

Keyboard shortcuts

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