sql

package
v0.0.0-...-64e57e2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sql provides functions for working with PostgreSQL databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatabase

func NewDatabase() (*pgxpool.Pool, error)

NewDatabase creates a new connection pool to a PostgreSQL database using the using the configuration specified in the environment variables.

Types

type Config

type Config struct {
	DBConfig *DBConfig `env:",prefix=DB_"`
}

Config contains database configuration information.

type DBConfig

type DBConfig struct {
	User string `env:"USER,default=postgres"`
	Pass string `env:"PASS,default=postgres"`
	Host string `env:"HOST,default=localhost"`
	Name string `env:"NAME,default=postgres"`
	Port int    `env:"PORT,default=5432"`
}

DBConfig contains database connection settings.

Jump to

Keyboard shortcuts

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