ddl

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseDir

func ParseDir(dir string) ([]*pg_query.ParseResult, []diagnostic.Diagnostic)

ParseDir parses all .sql files in the given directory using pg_query_go.

Types

type ForeignKey

type ForeignKey struct {
	Column    string
	RefTable  string
	RefColumn string
}

ForeignKey represents a foreign key relationship.

type Index

type Index struct {
	Name     string
	Columns  []string
	IsUnique bool
}

Index represents a database index.

type Table

type Table struct {
	Name        string
	Columns     map[string]string // column_name → Go type
	ColumnOrder []string          // DDL definition order
	ForeignKeys []ForeignKey
	Indexes     []Index
	PrimaryKey  []string
	VarcharLen  map[string]int      // column → VARCHAR(N)
	CheckEnums  map[string][]string // column → CHECK IN values
}

Table holds parsed metadata for a single DDL table.

func ParseTables

func ParseTables(dir string) ([]Table, []diagnostic.Diagnostic)

ParseTables reads all .sql files in dir and returns parsed tables.

Jump to

Keyboard shortcuts

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