adapters

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Connect(connString string) error
	Close()
	FetchSchema(g *graph.Graph) error
	GetMetrics() (*graph.DBMetrics, error)
	GetColumnDependencies(schema, table, column string) ([]graph.ColumnDependency, error)
	GetTableDependencies(schema, table string) ([]graph.ColumnDependency, error)
	GetTopQueries(limit int, sortBy string) ([]graph.QueryStats, error)
	TraceQuery(query string) (*graph.TraceResult, error)
}

Adapter is the interface that all database adapters must implement

func NewAdapter

func NewAdapter(connString string) (Adapter, error)

NewAdapter creates a new adapter based on the connection string scheme

type PostgresAdapter

type PostgresAdapter struct {
	Pool *pgxpool.Pool
}

PostgresAdapter handles PostgreSQL interactions

func NewPostgresAdapter

func NewPostgresAdapter() *PostgresAdapter

NewPostgresAdapter creates a new postgres adapter

func (*PostgresAdapter) Close

func (p *PostgresAdapter) Close()

Close closes the connection pool

func (*PostgresAdapter) Connect

func (p *PostgresAdapter) Connect(connString string) error

Connect establishes a connection to the database

func (*PostgresAdapter) FetchSchema

func (p *PostgresAdapter) FetchSchema(g *graph.Graph) error

FetchSchema queries the database schema and populates the graph

func (*PostgresAdapter) GetColumnDependencies

func (p *PostgresAdapter) GetColumnDependencies(schema, table, column string) ([]graph.ColumnDependency, error)

GetColumnDependencies identifies all objects that depend on a specific column

func (*PostgresAdapter) GetMetrics

func (p *PostgresAdapter) GetMetrics() (*graph.DBMetrics, error)

GetMetrics returns real-time database statistics

func (*PostgresAdapter) GetTableDependencies

func (p *PostgresAdapter) GetTableDependencies(schema, table string) ([]graph.ColumnDependency, error)

GetTableDependencies identifies all objects that depend on a specific table

func (*PostgresAdapter) GetTopQueries

func (p *PostgresAdapter) GetTopQueries(limit int, sortBy string) ([]graph.QueryStats, error)

GetTopQueries fetches the top costly queries from pg_stat_statements

func (*PostgresAdapter) TraceQuery

func (p *PostgresAdapter) TraceQuery(query string) (*graph.TraceResult, error)

TraceQuery executes a query with EXPLAIN (ANALYZE, BUFFERS) and returns performance data

Jump to

Keyboard shortcuts

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