Documentation
¶
Index ¶
- type ColumnInfo
- type Connection
- type ConnectionImpl
- func (c *ConnectionImpl) Close()
- func (c *ConnectionImpl) DescribeTable(ctx context.Context, schema, tableName string) (*TableInfo, error)
- func (c *ConnectionImpl) EnsureConnection(ctx context.Context)
- func (c *ConnectionImpl) Exec(ctx context.Context, sql string, args ...interface{}) error
- func (c *ConnectionImpl) GetDatabaseInfo(ctx context.Context) (*DatabaseInfo, error)
- func (c *ConnectionImpl) GetForeignKeys(ctx context.Context, schema, tableName string) ([]ForeignKeyInfo, error)
- func (c *ConnectionImpl) ListTables(ctx context.Context) ([]TableInfo, error)
- func (c *ConnectionImpl) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
- func (c *ConnectionImpl) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
- func (c *ConnectionImpl) SearchColumns(ctx context.Context, pattern string) ([]ColumnInfo, error)
- type DatabaseInfo
- type ForeignKeyInfo
- type IndexInfo
- type TableInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
Name string
DataType string
IsNullable bool
Default string
IsPrimaryKey bool
Description string
}
ColumnInfo represents information about a table column
type Connection ¶
type Connection interface {
// Schema operations
ListTables(ctx context.Context) ([]TableInfo, error)
DescribeTable(ctx context.Context, schema, tableName string) (*TableInfo, error)
GetForeignKeys(ctx context.Context, schema, tableName string) ([]ForeignKeyInfo, error)
SearchColumns(ctx context.Context, pattern string) ([]ColumnInfo, error)
// Query operations
Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
EnsureConnection(ctx context.Context)
}
Connection interface defines all database operations available to other packages This allows for dependency injection and easier testing with mocks
type ConnectionImpl ¶
type ConnectionImpl struct {
// contains filtered or unexported fields
}
ConnectionImpl wraps a PostgreSQL connection pool and implements the Connection interface
func (*ConnectionImpl) Close ¶
func (c *ConnectionImpl) Close()
Close closes the database connection pool
func (*ConnectionImpl) DescribeTable ¶
func (c *ConnectionImpl) DescribeTable(ctx context.Context, schema, tableName string) (*TableInfo, error)
DescribeTable returns detailed information about a specific table
func (*ConnectionImpl) EnsureConnection ¶
func (c *ConnectionImpl) EnsureConnection(ctx context.Context)
EnsureConnection ensures we have a healthy database connection pool
func (*ConnectionImpl) Exec ¶
func (c *ConnectionImpl) Exec(ctx context.Context, sql string, args ...interface{}) error
Exec executes a query without returning any rows
func (*ConnectionImpl) GetDatabaseInfo ¶
func (c *ConnectionImpl) GetDatabaseInfo(ctx context.Context) (*DatabaseInfo, error)
GetDatabaseInfo returns basic information about the connected database
func (*ConnectionImpl) GetForeignKeys ¶
func (c *ConnectionImpl) GetForeignKeys(ctx context.Context, schema, tableName string) ([]ForeignKeyInfo, error)
GetForeignKeys returns foreign key relationships for a table
func (*ConnectionImpl) ListTables ¶
func (c *ConnectionImpl) ListTables(ctx context.Context) ([]TableInfo, error)
ListTables returns all tables and views in the database
func (*ConnectionImpl) Query ¶
func (c *ConnectionImpl) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
Query executes a query and returns the rows
func (*ConnectionImpl) SearchColumns ¶
func (c *ConnectionImpl) SearchColumns(ctx context.Context, pattern string) ([]ColumnInfo, error)
SearchColumns searches for columns matching a pattern across all tables
type DatabaseInfo ¶
DatabaseInfo holds information about the connected database
type ForeignKeyInfo ¶
type ForeignKeyInfo struct {
TableSchema string
TableName string
ColumnName string
ForeignTableSchema string
ForeignTableName string
ForeignColumnName string
ConstraintName string
}
ForeignKeyInfo represents foreign key relationships