postgres

package
v0.0.0-...-8cc97d5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package postgres implements a DDL parser for PostgreSQL using pg_query_go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Introspect

func Introspect(ctx context.Context, dsn string) (*schema.Schema, error)

Introspect connects to a running Postgres database and builds a Schema IR by querying information_schema and pg_catalog. The DSN should be a standard Postgres connection string (e.g., "postgres://user:pass@localhost:5432/dbname").

func IntrospectDB

func IntrospectDB(ctx context.Context, db *sql.DB) (*schema.Schema, error)

IntrospectDB builds a Schema IR from an existing database connection. Useful when you already have a *sql.DB handle.

Types

type Parser

type Parser struct{}

Parser implements schema.Parser for PostgreSQL DDL.

func (*Parser) ParseDir

func (p *Parser) ParseDir(dir string) (*schema.Schema, error)

func (*Parser) ParseFile

func (p *Parser) ParseFile(path string) (*schema.Schema, error)

func (*Parser) ParseString

func (p *Parser) ParseString(sql string) (*schema.Schema, error)

Jump to

Keyboard shortcuts

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