MCPcopy Index your code
hub / github.com/bytebase/bytebase / insertColumns

Method insertColumns

backend/plugin/parser/plsql/completion.go:287–320  ·  view source on GitHub ↗
(c *Completer, schemas, tables map[string]bool)

Source from the content-addressed store, hash-verified

285}
286
287func (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
322func (c *Completer) columnCandidate(schema, table, name, typ string, notNull bool, comment string) base.Candidate {
323 definition := fmt.Sprintf("%s.%s | %s", schema, table, typ)

Callers 1

Calls 8

InsertMethod · 0.95
ensureMetadataMethod · 0.80
GetSchemaMetadataMethod · 0.80
columnCandidateMethod · 0.80
GetTableMethod · 0.45
GetColumnsMethod · 0.45
GetProtoMethod · 0.45

Tested by

no test coverage detected