postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSNOption

type DSNOption func(*PostgreSQLDSN)

DSNOption defines a function that configures a PostgreSQLDSN.

func WithAddr

func WithAddr(addr string) DSNOption

WithAddr sets the address for the DSN.

func WithDBName

func WithDBName(dbname string) DSNOption

WithDBName sets the database name for the DSN.

func WithPassword

func WithPassword(password string) DSNOption

WithPassword sets the password for the DSN.

func WithPort

func WithPort(port int) DSNOption

WithPort sets the port for the DSN.

func WithSSLMode

func WithSSLMode(sslmode SSLMode) DSNOption

WithSSLMode sets the SSL mode for the DSN.

func WithUsername

func WithUsername(username string) DSNOption

WithUsername sets the username for the DSN.

type PostgreSQLDSN

type PostgreSQLDSN struct {
	Addr     string  `json:"addr"`
	Port     int     `json:"port"`
	Username string  `json:"username"`
	Password string  `json:"password"`
	DBName   string  `json:"dbname"`
	SSLMode  SSLMode `json:"sslmode"`
}

func NewDSN

func NewDSN(opts ...DSNOption) *PostgreSQLDSN

NewDSN creates a new PostgreSQLDSN with the given options.

func (PostgreSQLDSN) DSN

func (p PostgreSQLDSN) DSN() string

func (*PostgreSQLDSN) Info

func (p *PostgreSQLDSN) Info() string

Info implements database.DataSourceNamer.

func (PostgreSQLDSN) Type

func (p PostgreSQLDSN) Type() database.Type

Type implements database.DataSourceNamer.

type SSLMode

type SSLMode string
const (
	SSLModeDisable  SSLMode = "disable"
	SSLModeRequire  SSLMode = "require"
	SSLModeVerify   SSLMode = "verify-ca"
	SSLModeVerifyCA SSLMode = "verify-full"
)

Jump to

Keyboard shortcuts

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