database

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresTestConfig

type PostgresTestConfig struct {
	Image           string
	Database        string
	Username        string
	Password        string
	Port            string
	InitScripts     []string
	MaxConnections  int
	ConnMaxLifetime time.Duration
	Logger          *logrus.Logger
}

PostgresTestConfig configura el container de PostgreSQL para tests

func DefaultPostgresConfig

func DefaultPostgresConfig() *PostgresTestConfig

DefaultPostgresConfig retorna configuración por defecto para PostgreSQL de tests

type PostgresTestHelper

type PostgresTestHelper struct {
	// contains filtered or unexported fields
}

PostgresTestHelper maneja la configuración de PostgreSQL para tests

func NewPostgresTestHelper

func NewPostgresTestHelper(config *PostgresTestConfig) *PostgresTestHelper

NewPostgresTestHelper crea un nuevo helper de PostgreSQL

func (*PostgresTestHelper) CreateTestDatabase

func (h *PostgresTestHelper) CreateTestDatabase(ctx context.Context, dbName string) error

CreateTestDatabase crea una base de datos de prueba

func (*PostgresTestHelper) DropTestDatabase

func (h *PostgresTestHelper) DropTestDatabase(ctx context.Context, dbName string) error

DropTestDatabase elimina una base de datos de prueba

func (*PostgresTestHelper) GetConnectionString

func (h *PostgresTestHelper) GetConnectionString(ctx context.Context) (string, error)

GetConnectionString retorna la cadena de conexión

func (*PostgresTestHelper) GetDB

func (h *PostgresTestHelper) GetDB() *sql.DB

GetDB retorna la conexión database/sql

func (*PostgresTestHelper) GetGORM

func (h *PostgresTestHelper) GetGORM() *gorm.DB

GetGORM retorna la conexión GORM

func (*PostgresTestHelper) GetSQLX

func (h *PostgresTestHelper) GetSQLX() *sqlx.DB

GetSQLX retorna la conexión SQLX

func (*PostgresTestHelper) RunMigrations

func (h *PostgresTestHelper) RunMigrations(ctx context.Context, migrations []string) error

RunMigrations ejecuta scripts de migración

func (*PostgresTestHelper) Start

func (h *PostgresTestHelper) Start(ctx context.Context) error

Start inicia el container de PostgreSQL

func (*PostgresTestHelper) Stop

func (h *PostgresTestHelper) Stop(ctx context.Context) error

Stop detiene el container de PostgreSQL

func (*PostgresTestHelper) TruncateAllTables

func (h *PostgresTestHelper) TruncateAllTables(ctx context.Context) error

TruncateAllTables limpia todas las tablas

Jump to

Keyboard shortcuts

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