Documentation
¶
Index ¶
- func CreateTableNameFromTablePathExpressionNode(node *googlesql.ASTTablePathExpression) (string, bool)
- func ListAstNode[T googlesql.ASTNode](n *googlesql.ASTScript) []T
- func ListResolvedAstNode[T googlesql.ResolvedNode](output *googlesql.AnalyzerOutput) []T
- func LookupNode[T astNode](n googlesql.ASTNode) (T, bool)
- func ParseLocEnd(loc *googlesql.ParseLocationRange) int
- func ParseLocStart(loc *googlesql.ParseLocationRange) int
- func SearchAstNode[T googlesql.ASTNode](node googlesql.ASTNode, termOffset int) (T, bool)
- func SearchResolvedAstNode[T googlesql.ResolvedNode](output *googlesql.AnalyzerOutput, termOffset int) (T, bool)
- func Walk(node googlesql.ASTNode, fn func(googlesql.ASTNode) error) error
- func WalkResolved(node googlesql.ResolvedNode, fn func(googlesql.ResolvedNode) error) error
- type Analyzer
- func (a *Analyzer) AnalyzeStatement(rawText string, stmt googlesql.ASTStatementNode, catalog *Catalog) (*googlesql.AnalyzerOutput, error)
- func (a *Analyzer) GetTableMetadataFromPath(ctx context.Context, path string) (*bq.TableMetadata, error)
- func (a *Analyzer) ParseFile(uri lsp.DocumentURI, src string) ParsedFile
- type Catalog
- func (c *Catalog) AddFunctionWithName(name string, fn *googlesql.Function)
- func (c *Catalog) CatalogNode() *googlesql.SimpleCatalog
- func (c *Catalog) Clone() *Catalog
- func (c *Catalog) EnsureTable(path []string) error
- func (c *Catalog) FindTableMetadata(path string) (*bq.TableMetadata, error)
- func (c *Catalog) PreloadTablesFromAST(node *googlesql.ASTScript)
- func (c *Catalog) TypeFactory() *googlesql.TypeFactory
- type Error
- type FixOffset
- type ParsedFile
- func (p ParsedFile) Close()
- func (p ParsedFile) ExtractSQL(locationRange *googlesql.ParseLocationRange) (string, bool)
- func (p *ParsedFile) FindIncompleteColumnName(pos lsp.Position) string
- func (p *ParsedFile) FindTargetAnalyzeOutput(termOffset int) (*googlesql.AnalyzerOutput, bool)
- func (p ParsedFile) FindTargetStatementNode(termOffset int) (googlesql.ASTStatementNode, bool)
- func (p ParsedFile) TermOffset(pos lsp.Position) int
- func (p ParsedFile) ToLspRange(r *googlesql.ParseLocationRange) (lsp.Range, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTableNameFromTablePathExpressionNode ¶
func CreateTableNameFromTablePathExpressionNode(node *googlesql.ASTTablePathExpression) (string, bool)
func ListResolvedAstNode ¶
func ListResolvedAstNode[T googlesql.ResolvedNode](output *googlesql.AnalyzerOutput) []T
func LookupNode ¶
func ParseLocEnd ¶ added in v0.5.0
func ParseLocEnd(loc *googlesql.ParseLocationRange) int
func ParseLocStart ¶ added in v0.5.0
func ParseLocStart(loc *googlesql.ParseLocationRange) int
ParseLocStart/End are exported wrappers for use from other packages.
func SearchAstNode ¶
func SearchResolvedAstNode ¶
func SearchResolvedAstNode[T googlesql.ResolvedNode](output *googlesql.AnalyzerOutput, termOffset int) (T, bool)
func Walk ¶ added in v0.5.0
Walk traverses an ASTNode tree in depth-first order, calling fn for each node. If fn returns an error, Walk stops and returns that error.
func WalkResolved ¶ added in v0.5.0
func WalkResolved(node googlesql.ResolvedNode, fn func(googlesql.ResolvedNode) error) error
WalkResolved traverses a ResolvedNode tree in depth-first order.
Types ¶
type Analyzer ¶
type Analyzer struct {
// contains filtered or unexported fields
}
func (*Analyzer) AnalyzeStatement ¶
func (a *Analyzer) AnalyzeStatement(rawText string, stmt googlesql.ASTStatementNode, catalog *Catalog) (*googlesql.AnalyzerOutput, error)
func (*Analyzer) GetTableMetadataFromPath ¶
func (*Analyzer) ParseFile ¶
func (a *Analyzer) ParseFile(uri lsp.DocumentURI, src string) ParsedFile
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func NewCatalog ¶
func (*Catalog) AddFunctionWithName ¶
func (*Catalog) CatalogNode ¶ added in v0.5.0
func (c *Catalog) CatalogNode() *googlesql.SimpleCatalog
CatalogNode returns the underlying SimpleCatalog which implements CatalogNode.
func (*Catalog) EnsureTable ¶ added in v0.5.0
EnsureTable loads a table from BigQuery if not already in the catalog.
func (*Catalog) FindTableMetadata ¶ added in v0.5.0
func (c *Catalog) FindTableMetadata(path string) (*bq.TableMetadata, error)
FindTableMetadata returns the BigQuery metadata for a table path (e.g., "project.dataset.table").
func (*Catalog) PreloadTablesFromAST ¶ added in v0.5.0
PreloadTablesFromAST walks the AST to find all table path expressions and pre-loads them.
func (*Catalog) TypeFactory ¶ added in v0.5.0
func (c *Catalog) TypeFactory() *googlesql.TypeFactory
TypeFactory returns the TypeFactory for creating types.
type Error ¶
type ParsedFile ¶
type ParsedFile struct {
URI lsp.DocumentURI
Src string
// googlesql AST node
Node *googlesql.ASTScript
// index is Node's statement order
RNode []*googlesql.AnalyzerOutput
// tree-sitter node
TsTree *ts.Tree
FixOffsets []FixOffset
Errors []Error
}
func (ParsedFile) Close ¶ added in v0.5.0
func (p ParsedFile) Close()
func (ParsedFile) ExtractSQL ¶
func (p ParsedFile) ExtractSQL(locationRange *googlesql.ParseLocationRange) (string, bool)
func (*ParsedFile) FindIncompleteColumnName ¶
func (p *ParsedFile) FindIncompleteColumnName(pos lsp.Position) string
func (*ParsedFile) FindTargetAnalyzeOutput ¶
func (p *ParsedFile) FindTargetAnalyzeOutput(termOffset int) (*googlesql.AnalyzerOutput, bool)
func (ParsedFile) FindTargetStatementNode ¶
func (p ParsedFile) FindTargetStatementNode(termOffset int) (googlesql.ASTStatementNode, bool)
func (ParsedFile) TermOffset ¶
func (p ParsedFile) TermOffset(pos lsp.Position) int
func (ParsedFile) ToLspRange ¶
func (p ParsedFile) ToLspRange(r *googlesql.ParseLocationRange) (lsp.Range, bool)