Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶
func NewConnection(params ConnectionParams) (*sql.DB, error)
NewConnection creates a new database connection and optionally registers a health check. It also registers a closer in the application lifecycle.
Types ¶
type ConnectionParams ¶
type ConnectionParams struct {
dig.In
Config *Config
HealthCollector healthz.Collector `optional:"true"`
Lifecycle fxt.Lifecycle
}
ConnectionParams provides a set of dependencies for a database connection constructor.
type MasterSlaveConfigResult ¶
type MasterSlaveConfigResult struct {
dig.Out
Master *Config `name:"master"`
Slave *Config `name:"slave"`
}
MasterSlaveConfigResult can be used to register master and slave configurations in the container.
type MasterSlaveConnectionParams ¶
type MasterSlaveConnectionParams struct {
dig.In
MasterConfig *Config `name:"master"`
SlaveConfig *Config `name:"slave"`
HealthCollector healthz.Collector `optional:"true"`
Lifecycle fxt.Lifecycle
}
MasterSlaveConnectionParams provides a set of dependencies for a master-slave database connection constructor.
type MasterSlaveConnectionResult ¶
type MasterSlaveConnectionResult struct {
dig.Out
Master *sql.DB `name:"master"`
Slave *sql.DB `name:"slave"`
}
MasterSlaveConnectionResult contains the result connections of the NewMasterSlaveConnection constructor.
func NewMasterSlaveConnection ¶
func NewMasterSlaveConnection(params MasterSlaveConnectionParams) (MasterSlaveConnectionResult, error)
NewMasterSlaveConnection calls NewConnection twice with different input configurations.
Click to show internal directories.
Click to hide internal directories.