MCPcopy Create free account
hub / github.com/actiontech/dtle / BuildCreateTableColsFromMap

Function BuildCreateTableColsFromMap

driver/mysql/base/utils.go:737–750  ·  view source on GitHub ↗
(cols []*ast.ColumnDef, columnMap []string)

Source from the content-addressed store, hash-verified

735}
736
737func BuildCreateTableColsFromMap(cols []*ast.ColumnDef, columnMap []string) (r []*ast.ColumnDef) {
738 if len(columnMap) > 0 {
739 for _, colName := range columnMap {
740 for _, col := range cols {
741 if colName == col.Name.Name.String() {
742 r = append(r, col)
743 }
744 }
745 }
746 return r
747 } else {
748 return cols
749 }
750}
751
752func RenameCreateTable(createTable string, newSchema string, newTable string, columnMap []string) (string, error) {
753 stmt0, err := parser.New().ParseOneStmt(createTable, "", "")

Callers 2

loadMappingMethod · 0.92
RenameCreateTableFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected