pg

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 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 Config

type Config struct {
	Database string `envconfig:"PG_DB_NAME"`
	Host     string `envconfig:"PG_HOST"`
	Password string `envconfig:"PG_PASSWORD"`
	Port     int    `envconfig:"PG_PORT" default:"5432"`
	SslMode  string `envconfig:"PG_SSL_MODE" default:"disable"`
	User     string `envconfig:"PG_USER"`
}

Config represents configuration for PostgreSQL connection

func FromContext added in v0.1.12

func FromContext(ctx context.Context) Config

FromContext will return the Config carried in the provided Context.

It panics if config is not available on the current context.

func NewConfig

func NewConfig() *Config

NewConfig returns a new Config instance

func (Config) Context added in v0.1.12

func (cfg Config) Context(ctx context.Context) context.Context

Context returns a new Context that carries the provided Config.

func (Config) FormatDSN

func (c Config) FormatDSN() string

FormatDSN formats the given Config into a DSN string which can be passed to the driver.

Jump to

Keyboard shortcuts

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