本文整理匯總了Golang中github.com/pingcap/tidb/table.Table.TableName方法的典型用法代碼示例。如果您正苦於以下問題:Golang Table.TableName方法的具體用法?Golang Table.TableName怎麽用?Golang Table.TableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pingcap/tidb/table.Table
的用法示例。
在下文中一共展示了Table.TableName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: getUpdateColumns
func getUpdateColumns(t table.Table, assignList []expression.Assignment, isMultipleTable bool, tblAliasMap map[string]string) ([]*column.Col, []expression.Assignment, error) {
// TODO: We should check the validate if assignList in somewhere else. Maybe in building plan.
// TODO: We should use field.GetFieldIndex to replace this function.
tcols := make([]*column.Col, 0, len(assignList))
tAsgns := make([]expression.Assignment, 0, len(assignList))
tname := t.TableName()
for _, asgn := range assignList {
if isMultipleTable {
if tblAliasMap != nil {
if alias, ok := tblAliasMap[asgn.TableName]; ok {
if !strings.EqualFold(tname.O, alias) {
continue
}
}
} else if !strings.EqualFold(tname.O, asgn.TableName) {
continue
}
}
col := column.FindCol(t.Cols(), asgn.ColName)
if col == nil {
if isMultipleTable {
continue
}
return nil, nil, errors.Errorf("UPDATE: unknown column %s", asgn.ColName)
}
tcols = append(tcols, col)
tAsgns = append(tAsgns, asgn)
}
return tcols, tAsgns, nil
}
示例2: findColumnByName
func findColumnByName(t table.Table, name string) (*column.Col, error) {
_, tableName, colName := field.SplitQualifiedName(name)
if len(tableName) > 0 && tableName != t.TableName().O {
return nil, errors.Errorf("unknown field %s.%s", tableName, colName)
}
c := column.FindCol(t.Cols(), colName)
if c == nil {
return nil, errors.Errorf("unknown field %s", colName)
}
return c, nil
}
示例3: getTableOffset
func (e *UpdateExec) getTableOffset(t table.Table) int {
fields := e.SelectExec.Fields()
i := 0
for i < len(fields) {
field := fields[i]
if field.Table.Name.L == t.TableName().L {
return i
}
i += len(field.Table.Columns)
}
return 0
}
示例4: getUpdateColumns
func getUpdateColumns(t table.Table, assignList []expressions.Assignment, multipleTable bool) ([]*column.Col, error) {
// TODO: We should check the validate if assignList in somewhere else. Maybe in building plan.
tcols := make([]*column.Col, 0, len(assignList))
tname := t.TableName()
for _, asgn := range assignList {
if multipleTable {
if !strings.EqualFold(tname.O, asgn.TableName) {
continue
}
}
col := column.FindCol(t.Cols(), asgn.ColName)
if col == nil {
if multipleTable {
continue
}
return nil, errors.Errorf("UPDATE: unknown column %s", asgn.ColName)
}
tcols = append(tcols, col)
}
return tcols, nil
}