postgresql

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 6 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 {
	Host     string
	User     string
	Password string
	Name     string
	Port     int

	SSLMode     string
	SSLRootCert string
	SSLKey      string
	SSLCert     string
	SSLInline   bool

	flags.FlagSet
}

func NewConfig

func NewConfig(flagSet *pflag.FlagSet, opts ...Option) *Config

func (*Config) Connect

func (cfg *Config) Connect() (*sqlx.DB, error)

Connect attempts to connect to the database.

func (*Config) DSN added in v0.0.3

func (cfg *Config) DSN() (string, error)

DSN will return the DSN string.

type Option added in v0.0.4

type Option func(*options)

Option is used to customize

func WithPrefix added in v0.0.4

func WithPrefix(prefix string) Option

WithPrefix sets the prefix name to use for environment variables and flags. Useful if your app has to connect to multiple databases.

Jump to

Keyboard shortcuts

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