database

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectToDatabase

func ConnectToDatabase(databaseURI string) (*sql.DB, error)

ConnectToDatabase establishes a connection to a PostgreSQL database. Configures connection pooling and verifies connectivity. Returns the database handle or an error if the connection fails.

func Transaction added in v1.1.4

func Transaction(database *sql.DB, operation TransactionFunction) (err error)

Transaction executes a database transaction with robust panic handling, consistent timestamps, and enhanced logging for debugging. It returns an error if the transaction fails or panics.

Types

type TransactionFunction added in v1.1.3

type TransactionFunction func(transaction *sql.Tx) error

TransactionFunction defines the signature for the transactional operation. It accepts a transaction and returns an error if the operation fails.

Jump to

Keyboard shortcuts

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