Documentation ¶
Overview ¶
Package clmysql provides modules for interacting with MySQL.
Index ¶
- func New(mycfg *mysql.Config, _ Migrater, trp trace.TracerProvider, ...) (*sql.DB, error)
- func NewReadOnlyConfig(cfg Config, logs *zap.Logger) (*mysql.Config, error)
- func NewReadWriteConfig(cfg Config, logs *zap.Logger) (*mysql.Config, error)
- func Provide() fx.Option
- func TestProvide() fx.Option
- type Config
- type Migrater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(mycfg *mysql.Config, _ Migrater, trp trace.TracerProvider, mtp metric.MeterProvider, ) (*sql.DB, error)
New inits a standard sql.DB with optional OTEL tracing and metrics. Any other dependency can optionally be provided as migrated to force it's lifecycle to be run before the database is connected. This is mostly useful to run migration logic (such as initializing the database).
func NewReadOnlyConfig ¶
NewReadOnlyConfig constructs a config for a read-only database connecion. The aws config is optional and is only used when IamAuth option is set.
func NewReadWriteConfig ¶
NewReadWriteConfig constructs a config for a read-write database connecion. The aws config is optional and only used when the IamAuth option is set.
func TestProvide ¶
TestProvide configures the DI for a test environment.
Types ¶
type Config ¶
type Config struct { // ReadWriteHostname endpoint allows configuration of a endpoint that can read and write ReadOnlyDataSourceName string `env:"READ_ONLY_DATA_SOURCE_NAME" envDefault:"root:mysql@tcp(localhost:3306)/mysql"` // ReadWriteDataSourceName describes the data-source-name (DSN) for the read-write connection ReadWriteDataSourceName string `env:"READ_WRITE_DATA_SOURCE_NAME" envDefault:"root:mysql@tcp(localhost:3306)/mysql"` }
Config configures the package.
Directories ¶
Path | Synopsis |
---|---|
Package clmymigrate implements the postgres migration logic.
|
Package clmymigrate implements the postgres migration logic. |