Versions in this module Expand all Collapse all v0 v0.2.0 Mar 2, 2026 Changes in this version + type Component struct + func NewComponent(cfg Config, log *logger.Logger) *Component + func (c *Component) DB() *DB + func (c *Component) Describe() component.Description + func (c *Component) Health(ctx context.Context) component.Health + func (c *Component) Name() string + func (c *Component) Start(ctx context.Context) error + func (c *Component) Stop(_ context.Context) error + func (c *Component) WithAutoMigrate(models ...interface{}) *Component + func (c *Component) WithDriver(fn DriverFunc) *Component + type Config struct + AutoMigrate bool + ConnMaxIdleTime string + ConnMaxLifetime string + DSN string + Enabled bool + LogLevel string + MaxIdleConns int + MaxOpenConns int + MaxRetries int + Name string + SlowQueryThreshold string + func (c *Config) ApplyDefaults() + func (c *Config) Validate() error + type DB struct + GormDB *gorm.DB + func New(cfg Config, log *logger.Logger, dialector gorm.Dialector) (*DB, error) + func NewWithContext(ctx context.Context, dialector interface{}, cfg Config, log *logger.Logger) (*DB, error) + func (d *DB) AutoMigrate(models ...interface{}) error + func (d *DB) Close() error + func (d *DB) Ping() error + func (d *DB) PingContext(ctx context.Context) error + func (d *DB) Transaction(fn func(*gorm.DB) error) error + func (d *DB) WithContext(ctx context.Context) *gorm.DB + func (d *DB) WithReadOnlyTransaction(ctx context.Context, fn TransactionFunc) error + func (d *DB) WithTransaction(ctx context.Context, fn TransactionFunc) error + func (db *DB) IsAvailable(ctx context.Context) bool + func (db *DB) Name() string + type DriverFunc func(dsn string) gorm.Dialector + type TransactionFunc func(tx *gorm.DB) error