driver

package
v2.289.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package driver provides SQL driver registration and adapter helpers for go-service.

This package contains small pieces that integrate specific `database/sql`-compatible drivers with the SQL wiring in this repository (for example by registering a driver or exposing driver-specific helpers).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(lc di.Lifecycle, name string, fs *os.FS, cfg *config.Config) (*mssqlx.DBs, error)

Open opens master/slave `database/sql` connection pools for the given driver name.

It reads master and slave DSNs from cfg using the provided filesystem (DSNs are configured as "source strings"), connects using `mssqlx.ConnectMasterSlaves`, registers OpenTelemetry DB stats metrics for each pool, and configures pool limits/lifetime.

The returned pools are closed on Fx lifecycle stop.

func Register

func Register(name string, driver Driver) (err error)

Register registers a `database/sql` driver under name and wraps it with OpenTelemetry instrumentation.

If the underlying `sql.Register` panics (for example, due to a duplicate name), Register converts the panic into an error and returns it.

Types

type Driver

type Driver = driver.Driver

Driver aliases `database/sql/driver`.Driver.

Jump to

Keyboard shortcuts

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