(typmod int)
| 459 | |
| 460 | func (p PostgresType) String() string { |
| 461 | return fmt.Sprintf("PostgresType(%s)", p.PG.Name) |
| 462 | } |
| 463 | |
| 464 | func DecodePrecisionScale(typmod int) (precision, scale int32, ok bool) { |
| 465 | if typmod > 0 { |
| 466 | typmod -= 4 // remove VARHDRSZ |
| 467 | precision = int32((typmod >> 16) & 0xFFFF) |
| 468 | scale = int32(typmod & 0xFFFF) |
| 469 | ok = true |
| 470 | } |
| 471 | // The max precision is 131072, which is larger than the max int16 value. |
| 472 | // Therefore, if the precision is larger than the max int16 value, we default to unknown precision and scale. |
| 473 | return |
| 474 | } |
no outgoing calls
no test coverage detected