connect

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 14 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 connect resolves the source's connection settings, from a URI or from the nested spec, into one pgx config that the query pool and the replication connection share, including TLS and the SSH tunnel.

Index

Constants

View Source
const (

	// DefaultInitialWait and minInitialWait bound the CDC initial WAL wait.
	DefaultInitialWait = 300 * time.Second
)

Defaults applied when the operator leaves a tuning field unset on the nested postgres block. Both mirror the OLake reference behavior.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueryURI is the libpq DSN rendered from the config. It is what travels
	// to a distributed worker (the worker only receives kind + dsn).
	QueryURI string
	// ConnConfig is the native pgx config for replication and query
	// connections. It carries TLSConfig (built by pgx from the DSN) and
	// DialFunc (SSH) so both connection paths share one transport.
	ConnConfig *pgx.ConnConfig
	// MaxOpenConns is the resolved maxThreads value.
	MaxOpenConns int
	// RetryCount is the resolved number of transient-connection retries.
	RetryCount int
	// InitialWaitTime is the resolved CDC initial-WAL-message wait.
	InitialWaitTime time.Duration
	// Plugin is the resolved logical decoding plugin ("pgoutput"|"wal2json").
	Plugin string
	// contains filtered or unexported fields
}

Config holds the resolved connection parameters, built from either a URI or the nested PostgresSource config.

func Build

func Build(uri string) (*Config, error)

Build constructs a Config from a URI string.

func BuildFromPostgres

func BuildFromPostgres(pg *spec.PostgresSource) (*Config, error)

BuildFromPostgres constructs a Config from the nested PostgresSource config. When present, source.uri is ignored for connection building.

The config is created by pgx.ParseConfig on the rendered DSN — never by hand. pgx's ConnectConfig panics on a config it did not create, and it also needs RuntimeParams initialized (Reader.New writes "replication" into it). Parsing the DSN also gets pgx's native TLS handling for free (require, verify-ca and verify-full all follow libpq semantics, including loading the CA and client cert/key). Only the SSH DialFunc is layered on afterwards.

func (*Config) Close

func (c *Config) Close() error

Close tears down the SSH tunnel, if one was established. Safe to call multiple times.

Jump to

Keyboard shortcuts

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