(registry *pgtype.Map, oid uint32, modifier int32)
| 389 | Size int32 |
| 390 | // Fallback indicates that the type is not supported by the pgtype package and is approximated to the `text` fallback type. |
| 391 | Fallback bool |
| 392 | } |
| 393 | |
| 394 | func NewPostgresType(registry *pgtype.Map, oid uint32, modifier int32) (PostgresType, error) { |
| 395 | t, ok := registry.TypeForOID(oid) |
| 396 | if !ok { |
| 397 | return PostgresType{}, fmt.Errorf("unsupported type OID %d", oid) |
| 398 | } |
| 399 | |
| 400 | var precision, scale int32 |
| 401 | switch oid { |
| 402 | case pgtype.NumericOID, pgtype.NumericArrayOID: |
| 403 | precision, scale, _ = DecodePrecisionScale(int(modifier)) |
| 404 | } |
| 405 | |
| 406 | return PostgresType{ |
| 407 | PG: t, |
| 408 | Precision: precision, |
| 409 | Scale: scale, |
| 410 | Size: PostgresTypeSize(oid), |
| 411 | }, nil |
| 412 | } |
no test coverage detected