Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTxAlreadyClosed = errors.New("transaction is already closed") TxModule = fx.Module( "mysqlTx", fx.Provide(InitializeModule), ) )
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 InTransactionHandler ¶ added in v1.23.0
type InTransactionHandler func(ctx context.Context, db boil.ContextExecutor) 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
type Parameters ¶ added in v1.34.2
type Parameters struct { fx.In Configuration Configuration Tracing opentelemetry.Configuration MeterProvider *metric.MeterProvider `optional:"true"` }
type TransactionScopeBuilder ¶ added in v1.23.0
type TransactionScopeBuilder func(ctx context.Context, txIsolationLevel sql.IsolationLevel) (TransactionScopeWrapper, error)
func InitializeModule ¶ added in v1.23.1
func InitializeModule(db *sql.DB, log *zap.SugaredLogger) TransactionScopeBuilder
type TransactionScopeWrapper ¶ added in v1.23.0
type TransactionScopeWrapper func(executeInTx InTransactionHandler) error
Click to show internal directories.
Click to hide internal directories.