postgres

package
v0.0.0-...-aeadd1c Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*pgxpool.Pool
	QueryBuilder *squirrel.StatementBuilderType
	// contains filtered or unexported fields
}

*

  • DB is a wrapper for PostgreSQL database connection
  • that uses pgxpool as database driver.
  • It also holds a reference to squirrel.StatementBuilderType
  • which is used to build SQL queries that compatible with PostgreSQL syntax

func New

func New(ctx context.Context, config *config.DB) (*DB, error)

New creates a new PostgreSQL database instance

func (*DB) Close

func (db *DB) Close()

Close closes the database connection

func (*DB) ErrorCode

func (db *DB) ErrorCode(err error) string

ErrorCode returns the error code of the given error

func (*DB) Migrate

func (db *DB) Migrate() error

Migrate runs the database migration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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