db

package
v0.0.0-...-681f5a7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(url, path string, action Action, fs embed.FS) error

func MigrateDown

func MigrateDown(url, path string, fs embed.FS) error

func MigrateUp

func MigrateUp(url, path string, fs embed.FS) error

Types

type Action

type Action int
const (
	ActionUp   Action = iota + 1 // Migrate up
	ActionDown                   // Migrate down
)

type Option

type Option func(*Postgres)

Option -.

func ConnAttempts

func ConnAttempts(attempts int) Option

ConnAttempts -.

func ConnTimeout

func ConnTimeout(timeout time.Duration) Option

ConnTimeout -.

func MaxPoolSize

func MaxPoolSize(size int) Option

MaxPoolSize -.

type Postgres

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

Postgres pgxpool wrapper

func NewPostgres

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

NewPostgres postgres connection pool

func (*Postgres) Close

func (p *Postgres) Close()

Close the connection pool

Jump to

Keyboard shortcuts

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