postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Postgres)

Option defines a type for applying various configurations to the Postgres struct

func ConnAttempts

func ConnAttempts(attempts int) Option

ConnAttempts sets the number of attempts to reconnect to the Postgres database

func ConnTimeout

func ConnTimeout(timeout time.Duration) Option

ConnTimeout sets the connection timeout duration for the Postgres database

func MaxPoolSize

func MaxPoolSize(size int) Option

MaxPoolSize sets the maximum number of connections in the Postgres connection pool

type Postgres

type Postgres struct {
	DB *sqlx.DB
	// contains filtered or unexported fields
}

Postgres holds the SQLX DB connection pool

func New

func New(url string, opts ...Option) (*Postgres, error)

New initialize the Postgres connection using SQLX and raw SQL queries

func (*Postgres) Close

func (p *Postgres) Close()

Close close the database connection

Jump to

Keyboard shortcuts

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