resolve

package
v1.1.0-beta.0...-57a73ea Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resolve is used for semantic resolve of the AST tree. semantic resolve is mostly done by 'core.preprocessor', in tableListExtractor and updatableTableListResolver we also do some resolve for aliases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context is used to store the context and result of resolving AST tree.

func NewContext

func NewContext() *Context

NewContext creates a Context.

func (*Context) AddTableName

func (c *Context) AddTableName(tableNameW *TableNameW)

AddTableName adds the AST table name and its corresponding TableNameW to the Context.

func (*Context) GetTableName

func (c *Context) GetTableName(tableName *ast.TableName) *TableNameW

GetTableName returns the TableNameW of the AST table name. the TableNameW should have been added to the Context in pre-process phase before calling this function, if it doesn't exist, pre-process should have returned error, so we don't check nil-ness in most cases.

type NodeW

type NodeW struct {
	Node ast.Node
	// contains filtered or unexported fields
}

NodeW is a wrapper around ast.Node to store resolve context.

func NewNodeW

func NewNodeW(node ast.Node) *NodeW

NewNodeW creates a NodeW.

func NewNodeWWithCtx

func NewNodeWWithCtx(node ast.Node, resolveCtx *Context) *NodeW

NewNodeWWithCtx creates a NodeW with the given Context.

func (*NodeW) CloneWithNewNode

func (n *NodeW) CloneWithNewNode(newNode ast.Node) *NodeW

CloneWithNewNode creates a new NodeW with the given ast.Node.

func (*NodeW) GetResolveContext

func (n *NodeW) GetResolveContext() *Context

GetResolveContext returns the Context of the NodeW.

type ResultField

type ResultField struct {
	Column       *model.ColumnInfo
	ColumnAsName pmodel.CIStr
	// EmptyOrgName indicates whether this field has an empty org_name. A field has an empty org name, if it's an
	// expression. It's not sure whether it's safe to use empty string in `.Column.Name`, so a new field is added to
	// indicate whether it's empty.
	EmptyOrgName bool

	Table       *model.TableInfo
	TableAsName pmodel.CIStr
	DBName      pmodel.CIStr
}

ResultField represents a result field which can be a column from a table, or an expression in select field. It is a generated property during binding process. ResultField is the key element to evaluate a ColumnNameExpr. After resolving process, every ColumnNameExpr will be resolved to a ResultField. During execution, every row retrieved from table will set the row value to ResultFields of that table, so ColumnNameExpr resolved to that ResultField can be easily evaluated.

type TableNameW

type TableNameW struct {
	*ast.TableName
	DBInfo    *model.DBInfo
	TableInfo *model.TableInfo
}

TableNameW is a wrapper around ast.TableName to store more information.

Jump to

Keyboard shortcuts

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