MCPcopy
hub / github.com/dosco/graphjin / addCodeSQLVirtualColumns

Function addCodeSQLVirtualColumns

core/init_multidb.go:334–354  ·  view source on GitHub ↗
(di *sdata.DBInfo)

Source from the content-addressed store, hash-verified

332}
333
334func addCodeSQLVirtualColumns(di *sdata.DBInfo) {
335 for _, table := range []string{"code_symbols", "code_nodes", "code_captures", "gj_code"} {
336 for _, col := range []string{"code", "code_context"} {
337 _ = di.AddColumn(di.Schema, table, sdata.DBColumn{
338 Name: col,
339 Type: "text",
340 CodeSQLVirtual: col,
341 })
342 }
343 }
344 for _, colName := range []string{"file_id", "symbol_id", "parent_id", "target_symbol_id"} {
345 col, err := di.GetColumn(di.Schema, "gj_code", colName)
346 if err != nil {
347 continue
348 }
349 col.FKeySchema = di.Schema
350 col.FKeyTable = "gj_code"
351 col.FKeyCol = "id"
352 col.FKeyIsUnique = true
353 }
354}
355
356func hideRawCodeSQLTables(di *sdata.DBInfo) {
357 if di == nil {

Callers 1

Calls 2

AddColumnMethod · 0.65
GetColumnMethod · 0.45

Tested by

no test coverage detected