db

package
v0.0.0-...-51e6e68 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConnectionString

func BuildConnectionString() string

BuildConnectionString builds a Postgresql connection string. Extracts its different sections from environmental variables

func BuildConnectionURL

func BuildConnectionURL() string

BuildConnectionURL builds a Postgresql connection url. Extracts its different sections from environmental variables. Format: postgres://user:password@host:port/dbname

Types

type Pooler

type Pooler interface {
	Begin(ctx context.Context) (pgx.Tx, error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, optionsAndArgs ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, optionsAndArgs ...interface{}) pgx.Row
}

Pooler abstracts connection pool methods

var Db Pooler

Db creates an exported global variable to hold the database connection pool.

func InitDb

func InitDb(connectionString string) Pooler

InitDb starts and returns a connection pool

Jump to

Keyboard shortcuts

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