parseutil

package
v0.2.29 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAliased

func ExtractAliased(parsed ast.TokenList) []ast.Node

func ExtractAliasedIdentifer

func ExtractAliasedIdentifer(parsed ast.TokenList) []ast.Node

func ExtractIdenfiers

func ExtractIdenfiers(parsed ast.TokenList, pos token.Pos) ([]ast.Node, error)

func ExtractInsertColumns

func ExtractInsertColumns(parsed ast.TokenList) []ast.Node

func ExtractInsertValues

func ExtractInsertValues(parsed ast.TokenList, pos token.Pos) []ast.Node

func ExtractSelectExpr

func ExtractSelectExpr(parsed ast.TokenList) []ast.Node

func ExtractTableFactor

func ExtractTableFactor(parsed ast.TokenList) []ast.Node

func ExtractTableReference

func ExtractTableReference(parsed ast.TokenList) []ast.Node

func ExtractTableReferences

func ExtractTableReferences(parsed ast.TokenList) []ast.Node

func ExtractWhereCondition

func ExtractWhereCondition(parsed ast.TokenList) []ast.Node

Types

type Insert

type Insert struct {
	Tables  []*TableInfo
	Columns []*ast.IdentiferList
	Values  []*ast.IdentiferList
}

func ExtractInsert

func ExtractInsert(parsed ast.TokenList, pos token.Pos) (*Insert, error)

func (*Insert) Enable

func (i *Insert) Enable() bool

func (*Insert) GetColumns

func (i *Insert) GetColumns() *ast.IdentiferList

func (*Insert) GetTable

func (i *Insert) GetTable() *TableInfo

func (*Insert) GetValues

func (i *Insert) GetValues() *ast.IdentiferList

type NodeWalker

type NodeWalker struct {
	Paths []*astutil.NodeReader
	Index int
}

func NewNodeWalker

func NewNodeWalker(root ast.TokenList, pos token.Pos) *NodeWalker

func (*NodeWalker) CurNodeButtomMatched

func (nw *NodeWalker) CurNodeButtomMatched(matcher astutil.NodeMatcher) ast.Node

func (*NodeWalker) CurNodeDepth

func (nw *NodeWalker) CurNodeDepth(matcher astutil.NodeMatcher) (int, bool)

func (*NodeWalker) CurNodeIs

func (nw *NodeWalker) CurNodeIs(matcher astutil.NodeMatcher) bool

func (*NodeWalker) CurNodeMatches

func (nw *NodeWalker) CurNodeMatches(matcher astutil.NodeMatcher) []ast.Node

func (*NodeWalker) CurNodeTopMatched

func (nw *NodeWalker) CurNodeTopMatched(matcher astutil.NodeMatcher) ast.Node

func (*NodeWalker) CurNodes

func (nw *NodeWalker) CurNodes() []ast.Node

func (*NodeWalker) PrevNodes

func (nw *NodeWalker) PrevNodes(ignoreWitespace bool) []ast.Node

func (*NodeWalker) PrevNodesIs

func (nw *NodeWalker) PrevNodesIs(ignoreWitespace bool, matcher astutil.NodeMatcher) bool

func (*NodeWalker) PrevNodesIsWithDepth

func (nw *NodeWalker) PrevNodesIsWithDepth(ignoreWitespace bool, matcher astutil.NodeMatcher, depth int) bool

type SubQueryColumn

type SubQueryColumn struct {
	ParentTable *TableInfo
	ParentName  string
	ColumnName  string
	AliasName   string
}

func (*SubQueryColumn) DisplayName

func (sc *SubQueryColumn) DisplayName() string

type SubQueryInfo

type SubQueryInfo struct {
	Name  string
	Views []*SubQueryView
}

func ExtractSubQueryViews

func ExtractSubQueryViews(parsed ast.TokenList, pos token.Pos) ([]*SubQueryInfo, error)

type SubQueryView

type SubQueryView struct {
	SubQueryColumns []*SubQueryColumn
}

type SyntaxPosition

type SyntaxPosition string
const (
	ColName        SyntaxPosition = "col_name"
	SelectExpr     SyntaxPosition = "select_expr"
	AliasName      SyntaxPosition = "alias_name"
	WhereCondition SyntaxPosition = "where_conditon"
	CaseValue      SyntaxPosition = "case_value"
	TableReference SyntaxPosition = "table_reference"
	InsertColumn   SyntaxPosition = "insert_column"
	InsertValue    SyntaxPosition = "insert_value"
	Unknown        SyntaxPosition = "unknown"
)

func CheckSyntaxPosition

func CheckSyntaxPosition(nw *NodeWalker) SyntaxPosition

type TableInfo

type TableInfo struct {
	DatabaseSchema  string
	Name            string
	Alias           string
	SubQueryColumns []*SubQueryColumn
}

func ExtractTable

func ExtractTable(parsed ast.TokenList, pos token.Pos) ([]*TableInfo, error)

Jump to

Keyboard shortcuts

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