TODO: Use PGX to do the lookup for basic OID types
(ctx context.Context, oid uint32, modifier int32)
| 126 | |
| 127 | // TODO: Use PGX to do the lookup for basic OID types |
| 128 | func (a *Analyzer) formatType(ctx context.Context, oid uint32, modifier int32) (string, error) { |
| 129 | key := formatKey{oid, modifier} |
| 130 | ftyp, ok := a.formats.Load(key) |
| 131 | if ok { |
| 132 | return ftyp.(string), nil |
| 133 | } |
| 134 | rows, err := a.pool.Query(ctx, `SELECT format_type($1, $2)`, oid, modifier) |
| 135 | if err != nil { |
| 136 | return "", err |
| 137 | } |
| 138 | dt, err := pgx.CollectOneRow(rows, pgx.RowTo[string]) |
| 139 | if err != nil { |
| 140 | return "", err |
| 141 | } |
| 142 | a.formats.Store(key, dt) |
| 143 | return dt, err |
| 144 | } |
| 145 | |
| 146 | // TODO: This is bad |
| 147 | func rewriteType(dt string) string { |
no test coverage detected