(cols []*ast.ColumnDef, columnMap []string)
| 735 | } |
| 736 | |
| 737 | func 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 | |
| 752 | func RenameCreateTable(createTable string, newSchema string, newTable string, columnMap []string) (string, error) { |
| 753 | stmt0, err := parser.New().ParseOneStmt(createTable, "", "") |
no test coverage detected