Documentation
¶
Overview ¶
Package sql provides SQL database wiring and helpers for go-service.
This package is the entrypoint for wiring SQL database support into Fx/Dig. It composes driver-specific modules (for example PostgreSQL via `database/sql/pg`) and exposes a small, consistent configuration shape for services (`sql.Config`).
Configuration and enablement ¶
SQL configuration is optional. By convention across go-service config types, a nil `*sql.Config` is treated as "disabled". Driver-specific configs typically follow the same convention, and constructors that depend on config often return (nil, nil) when disabled.
Master/slave pools and telemetry ¶
Driver integrations typically open master/slave connection pools, configure pool limits/lifetimes, and register OpenTelemetry instrumentation/metrics for `database/sql` connections.
Start with `Module` and `Config`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = di.Module( pg.Module, )
Module wires SQL database support into Fx/Dig.
This module is a thin composition layer that includes driver-specific SQL modules. At present it includes PostgreSQL support via `database/sql/pg.Module`.
Consumers typically include this module alongside configuration wiring so that driver-specific Open functions can read DSNs/pool settings and return a master/slave connection pool.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// PG configures PostgreSQL support (connection pool settings and master/slave DSNs).
PG *pg.Config `yaml:"pg,omitempty" json:"pg,omitempty" toml:"pg,omitempty"`
}
Config is the root SQL database configuration for a go-service based service.
It composes driver-specific configuration for SQL backends wired by this repository.
Optional pointers and "enabled" semantics ¶
This config is intentionally optional. By convention across go-service configuration types, a nil *Config is treated as "SQL disabled". Driver-specific sub-configs are also pointers and are treated as optional; downstream constructors typically return (nil, nil) when a required sub-config is nil.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package config provides shared SQL (`database/sql`) configuration types for go-service.
|
Package config provides shared SQL (`database/sql`) configuration types for go-service. |
|
Package driver provides SQL driver registration and adapter helpers for go-service.
|
Package driver provides SQL driver registration and adapter helpers for go-service. |
|
Package pg provides PostgreSQL (`database/sql`) wiring and helpers for go-service.
|
Package pg provides PostgreSQL (`database/sql`) wiring and helpers for go-service. |