MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / tableInfo

Method tableInfo

internal/engine/postgresql/analyzer/analyze.go:75–90  ·  view source on GitHub ↗

Cache these types in memory

(ctx context.Context, oid uint32)

Source from the content-addressed store, hash-verified

73
74// Cache these types in memory
75func (a *Analyzer) tableInfo(ctx context.Context, oid uint32) (*pgTable, error) {
76 ctbl, ok := a.tables.Load(oid)
77 if ok {
78 return ctbl.(*pgTable), nil
79 }
80 rows, err := a.pool.Query(ctx, tableQuery, oid)
81 if err != nil {
82 return nil, err
83 }
84 tbl, err := pgx.CollectOneRow(rows, pgx.RowToStructByName[pgTable])
85 if err != nil {
86 return nil, err
87 }
88 a.tables.Store(oid, &tbl)
89 return &tbl, nil
90}
91
92type pgColumn struct {
93 DataType string `db:"data_type"`

Callers 1

AnalyzeMethod · 0.95

Implementers 3

CachedAnalyzerinternal/analyzer/analyzer.go
Analyzerinternal/engine/postgresql/analyzer/an
Analyzerinternal/engine/sqlite/analyzer/analyz

Calls 1

QueryMethod · 0.65

Tested by

no test coverage detected