Versions in this module Expand all Collapse all v0 v0.3.0 Jan 13, 2026 v0.2.0 Jan 13, 2026 v0.1.0 Jan 13, 2026 Changes in this version + func Close(db *sql.DB) error + func Connect(cfg Config) (*sql.DB, error) + func ConnectWithDSN(dsn string) (*sql.DB, error) + func Ping(db *sql.DB) error + type Config struct + Database string + Host string + Password string + Port int + SSLMode string + User string + func DefaultConfig() Config + type Connection interface + Close func() error + Ping func() error + Type func() DatabaseType + func MustNewConnection(cfg DatabaseConfig) Connection + func MustNewConnectionWithLogger(cfg DatabaseConfig, logger *slog.Logger) Connection + func NewConnection(cfg DatabaseConfig) (Connection, error) + func NewConnectionWithLogger(cfg DatabaseConfig, logger *slog.Logger) (Connection, error) + type DatabaseConfig struct + MongoDB *MongoDBConfig + Postgres *PostgresConfig + Type DatabaseType + func DatabaseConfigFromEnv() DatabaseConfig + func DefaultDatabaseConfig() DatabaseConfig + type DatabaseType string + const DatabaseTypeMongoDB + const DatabaseTypePostgres + func ParseDatabaseType(s string) DatabaseType + func (dt DatabaseType) IsValid() bool + func (dt DatabaseType) String() string + type Migration struct + AppliedAt *time.Time + DownSQL string + Name string + UpSQL string + Version string + type Migrator struct + func NewMigrator(db *sql.DB) *Migrator + func (m *Migrator) MigrateDown() error + func (m *Migrator) MigrateReset() error + func (m *Migrator) MigrateUp() error + func (m *Migrator) Status() ([]Migration, error) + type MongoDBConfig struct + Database string + URI string + func DefaultMongoDBConfig() *MongoDBConfig + type MongoDBConnection struct + Client *mongodb.Client + func (c *MongoDBConnection) Close() error + func (c *MongoDBConnection) Ping() error + func (c *MongoDBConnection) Type() DatabaseType + type PoolStats struct + Idle int + InUse int + MaxOpenConnections int + OpenConnections int + func GetPoolStats(db *sql.DB) PoolStats + type PostgresConfig struct + Database string + Host string + Password string + Port int + SSLMode string + User string + func DefaultPostgresConfig() *PostgresConfig + type PostgresConnection struct + DB *sql.DB + func (c *PostgresConnection) Close() error + func (c *PostgresConnection) Ping() error + func (c *PostgresConnection) Type() DatabaseType