Documentation
¶
Overview ¶
Package postgresqlmeta implements metadata-aware audit adapters over PostgreSQL. input: connection configs for PostgreSQL metadata reads output: pgx stdlib database/sql handles for metadata providers pos: infrastructure connection opener for PostgreSQL metadata access note: if this file changes, update this header and module README.md.
Package postgresqlmeta implements metadata-aware audit adapters over PostgreSQL. input: sql.DB access plus version/schema/table lookup requests and PostgreSQL catalog queries output: normalized instance facts, dialect detection, schema discovery, table snapshots, and plan estimates for application-level audit enrichment pos: infrastructure metadata adapter between database/sql and domain metadata specs note: if this file changes, update this header and module README.md.
Index ¶
- func OpenDB(config ConnectionConfig) (*sql.DB, error)
- type ConnectionConfig
- type Provider
- func (p *Provider) DetectDialect(ctx context.Context) (spec.Dialect, error)
- func (p *Provider) FindSchemasForTable(ctx context.Context, table string) ([]string, error)
- func (p *Provider) LoadInstanceFacts(ctx context.Context, _ spec.Dialect, _ string) (*spec.InstanceFacts, error)
- func (p *Provider) LoadPlanEstimate(ctx context.Context, statement spec.Statement) (*spec.ImpactEstimate, error)
- func (p *Provider) LoadTableSnapshot(ctx context.Context, _ spec.Dialect, schema string, table string) (*spec.TableSnapshot, error)
- func (p *Provider) ResolveTableForIndex(ctx context.Context, _ spec.Dialect, schema string, index string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionConfig ¶
type ConnectionConfig struct {
Host string
Port int
Socket string
Database string
User string
Password string
SSLMode string
}
ConnectionConfig describes one PostgreSQL metadata connection.
func (ConnectionConfig) Address ¶
func (c ConnectionConfig) Address() string
Address reports the driver address for the connection.
func (ConnectionConfig) DSN ¶
func (c ConnectionConfig) DSN() string
DSN formats the config for the pgx database/sql driver.
func (ConnectionConfig) DatabaseName ¶
func (c ConnectionConfig) DatabaseName() string
DatabaseName reports the configured database or the PostgreSQL default.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider loads metadata facts through a PostgreSQL SQL connection.
func NewProvider ¶
NewProvider builds a metadata provider on top of an existing SQL handle.
func (*Provider) DetectDialect ¶
DetectDialect reads server version information and classifies the SQL dialect.
func (*Provider) FindSchemasForTable ¶
FindSchemasForTable lists schemas that currently contain the named table.
func (*Provider) LoadInstanceFacts ¶
func (p *Provider) LoadInstanceFacts(ctx context.Context, _ spec.Dialect, _ string) (*spec.InstanceFacts, error)
LoadInstanceFacts reads server-level settings that influence audit behavior.
func (*Provider) LoadPlanEstimate ¶
func (p *Provider) LoadPlanEstimate(ctx context.Context, statement spec.Statement) (*spec.ImpactEstimate, error)
LoadPlanEstimate reads a conservative row estimate using plain EXPLAIN output.