Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Module( "sql", fx.Provide(New), fx.Invoke(NewMigrator), )
Functions ¶
Types ¶
type Configuration ¶ added in v1.7.1
type Configuration struct {
Connection string `yaml:"connection"`
// User can also be specified separately from the connection string
User string `yaml:"user"`
// Password can also be specified separately from the connection string
Password string `yaml:"password"`
// User can also be specified separately from the connection string
MigrateUser string `yaml:"migrateUser"`
// Password can also be specified separately from the connection string
MigratePassword string `yaml:"migratePassword"`
// MaxLifetime is the maximum lifetime of a connection
// from time.ParseDuration:
// A duration string is a possibly signed sequence of
// decimal numbers, each with optional fraction and a unit suffix,
// such as "300ms", "-1.5h" or "2h45m".
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
MaxLifetime MDuration `yaml:"maxLifetime"`
MaxOpenConnections int `yaml:"maxOpenConnections"`
MaxIdleConnections int `yaml:"maxIdleConnections"`
MigrationPath string `yaml:"migrationPath"`
}
func (*Configuration) ConnectionUrl ¶ added in v1.7.1
func (d *Configuration) ConnectionUrl(migration bool) (string, error)
type MDuration ¶
func (*MDuration) UnmarshalJSON ¶
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func NewMigrator(lc fx.Lifecycle, settings Configuration, log *zap.SugaredLogger) *Migrator
Click to show internal directories.
Click to hide internal directories.