testutil

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities for database integration tests. Includes helpers for setting up PostgreSQL and MySQL test databases with migrations.

Index

Constants

View Source
const (
	PostgresTestDSN = "postgres://testuser:testpassword@localhost:5433/testdb?sslmode=disable"
	MySQLTestDSN    = "testuser:testpassword@tcp(localhost:3307)/testdb?parseTime=true&multiStatements=true"
)

Variables

This section is empty.

Functions

func CleanupMySQLDB

func CleanupMySQLDB(t *testing.T, db *sql.DB)

CleanupMySQLDB truncates all tables in the MySQL database.

func CleanupPostgresDB

func CleanupPostgresDB(t *testing.T, db *sql.DB)

CleanupPostgresDB truncates all tables in the PostgreSQL database.

func SetupMySQLDB

func SetupMySQLDB(t *testing.T) *sql.DB

SetupMySQLDB creates a new MySQL database connection and runs migrations.

func SetupPostgresDB

func SetupPostgresDB(t *testing.T) *sql.DB

SetupPostgresDB creates a new PostgreSQL database connection and runs migrations.

func TeardownDB

func TeardownDB(t *testing.T, db *sql.DB)

TeardownDB closes the database connection and cleans up.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL