catalog

package
v1.44.1 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

func NewCatalog

func NewCatalog(conn *pgx.Conn, schemas []string) (*Catalog, error)

func (*Catalog) CompositeTypes added in v1.20.0

func (c *Catalog) CompositeTypes(ctx context.Context) (*orderedmap.Map[string, *model.CompositeType], error)

func (*Catalog) Domains added in v0.12.0

func (c *Catalog) Domains(ctx context.Context) (*orderedmap.Map[string, *model.Domain], error)

func (*Catalog) Enums added in v0.9.0

func (c *Catalog) Enums(ctx context.Context) (*orderedmap.Map[string, *model.Enum], error)

func (*Catalog) ListColumnsByTables added in v1.39.0

func (c *Catalog) ListColumnsByTables(ctx context.Context, tables []*model.Table) (map[uint32][]*model.Column, error)

ListColumnsByTables returns the columns of the given tables, keyed by table OID and in attnum order. One query serves every table; reading them one at a time cost a round trip per table.

func (*Catalog) ListCompositeTypes added in v1.20.0

func (c *Catalog) ListCompositeTypes(ctx context.Context) ([]*model.CompositeType, error)

func (*Catalog) ListConstraintsByTables added in v1.39.0

func (c *Catalog) ListConstraintsByTables(ctx context.Context, tables []*model.Table) (map[uint32][]*model.Constraint, map[uint32][]*model.ForeignKey, error)

ListConstraintsByTables returns the table constraints and the foreign keys of the given tables, each keyed by table OID and in contype then name order. One query serves every table.

func (*Catalog) ListDomains added in v0.12.0

func (c *Catalog) ListDomains(ctx context.Context) ([]*model.Domain, error)

func (*Catalog) ListEnums added in v0.9.0

func (c *Catalog) ListEnums(ctx context.Context) ([]*model.Enum, error)

func (*Catalog) ListIndexes

func (c *Catalog) ListIndexes(ctx context.Context) ([]*model.Index, error)

func (*Catalog) ListPoliciesByTables added in v1.39.0

func (c *Catalog) ListPoliciesByTables(ctx context.Context, tables []*model.Table) (map[uint32][]*model.Policy, error)

ListPoliciesByTables returns the row-level security policies attached to the given tables, keyed by table OID and in pg_policy.polname order. One query serves every table.

func (*Catalog) ListRoutines added in v1.30.0

func (c *Catalog) ListRoutines(ctx context.Context) ([]*model.Routine, error)

ListRoutines returns the functions and procedures pistachio manages.

Each row is read as the CREATE statement pg_get_functiondef renders and handed to the same parser the desired schema goes through, so both sides of the diff produce the same model and render through the same SQL writer. That is what keeps a dump fed back as the desired schema planning clean, without the definition-text normalization views and triggers need.

Aggregates (prokind 'a') and window functions (prokind 'w') are left out, as is a routine with a SQL-standard body (BEGIN ATOMIC): such a body records pg_depend entries on whatever it reads, which contradicts the order pistachio creates routines in. The parser skips the same ones, so neither side of the diff sees them.

func (*Catalog) ListSequences added in v1.17.0

func (c *Catalog) ListSequences(ctx context.Context) ([]*model.Sequence, error)

ListSequences returns all sequences in the filtered schemas, including those owned by serial/identity columns. OwnerTable/OwnerColumn identify the owning column (nil for standalone sequences).

func (*Catalog) ListTables

func (c *Catalog) ListTables(ctx context.Context) ([]*model.Table, error)

func (*Catalog) ListTriggers added in v1.29.0

func (c *Catalog) ListTriggers(ctx context.Context) ([]*model.Trigger, error)

ListTriggers returns the triggers on the tables and views in the catalog's schemas. Both relation kinds come from one query, the way ListIndexes serves tables and materialized views together.

func (*Catalog) ListViews

func (c *Catalog) ListViews(ctx context.Context) ([]*model.View, error)

func (*Catalog) Routines added in v1.30.0

func (c *Catalog) Routines(ctx context.Context) (*orderedmap.Map[string, *model.Routine], error)

Routines returns the managed functions and procedures in the filtered schemas, keyed by FQRN.

func (*Catalog) Sequences

func (c *Catalog) Sequences(ctx context.Context) (*orderedmap.Map[string, *model.Sequence], error)

Sequences returns the standalone sequences in the filtered schemas, keyed by FQN. Sequences owned by a table column (serial or identity) are excluded: they are managed as column attributes, not as standalone objects.

func (*Catalog) Tables

func (c *Catalog) Tables(ctx context.Context) (*orderedmap.Map[string, *model.Table], error)

func (*Catalog) Views

func (c *Catalog) Views(ctx context.Context) (*orderedmap.Map[string, *model.View], error)

Jump to

Keyboard shortcuts

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