Documentation
¶
Index ¶
- func ForceVersion(db *sql.DB, migrationsPath string, version int, logger *log.Logger) error
- func MigrateDown(db *sql.DB, migrationsPath string, logger *log.Logger) error
- func MigrateTo(db *sql.DB, migrationsPath string, targetVersion uint, logger *log.Logger) error
- func MigrateUp(db *sql.DB, migrationsPath string, logger *log.Logger) error
- func MigrateVersion(db *sql.DB, migrationsPath string) (uint, bool, error)
- type Config
- type DB
- type PoolStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceVersion ¶
ForceVersion sets the migration version without running migrations WARNING: Only use this to recover from a failed migration
func MigrateDown ¶
MigrateDown rolls back the most recent migration
Types ¶
type Config ¶
type Config struct {
Host string
Port string
User string
Password string
DBName string
SSLMode string
}
Config holds database connection configuration
type DB ¶
DB wraps sql.DB with additional functionality
func (*DB) GetPoolStats ¶
GetPoolStats returns formatted pool statistics with configuration
func (*DB) HealthCheck ¶
HealthCheck verifies database connectivity and returns an error if unhealthy
type PoolStats ¶
type PoolStats struct {
OpenConnections int // Currently open connections
InUse int // Connections currently in use
Idle int // Idle connections ready for use
WaitCount int64 // Total number of connections waited for
WaitDuration int64 // Total time waited for connections (nanoseconds)
MaxOpenConns int // Maximum allowed open connections
MaxIdleConns int // Maximum allowed idle connections
MaxLifetime int64 // Maximum connection lifetime (seconds)
MaxIdleTime int64 // Maximum connection idle time (seconds)
}
PoolStats returns formatted connection pool statistics for monitoring
Click to show internal directories.
Click to hide internal directories.