database

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package database provides database connection management.

Index

Constants

This section is empty.

Variables

Pool is the shared database connection pool used throughout the application.

Functions

func SetPool

func SetPool(ctx context.Context, config *Config) error

SetPool connects to the database and sets the connection pool as a global var.

func SetPoolFromURL

func SetPoolFromURL(ctx context.Context, dsn string) error

SetPoolFromURL connects to the database using a libpq/URL DSN and sets the global pool. Useful for tests that target an already-migrated database.

Types

type Config

type Config struct {
	Password string
	DBName   string
	Host     string
	User     string
	SSLMode  string
	Schema   string
	Port     int
}

Config contains values used to connect to the database.

func (*Config) ConnectURL

func (config *Config) ConnectURL() string

ConnectURL returns a URL-style connection string for use with golang-migrate's pgx5 driver.

Jump to

Keyboard shortcuts

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