Documentation
¶
Index ¶
- type ByRevLen
- type DB
- func Connect(driverName, dataSourceName string) (*DB, error)
- func ConnectContext(ctx context.Context, driverName, dataSourceName string) (*DB, error)
- func MustConnect(driverName, dataSourceName string) *DB
- func MustOpen(driverName, dataSourceName string) *DB
- func NewDb(db *sql.DB, driverName string) *DB
- func Open(driverName, dataSourceName string) (*DB, error)
- type JoinColumn
- type JoinInfo
- type NamedStmt
- type PathHint
- type PathInferenceEngine
- type QueryAnalysis
- type Result
- type Row
- type Rows
- type Stmt
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB is a wrapper around sqlx.DB
func ConnectContext ¶
ConnectContext opens a database connection and verifies with a ping, using the provided context.
func MustConnect ¶
MustConnect is the same as Connect, but panics on error.
type JoinColumn ¶
JoinColumn represents column information in a join condition
type JoinInfo ¶
type JoinInfo struct {
LeftAlias string
LeftTable string
RightAlias string
RightTable string
JoinType string // "LEFT", "INNER", "RIGHT", etc.
Condition string
OnColumns []JoinColumn
}
JoinInfo represents information about a JOIN clause
type PathInferenceEngine ¶
type PathInferenceEngine struct {
// contains filtered or unexported fields
}
PathInferenceEngine infers JSON paths from query structure
func NewPathInferenceEngine ¶
func NewPathInferenceEngine(metadata metadata.MetadataReader) *PathInferenceEngine
NewPathInferenceEngine creates a new path inference engine
func (*PathInferenceEngine) InferPaths ¶
func (e *PathInferenceEngine) InferPaths(analysis *QueryAnalysis, columns []string) (map[string]string, error)
InferPaths generates JSON paths for query columns based on metadata and query structure
func (*PathInferenceEngine) InferPathsWithFallback ¶
func (e *PathInferenceEngine) InferPathsWithFallback(analysis *QueryAnalysis, columns []string) map[string]string
InferPathsWithFallback is a helper that provides fallback behavior
func (*PathInferenceEngine) ValidatePaths ¶
func (e *PathInferenceEngine) ValidatePaths(paths map[string]string) error
ValidatePaths checks if inferred paths are valid
type QueryAnalysis ¶
type QueryAnalysis struct {
Tables map[string]string // alias -> table name
Joins []JoinInfo
PathHints map[string]string // alias -> path override
}
QueryAnalysis contains the parsed query structure
func AnalyzeQuery ¶
func AnalyzeQuery(sql string) (*QueryAnalysis, error)
AnalyzeQuery parses a SQL query to extract structure information Uses Vitess SQL parser to correctly handle subqueries, CTEs, and complex expressions Falls back to regex parsing if SQL parsing fails (e.g., for non-standard SQL)
func (*QueryAnalysis) GetJoinForTable ¶
func (a *QueryAnalysis) GetJoinForTable(alias string) *JoinInfo
GetJoinForTable returns join information for a table alias
func (*QueryAnalysis) GetTableForAlias ¶
func (a *QueryAnalysis) GetTableForAlias(alias string) (string, bool)
GetTableForAlias returns the table name for a given alias