pgutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertIndexExists

func AssertIndexExists(t *testing.T, db *bun.DB, indexName string)

AssertIndexExists checks if an index exists in the database

func AssertRowCount

func AssertRowCount(t *testing.T, db *bun.DB, tableName string, expected int)

AssertRowCount checks if a table has the expected number of rows

func AssertTableExists

func AssertTableExists(t *testing.T, db *bun.DB, tableName string)

AssertTableExists checks if a table exists in the database

func AssertTableNotExists

func AssertTableNotExists(t *testing.T, db *bun.DB, tableName string)

AssertTableNotExists checks if a table does not exist in the database

func ConnectDB

func ConnectDB(cfg *DatabaseConfig) (*bun.DB, error)

ConnectDB creates a connection to the specified database

func SetupTestDB

func SetupTestDB(t *testing.T) (*bun.DB, func())

SetupTestDB creates a PostgreSQL testcontainer and returns a connection

Types

type DatabaseConfig

type DatabaseConfig struct {
	URL      string `yaml:"url" validate:"required,url"`
	SSLMode  string `yaml:"ssl_mode" validate:"required,oneof=disable allow prefer require verify-ca verify-full"`
	Timeout  int    `yaml:"timeout" default:"10"`
	PoolSize int    `yaml:"pool_size" default:"10"`
}

DatabaseConfig contains database connection settings

func (*DatabaseConfig) GetConnectionString

func (c *DatabaseConfig) GetConnectionString() string

GetConnectionString returns a PostgreSQL connection string with sslmode applied when missing.

Directories

Path Synopsis
Package migrations holds migrations related helpers
Package migrations holds migrations related helpers

Jump to

Keyboard shortcuts

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