Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SQLDatabase ¶
type SQLDatabase struct {
// contains filtered or unexported fields
}
SQLDatabase wraps a standard sql.DB instance and provides lifecycle management for SQL database connections.
func NewSQLDatabase ¶
func NewSQLDatabase(cfg *cfg.DBConfig) (*SQLDatabase, error)
NewSQLDatabase initializes and returns a new SQLDatabase instance using the provided configuration. It sets connection pool parameters such as maximum open/idle connections and connection lifetime.
Returns an error if the connection could not be established.
func (*SQLDatabase) Close ¶
func (db *SQLDatabase) Close() error
Close closes the underlying database connection. It is safe to call Close multiple times; if the DB is already nil, it does nothing.
func (*SQLDatabase) DB ¶ added in v0.2.3
func (db *SQLDatabase) DB() *sql.DB
DB returns a copy of the raw db
func (*SQLDatabase) Ping ¶
func (db *SQLDatabase) Ping() error
Ping verifies that the database connection is still alive. It is useful for health checks or readiness probes.
Click to show internal directories.
Click to hide internal directories.