pgdsn

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pgdsn builds libpq keyword/value connection strings.

It exists so the quoting rule has one implementation. Two subsystems hand a DSN to DuckDB's postgres scanner — internal/cdc (ATTACH, for CDC export) and internal/federated (postgres_scan, for the federated read path) — and an unquoted value is two bugs at once: a password containing a space produces a DSN libpq cannot parse, and the credential scrubber in internal/redact cannot tell where an unquoted value ends, so it truncates at the first separator and leaks the tail (#301).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(p Params) string

Build renders a libpq keyword/value DSN with every string value quoted, so values containing spaces or quotes survive parsing by pgx and by DuckDB's postgres scanner.

func Quote

func Quote(v string) string

Quote wraps a value in single quotes, escaping backslashes and single quotes with a backslash as libpq requires.

The escaping order matters: backslashes first, then quotes, so the backslash introduced for an escaped quote is not itself doubled.

Types

type Params

type Params struct {
	Host     string
	Port     int
	User     string
	Password string
	DB       string
	SSLMode  string
}

Params are the inputs for a libpq keyword/value connection string.

Jump to

Keyboard shortcuts

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