(columns []*storepb.ColumnMetadata)
| 205 | } |
| 206 | |
| 207 | func columnListDDL(columns []*storepb.ColumnMetadata) string { |
| 208 | columnDefs := make([]string, 0, len(columns)) |
| 209 | for _, column := range columns { |
| 210 | if column == nil || column.GetName() == "" { |
| 211 | continue |
| 212 | } |
| 213 | columnDefs = append(columnDefs, fmt.Sprintf("%s %s", quoteIdent(column.GetName()), normalizeCompletionType(column.GetType()))) |
| 214 | } |
| 215 | if len(columnDefs) == 0 { |
| 216 | columnDefs = append(columnDefs, "__bytebase_completion_placeholder text") |
| 217 | } |
| 218 | return strings.Join(columnDefs, ", ") |
| 219 | } |
| 220 | |
| 221 | func normalizeCompletionType(typ string) string { |
| 222 | lower := strings.ToLower(strings.TrimSpace(typ)) |
no test coverage detected