resources

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServerDbSaverWg sync.WaitGroup

Functions

func Config

func Config(dbUrl string) *pgxpool.Config

Config retrieves the postgres DB connection url from environment variable named `BARK_DATABASE_URL`. It then parses the connection url and checks for empty and invalid urls, if found, it logs the error and connection is not made. If it passes the checks, the connection is established and function returns object of pgxpool config.

func InitDb

func InitDb(dbUrl string) error

InitDb : InitDB returns error (if any) encountered while trying to establish a connection to the postgres DB instance.

Types

type BarkPostgresDb

type BarkPostgresDb struct {
	Client *pgxpool.Pool
}

BarkPostgresDb wraps the *pgxpool.Pool in a custom struct to use it as a receiver for query functions

var BarkDb *BarkPostgresDb

func OpenDb

func OpenDb(dbUrl string) (*BarkPostgresDb, error)

OpenDb : OpenDB returns a pointer to the `BarkPostgresDb` object.

func (*BarkPostgresDb) CloseDb

func (d *BarkPostgresDb) CloseDb()

CloseDb closes the connection to the DB.

Jump to

Keyboard shortcuts

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