Documentation
¶
Index ¶
- type Column
- type ConnectionConfig
- type ConnectorManager
- func (cm *ConnectorManager) Connect(cfg ConnectionConfig) error
- func (cm *ConnectorManager) ConnectDefault(cfg ConnectionConfig) error
- func (cm *ConnectorManager) Disconnect(id string) error
- func (cm *ConnectorManager) DisconnectAll() error
- func (cm *ConnectorManager) GetConnection(id string) (*sqlx.DB, error)
- func (cm *ConnectorManager) GetDefaultConnection() (*sqlx.DB, error)
- func (cm *ConnectorManager) ListConnections() []string
- func (cm *ConnectorManager) TestConnection(cfg ConnectionConfig) error
- type Crypto
- type QueryExecutor
- type QueryResult
- type SchemaExtractor
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct {
Name string `json:"name"`
Type string `json:"type"`
Nullable bool `json:"nullable"`
PrimaryKey bool `json:"primary_key"`
ForeignKey string `json:"foreign_key,omitempty"`
}
Column represents a table column
type ConnectionConfig ¶
type ConnectionConfig struct {
ID string
DBType string // postgres, mysql
Host string
Port int
Database string
Username string
Password string
}
ConnectionConfig holds database connection parameters
type ConnectorManager ¶
type ConnectorManager struct {
// contains filtered or unexported fields
}
ConnectorManager manages multiple database connections
func NewConnectorManager ¶
func NewConnectorManager() *ConnectorManager
NewConnectorManager creates a new connector manager
func (*ConnectorManager) Connect ¶
func (cm *ConnectorManager) Connect(cfg ConnectionConfig) error
Connect establishes a new database connection
func (*ConnectorManager) ConnectDefault ¶
func (cm *ConnectorManager) ConnectDefault(cfg ConnectionConfig) error
ConnectDefault connects to database using default connection ID
func (*ConnectorManager) Disconnect ¶
func (cm *ConnectorManager) Disconnect(id string) error
Disconnect closes and removes a connection
func (*ConnectorManager) DisconnectAll ¶
func (cm *ConnectorManager) DisconnectAll() error
DisconnectAll closes all connections
func (*ConnectorManager) GetConnection ¶
func (cm *ConnectorManager) GetConnection(id string) (*sqlx.DB, error)
GetConnection retrieves a connection by ID
func (*ConnectorManager) GetDefaultConnection ¶
func (cm *ConnectorManager) GetDefaultConnection() (*sqlx.DB, error)
GetDefaultConnection retrieves the default connection
func (*ConnectorManager) ListConnections ¶
func (cm *ConnectorManager) ListConnections() []string
ListConnections returns all active connection IDs
func (*ConnectorManager) TestConnection ¶
func (cm *ConnectorManager) TestConnection(cfg ConnectionConfig) error
TestConnection tests if a connection can be established
type Crypto ¶
type Crypto struct {
// contains filtered or unexported fields
}
Crypto handles encryption/decryption of sensitive data
type QueryExecutor ¶
type QueryExecutor struct {
// contains filtered or unexported fields
}
QueryExecutor executes read-only SQL queries
func NewQueryExecutor ¶
func NewQueryExecutor(db *sqlx.DB, maxRows int, timeoutSeconds int) *QueryExecutor
NewQueryExecutor creates a new query executor
func (*QueryExecutor) Execute ¶
func (qe *QueryExecutor) Execute(sql string) (*QueryResult, error)
Execute executes a SQL query with safety checks
type QueryResult ¶
type QueryResult struct {
Columns []string `json:"columns"`
Rows []map[string]interface{} `json:"rows"`
RowCount int `json:"row_count"`
ExecutionTimeMs int64 `json:"execution_time_ms"`
}
QueryResult represents the result of a query execution
type SchemaExtractor ¶
type SchemaExtractor struct {
// contains filtered or unexported fields
}
SchemaExtractor extracts database schema information
func NewSchemaExtractor ¶
func NewSchemaExtractor(db *sqlx.DB, dbType string) *SchemaExtractor
NewSchemaExtractor creates a new schema extractor
func (*SchemaExtractor) FormatSchemaForLLM ¶
func (se *SchemaExtractor) FormatSchemaForLLM() (string, error)
FormatSchemaForLLM formats schema as text for LLM prompt
func (*SchemaExtractor) GetFullSchema ¶
func (se *SchemaExtractor) GetFullSchema() ([]Table, error)
GetFullSchema retrieves schema for all tables
func (*SchemaExtractor) GetTableSchema ¶
func (se *SchemaExtractor) GetTableSchema(tableName string) (*Table, error)
GetTableSchema retrieves detailed schema for a specific table
func (*SchemaExtractor) GetTables ¶
func (se *SchemaExtractor) GetTables() ([]string, error)
GetTables retrieves all tables in the database