func IntPointer(i int) *int {
	return &i
}
IntPointer is a helper to get a *int from a int. It is in the tests package
because we normally don't want to deal with pointers to basic types but it's
useful in some tests.
package tests
import (
	"testing"
	"time"
	"github.com/ardanlabs/garagesale/internal/platform/database"
	"github.com/ardanlabs/garagesale/internal/platform/database/databasetest"
	"github.com/ardanlabs/garagesale/internal/schema"
	"github.com/jmoiron/sqlx"
)
func NewUnit(t *testing.T) (*sqlx.DB, func()) {
	t.Helper()
	c := databasetest.StartContainer(t)
	db, err := database.Open(database.Config{
		User:       "postgres",
		Password:   "postgres",
		Host:       c.Host,
		Name:       "postgres",
		DisableTLS: true,
	})
	if err != nil {
		t.Fatalf("opening database connection: %v", err)
	}
	t.Log("waiting for database to be ready")
	var pingError error
	maxAttempts := 20
	for attempts := 1; attempts <= maxAttempts; attempts++ {
		pingError = db.Ping()
		if pingError == nil {
			break
		}
		time.Sleep(time.Duration(attempts) * 100 * time.Millisecond)
	}
	if pingError != nil {
		databasetest.DumpContainerLogs(t, c)
		databasetest.StopContainer(t, c)
		t.Fatalf("waiting for database to be ready: %v", pingError)
	}
	if err := schema.Migrate(db); err != nil {
		databasetest.StopContainer(t, c)
		t.Fatalf("migrating: %s", err)
	}
	teardown := func() {
		t.Helper()
		db.Close()
		databasetest.StopContainer(t, c)
	}
	return db, teardown
}
func StringPointer(s string) *string {
	return &s
}