package infra

import (
	"database/sql"
	"fmt"
)

// DBClose closes the database connection. Wraps db.Close() for composability
// in pipelines that manage *sql.DB lifecycle explicitly.
func DBClose(db *sql.DB) error {
	if db == nil {
		return fmt.Errorf("db_close: db is nil")
	}
	if err := db.Close(); err != nil {
		return fmt.Errorf("db_close: %w", err)
	}
	return nil
}
