本文整理匯總了Golang中github.com/pingcap/tidb/expression.Schema.FindSelectFieldColumn方法的典型用法代碼示例。如果您正苦於以下問題:Golang Schema.FindSelectFieldColumn方法的具體用法?Golang Schema.FindSelectFieldColumn怎麽用?Golang Schema.FindSelectFieldColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pingcap/tidb/expression.Schema
的用法示例。
在下文中一共展示了Schema.FindSelectFieldColumn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Enter
func (e *havingAndOrderbyResolver) Enter(inNode ast.Node) (ast.Node, bool) {
switch v := inNode.(type) {
case *ast.ValueExpr, *ast.ColumnName, *ast.ParenthesesExpr:
case *ast.ColumnNameExpr:
var first, second expression.Schema
var col *expression.Column
fromSchema := e.proj.GetChildByIndex(0).GetSchema()
fromSchemaFirst := e.orderBy && e.inExpr
if fromSchemaFirst {
first, second = fromSchema, e.proj.GetSchema()
col, e.err = first.FindColumn(v.Name)
} else {
first, second = e.proj.GetSchema(), fromSchema
col, e.err = first.FindSelectFieldColumn(v.Name, e.proj.Exprs)
}
if e.err != nil {
return inNode, true
}
if col == nil {
if fromSchemaFirst {
col, e.err = second.FindSelectFieldColumn(v.Name, e.proj.Exprs)
} else {
col, e.err = second.FindColumn(v.Name)
}
if e.err != nil {
return inNode, true
}
if col == nil {
e.err = errors.Errorf("Can't find Column %s", v.Name.Name)
return inNode, true
}
if !fromSchemaFirst {
e.addProjectionExpr(v, col)
} else {
e.mapper[v] = col
}
} else if fromSchemaFirst {
e.addProjectionExpr(v, col)
} else {
e.mapper[v] = col
}
case *ast.SubqueryExpr, *ast.CompareSubqueryExpr, *ast.ExistsSubqueryExpr:
return inNode, true
default:
e.inExpr = true
}
return inNode, false
}