catalog

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: 5 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 source.postgres implements the PostgreSQL replication source: a single logical-decoding reader (pgoutput) that decodes row changes into rowchange.Change, positions them at their commit LSN, and exposes the synced and confirmed positions for the DBLog watermark logic. The snapshot path reuses the source-agnostic DBLog orchestrator.

Package catalog reads a table's shape from the PostgreSQL catalogs (its columns, types and primary key), maps it to the canonical schema, and quotes identifiers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalSchema

func CanonicalSchema(tbl *TableState) (core.Schema, error)

CanonicalSchema derives the canonical core.Schema from the introspected table. Mappable columns map to their canonical kind; unmappable ones are carried as KindUnknown so a declared cast can land them explicitly — never silent coercion. The source knows nothing about any sink.

func QuoteIdent

func QuoteIdent(s string) string

QuoteIdent quotes one identifier, doubling embedded quotes.

func QuoteIdents

func QuoteIdents(cols []string) []string

QuoteIdents quotes each identifier.

Types

type Column

type Column struct {
	Name string
	// DataType is the SQL-standard BASE type WITHOUT a modifier
	// ("character varying", "numeric", "timestamp with time zone") — the form
	// every switch compares against and every `?::<type>` cast accepts.
	DataType string
	// RawType is format_type with the modifier ("character varying(64)",
	// "numeric(10,2)"), kept only so decimal precision/scale can be parsed
	// (issue #561).
	RawType string
	NotNull bool // attnotnull: the column cannot hold NULL
}

Column is one introspected source column.

type TableState

type TableState struct {
	Schema    string
	Name      string
	Columns   []Column
	PKColumns []int
}

TableState is the introspection result for one source table: the ordered column list and the primary key column indexes, so row decoding and Iceberg schema derivation share one path.

func QueryTable

func QueryTable(ctx context.Context, db *sql.DB, schemaName, tableName string) (*TableState, error)

QueryTable introspects one table via pg_catalog, producing the column order the pgoutput relation messages follow.

func (*TableState) FindColumn

func (t *TableState) FindColumn(name string) int

FindColumn returns the column index by name, or -1.

Jump to

Keyboard shortcuts

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