database

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DB stores the connection pool (pgxpool.Pool). It is used throughout the application to interact with the PostgreSQL database. The pool is created when the Connect function is called.

Functions

func Connect

func Connect()

Connect establishes a connection to the PostgreSQL database using environment variables. It also executes any necessary migrations to ensure required tables exist in the database.

func RunMigrations

func RunMigrations()

RunMigrations executes the database migration process by reading SQL commands from a migration file and applying them to the database. It logs the progress and any errors encountered during the process.

The function performs the following steps: 1. Reads the migration SQL file located at "./src/database/migrations.sql". 2. Executes the SQL commands in the migration file against the database. 3. Logs debug, error, and informational messages to indicate the status of the migration.

If an error occurs while reading the migration file or executing the SQL commands, the error is logged, and the function continues execution.

Types

This section is empty.

Jump to

Keyboard shortcuts

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