Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Postgres

This library is a testing tool that runs postgres through docker.

Installation

go get github.com/dmateus/go-testdb/testpostgres

Usage

import (
    "embed"
    "testing"
    "github.com/dmateus/go-testdb/testpostgres"
)

//go:embed migrations
var migrationsFolder embed.FS

func TestSomething(t *testing.T) {
    db := testpostgres.NewPostgres().
        WithMigrations(migrationsFolder).
        WithTest(t).
        MustStart().
        GetDB()

    // Run tests that use the database here
}