database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package database provides functions to migrate the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMigrate

func GetMigrate(connString string) (*migrate.Migrate, error)

GetMigrate creates a new migrate instance using the embedded migrations

func GetVersion

func GetVersion(connString string) (uint, bool, error)

GetVersion returns the current migration version

func MigrateDown

func MigrateDown(_ context.Context, db *pgx.Conn, steps int) error

MigrateDown reverts the last migration

func MigrateUp

func MigrateUp(_ context.Context, db *pgx.Conn) error

MigrateUp executes all pending database migrations

func SetupTestDB

func SetupTestDB(t *testing.T) (*pgx.Conn, func())

SetupTestDB creates a Postgres container using testcontainers and runs all migrations

func SetupTestDBContaienr

func SetupTestDBContaienr(t *testing.T, ctx context.Context) (*pgx.Conn, func())

SetupTestDBContaienr creates a Postgres container using testcontainers and returns a connection to the database

Types

This section is empty.

Jump to

Keyboard shortcuts

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