ingestruri

package
v0.11.708 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ingestruri resolves connection names into ingestr URIs.

It lives outside pkg/ingestr because pkg/ingestr imports pkg/python, and pkg/python needs this resolution too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CDC

func CDC(uri string) (string, error)

CDC rewrites uri onto its change-data-capture scheme, and fails when the scheme has no CDC counterpart.

func CDCScheme

func CDCScheme(scheme string) (string, bool)

CDCScheme maps scheme onto ingestr's change-data-capture scheme and reports whether the scheme supports CDC at all.

This is not a plain "+cdc" suffix: PostgreSQL's ingestr URI uses the "postgresql" scheme but its CDC scheme is "postgres+cdc".

Supported today: PostgreSQL, the MySQL family (mysql, mariadb), Vitess, PlanetScale (ps_mysql), MongoDB (mongodb, mongodb+srv), and SQL Server (mssql).

MongoDB and SQL Server both follow the plain "+cdc" suffix rule, which yields exactly what ingestr expects: "mongodb+cdc", "mongodb+srv+cdc", "mssql+cdc". SQL Server Change Tracking ("mssql+ct") is not selected here because it depends on an asset parameter rather than the scheme alone; the ingestr operator swaps the suffix for that mode.

func ForConnection

func ForConnection(ctx context.Context, conn config.ConnectionGetter, role, name string) (string, error)

ForConnection resolves name through conn and returns its ingestr URI.

role describes the connection's part in the transfer ("source", "destination") and is only used to build error messages. It may be empty.

The returned URI is not normalized; call Normalize when the URI is handed to ingestr as a source.

func Normalize

func Normalize(uri string) string

Normalize ensures the URI carries the "//" authority separator after its scheme. Some source configs build URIs without a Host, which makes Go's url.URL.String() emit "scheme:?params" rather than "scheme://?params".

func Parse

func Parse(uri string) (*url.URL, error)

Parse parses an ingestr URI.

url.Parse rejects schemes containing an underscore (PlanetScale's ps_mysql), so the scheme is split off by hand, the remainder parsed under a placeholder, and the real scheme restored. This mirrors how ingestr parses its own MySQL-family URIs.

Types

type Connection

type Connection interface {
	GetIngestrURI() (string, error)
}

Connection is implemented by every connection type that ingestr can talk to.

Jump to

Keyboard shortcuts

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