-
Release v1.0.0 Stable
released this
2026-05-11 19:21:56 -06:00 | 1 commits to main since this releasev1.0.0
code.nochebuena.dev/go/mysqlOverview
mysqlv1.0.0 commits the database client API as stable. All v0.9.x roadmap items are
resolved. The module ships adatabase/sql-backed MySQL client that integrates with the
launcherlifecycle andhealthcheck systems, maps driver errors to portablexerrors
codes, and providesUnitOfWorkfor transactional repository patterns via context injection.What Changed Since v0.9.1
New in Client interface
BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)— starts a transaction with
explicit isolation level and read-only options.Begin(ctx)is now a convenience wrapper
callingBeginTx(ctx, nil).tx, err := db.BeginTx(ctx, &sql.TxOptions{ Isolation: sql.LevelSerializable, ReadOnly: false, })New in Component interface
Stats() sql.DBStats— exposes connection pool metrics for observability. Returns
sql.DBStats{}(zero value) when called beforeOnInit. Useful for Prometheus gauges or
health dashboards:stats := db.Stats() // stats.OpenConnections, stats.WaitCount, stats.WaitDuration, ...Dependency bumps
All micro-lib dependencies promoted to v1.0.0:
logz,health,launcher,xerrors.Roadmap items resolved
Item Resolution BeginTx(ctx, opts)for isolation levels✅ Added to Client;Beginrefactored as wrapperStats() sql.DBStatsfor pool observability✅ Added to ComponentDSN params ( parseTime,loc,charset) inConfig✅ Done in v0.9.1 — Charset,Loc,ParseTimefields with backward-compatible defaultsProduction feedback on pool defaults ✅ Validated as-is — MaxConns=5,MinConns=2,1h/30mconfirmed in productionFull API (stable)
Executor—ExecContext,QueryContext,QueryRowContextusingdatabase/sqlnative types.Tx— extendsExecutorwithCommit() error,Rollback() error(no context — honestdatabase/sqlcontract).Client—GetExecutor(ctx) Executor,Begin(ctx) (Tx, error),BeginTx(ctx, opts) (Tx, error),Ping(ctx) error,HandleError(err) error.Component—launcher.Component+health.Checkable+Client+Stats() sql.DBStats.UnitOfWork—Do(ctx, fn) error; injects active*sql.Txvia context.Config—Host,Port,User,Password,Name,MaxConns,MinConns,MaxConnLifetime,MaxConnIdleTime,Charset,Loc,ParseTime; env-tag support.New(logger logz.Logger, cfg Config) Component— constructor; pool opened inOnInit.NewUnitOfWork(logger logz.Logger, client Client) UnitOfWork— wraps aClientfor transactionalDosemantics.HandleError(err error) error— maps MySQL driver errors to xerrors:1062→ErrAlreadyExists;1216/1217/1451/1452→ErrInvalidInput;sql.ErrNoRows→ErrNotFound; others →ErrInternal.Migration from v0.9.1
BeginTxis a new method onClient. Any type that implementsClientmust now also
implementBeginTx. The existingBeginbehavior is unchanged.Statsis a new method onComponent. Any type that implementsComponentmust now also
implementStats.go get code.nochebuena.dev/go/mysql@v1.0.0Downloads