dbsgomysql

module
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT

README

dbsgomysql

⚠️ Under heavy development — use at your own risk

This library is pre-1.0. Anything may break before v1.0.0: exported types, function signatures, check identifiers, and finding payloads are all subject to change without a deprecation period. Pin an exact tag and read the changelog before every bump.

v1.0.0 is the stability announcement. Until then, treat this repository as a preview.

A reference library of MySQL schema facts and validations for Go.

Module: github.com/dbsmedya/dbsgomysql · Go 1.24+ · Status: phase 1 implementation · Version: see CHANGELOG.md

dbsgomysql gives Go projects a single, well-tested answer to questions like "does this table have a single, composite, or no primary key?", "which foreign keys point into this set of tables?", or "does the connected account hold DELETE on these tables?" — plus named validation checks with documented rationale built on those facts. It also tracks MySQL version-specific information_schema quirks (8.0 / 8.4 / 9.7, with 26.x watched) so consumers don't have to rediscover them.

Facts, not policy

The library answers factual questions and reports findings with a documented rationale. It never decides whether a finding matters — mapping a finding to fatal, warning, or ignore is the consumer's policy. That separation is why a check survives one consumer outgrowing it: the question stays answerable for everyone else.

Design principles

  • Zero dependencies. Library code imports the Go standard library only.
  • Driver-agnostic. You supply the connection — a *sql.DB, *sql.Conn, or *sql.Tx; the library never opens, configures, or closes one, and never imports a driver.
  • Never panics, never logs. It returns data and errors. You decide what reaches a terminal.
  • Context-first. Every call that touches the database takes a context.Context as its first argument.

Installation

go get github.com/dbsmedya/dbsgomysql

Status

Available now: pkg/sqlutil for MySQL identifier validation and quoting, plus the pkg/validations metadata, foreign-key, and privilege facts and all 15 pure catalog checks, including table specification and diff facts. General column facts are in development for v0.5.0; pkg/replication follows later.

Planned consumers: goarchive, gocdc.

Documentation

docs/validations.md pkg/validations consumer guide
docs/sqlutil.md pkg/sqlutil — identifier safety
docs/COMPAT.md MySQL version-quirk registry
docs/mysql-version-specific-compatibility.md Behavior that differs between MySQL versions
docs/testing.md Running the test matrix
CHANGELOG.md Version history
AGENTS.md Contributor and agent operating rules

License

MIT

Directories

Path Synopsis
internal
testsupport
Package testsupport provides shared test-only infrastructure.
Package testsupport provides shared test-only infrastructure.
pkg
sqlutil
Package sqlutil makes MySQL identifiers safe to interpolate into SQL.
Package sqlutil makes MySQL identifiers safe to interpolate into SQL.
validations
Package validations answers factual questions about a MySQL schema and runs named checks over the answers.
Package validations answers factual questions about a MySQL schema and runs named checks over the answers.

Jump to

Keyboard shortcuts

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