(c *Completer, schemas, tables map[string]bool)
| 285 | } |
| 286 | |
| 287 | func (m CompletionMap) insertColumns(c *Completer, schemas, tables map[string]bool) { |
| 288 | for schema := range schemas { |
| 289 | if schema == "" { |
| 290 | for _, table := range c.cteTables { |
| 291 | if !tables[table.Table] { |
| 292 | continue |
| 293 | } |
| 294 | for _, column := range table.Columns { |
| 295 | m.Insert(base.Candidate{ |
| 296 | Type: base.CandidateTypeColumn, |
| 297 | Text: c.quotedIdentifierIfNeeded(column), |
| 298 | }) |
| 299 | } |
| 300 | } |
| 301 | continue |
| 302 | } |
| 303 | if !c.ensureMetadata(schema) { |
| 304 | continue |
| 305 | } |
| 306 | schemaMeta := c.metadataCache[schema].GetSchemaMetadata("") |
| 307 | if schemaMeta == nil { |
| 308 | continue |
| 309 | } |
| 310 | for table := range tables { |
| 311 | tableMeta := schemaMeta.GetTable(table) |
| 312 | if tableMeta == nil { |
| 313 | continue |
| 314 | } |
| 315 | for _, column := range tableMeta.GetProto().GetColumns() { |
| 316 | m.Insert(c.columnCandidate(schema, table, column.Name, column.Type, !column.Nullable, column.Comment)) |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | func (c *Completer) columnCandidate(schema, table, name, typ string, notNull bool, comment string) base.Candidate { |
| 323 | definition := fmt.Sprintf("%s.%s | %s", schema, table, typ) |
no test coverage detected