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

Method GetColumnNames

internal/x/expander/expander_test.go:26–44  ·  view source on GitHub ↗
(ctx context.Context, query string)

Source from the content-addressed store, hash-verified

24}
25
26func (g *PostgreSQLColumnGetter) GetColumnNames(ctx context.Context, query string) ([]string, error) {
27 conn, err := g.pool.Acquire(ctx)
28 if err != nil {
29 return nil, err
30 }
31 defer conn.Release()
32
33 desc, err := conn.Conn().Prepare(ctx, "", query)
34 if err != nil {
35 return nil, err
36 }
37
38 columns := make([]string, len(desc.Fields))
39 for i, field := range desc.Fields {
40 columns[i] = field.Name
41 }
42
43 return columns, nil
44}
45
46// MySQLColumnGetter implements ColumnGetter for MySQL. Column names are read
47// from the result set metadata returned by executing the query; the test

Callers

nothing calls this directly

Calls 1

PrepareMethod · 0.65

Tested by

no test coverage detected