rscpgx

package module
v0.0.0-...-fb76632 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 4 Imported by: 0

README

rscpgx

This package implements a Resource from the go-services library.

Configuration

type PlatformConfig struct {
	DSN string `config:"dsn,secret"`
}
Name Type Description
DSN string The DSN use to connect with the database.

Internally, rscpgx uses a the pgxpool.New to intiialize the database connection. So, the DSN is the same as the pgxpool.New function, which implies that the DSN con configure all the parameters for a pgxpool.New (documentation).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(r *opts)

Option is a function that can be used to configure a resource.

func WithDisableTestConnectionOnStartUp

func WithDisableTestConnectionOnStartUp() Option

func WithName

func WithName(name string) Option

WithName sets the name of the PGX resource.

type PlatformConfig

type PlatformConfig struct {
	DSN               string        `config:"dsn,secret,required"`
	ConnectionTimeout time.Duration `config:"connection_timeout"`
}

type Resource

type Resource struct {
	*pgxpool.Pool
	// contains filtered or unexported fields
}

func NewResource

func NewResource(config PlatformConfig, options ...Option) *Resource

func (*Resource) Name

func (r *Resource) Name() string

func (*Resource) Start

func (r *Resource) Start(ctx context.Context) error

func (*Resource) Stop

func (r *Resource) Stop(ctx context.Context) error

Jump to

Keyboard shortcuts

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