parser

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypesForBOperationExpr

func GetTypesForBOperationExpr(opcode_ opcode.Op) (expression.LogicalOpType, expression.ComparisonType)

func PrintParsedNodes added in v0.0.2

func PrintParsedNodes(sqlStr *string)

for utity func on develop phase

func ValueExprToValue

func ValueExprToValue(expr *driver.ValueExpr) *types.Value

Types

type AggFuncVisitor

type AggFuncVisitor struct {
	ColumnName_ *string
	TableName_  *string
}

func (*AggFuncVisitor) Enter

func (v *AggFuncVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*AggFuncVisitor) Leave

func (v *AggFuncVisitor) Leave(in ast.Node) (ast.Node, bool)

type AssignVisitor

type AssignVisitor struct {
	Colname_ *string
	Value_   *types.Value
}

func (*AssignVisitor) Enter

func (v *AssignVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*AssignVisitor) Leave

func (v *AssignVisitor) Leave(in ast.Node) (ast.Node, bool)

type BinaryOpExpression

type BinaryOpExpression struct {
	LogicalOperationType_    expression.LogicalOpType
	ComparisonOperationType_ expression.ComparisonType
	Left_                    interface{}
	Right_                   interface{}
}

type BinaryOpVisitor

type BinaryOpVisitor struct {
	QueryInfo_          *QueryInfo
	BinaryOpExpression_ *BinaryOpExpression
}

func (*BinaryOpVisitor) Enter

func (v *BinaryOpVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*BinaryOpVisitor) Leave

func (v *BinaryOpVisitor) Leave(in ast.Node) (ast.Node, bool)

type ChildDataVisitor

type ChildDataVisitor struct {
	ChildDatas_ []interface{}
}

func (*ChildDataVisitor) Enter

func (v *ChildDataVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*ChildDataVisitor) Leave

func (v *ChildDataVisitor) Leave(in ast.Node) (ast.Node, bool)

type ColDefExpression

type ColDefExpression struct {
	ColName_ *string
	ColType_ *types.TypeID
}

type IndexDefExpression

type IndexDefExpression struct {
	IndexName_ *string
	Colnames_  []*string
}

type JoinVisitor

type JoinVisitor struct {
	QueryInfo_ *QueryInfo
}

func (*JoinVisitor) Enter

func (v *JoinVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*JoinVisitor) Leave

func (v *JoinVisitor) Leave(in ast.Node) (ast.Node, bool)

type OrderByExpression

type OrderByExpression struct {
	IsDesc_  bool
	ColName_ *string
}

type PrintNodesVisitor added in v0.0.2

type PrintNodesVisitor struct {
}

func NewPrintNodesVisitor added in v0.0.2

func NewPrintNodesVisitor() *PrintNodesVisitor

func (*PrintNodesVisitor) Enter added in v0.0.2

func (v *PrintNodesVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*PrintNodesVisitor) Leave added in v0.0.2

func (v *PrintNodesVisitor) Leave(in ast.Node) (ast.Node, bool)

type QueryInfo

type QueryInfo struct {
	QueryType_           *QueryType
	SelectFields_        []*SelectFieldExpression // SELECT
	SetExpressions_      []*SetExpression         // UPDATE
	NewTable_            *string                  // CREATE TABLE
	ColDefExpressions_   []*ColDefExpression      // CREATE TABLE
	IndexDefExpressions_ []*IndexDefExpression    // CREATE TABLE
	TargetCols_          []*string                // INSERT
	Values_              []*types.Value           // INSERT
	OnExpressions_       *BinaryOpExpression      // SELECT (with JOIN)
	JoinTables_          []*string                // SELECT
	WhereExpression_     *BinaryOpExpression      // SELECT, UPDATE, DELETE
	LimitNum_            int32                    // SELECT
	OffsetNum_           int32                    // SELECT
	OrderByExpressions_  []*OrderByExpression     // SELECT
}

func ProcessSQLStr

func ProcessSQLStr(sqlStr *string) *QueryInfo

type QueryType

type QueryType int32
const (
	SELECT QueryType = iota
	CREATE_TABLE
	INSERT
	DELETE
	UPDATE
)

type RootSQLVisitor

type RootSQLVisitor struct {
	QueryInfo_ *QueryInfo
}

func NewRootSQLVisitor

func NewRootSQLVisitor() *RootSQLVisitor

func (*RootSQLVisitor) Enter

func (v *RootSQLVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*RootSQLVisitor) Leave

func (v *RootSQLVisitor) Leave(in ast.Node) (ast.Node, bool)

type SelectFieldExpression

type SelectFieldExpression struct {
	IsAgg_     bool
	AggType_   plans.AggregationType
	TableName_ *string // if specified
	ColName_   *string
}

type SelectFieldsVisitor

type SelectFieldsVisitor struct {
	QueryInfo_ *QueryInfo
}

func (*SelectFieldsVisitor) Enter

func (v *SelectFieldsVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*SelectFieldsVisitor) Leave

func (v *SelectFieldsVisitor) Leave(in ast.Node) (ast.Node, bool)

type SetExpression

type SetExpression struct {
	ColName_     *string
	UpdateValue_ *types.Value
}

type Visitor

type Visitor interface {
	Enter(n ast.Node) (node ast.Node, skipChildren bool)
	Leave(n ast.Node) (node ast.Node, ok bool)
}

Jump to

Keyboard shortcuts

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