IntToOid is a helper that turns a DInt into an oid.Oid and checks that the value is in range.
(i DInt)
| 5645 | // IntToOid is a helper that turns a DInt into an oid.Oid and checks that the |
| 5646 | // value is in range. |
| 5647 | func IntToOid(i DInt) (oid.Oid, error) { |
| 5648 | if intIsOutOfOIDRange(i) { |
| 5649 | return 0, pgerror.Newf( |
| 5650 | pgcode.NumericValueOutOfRange, "OID out of range: %d", i, |
| 5651 | ) |
| 5652 | } |
| 5653 | return oid.Oid(i), nil |
| 5654 | } |
| 5655 | |
| 5656 | func intIsOutOfOIDRange(i DInt) bool { |
| 5657 | return i > math.MaxUint32 || i < math.MinInt32 |
no test coverage detected
searching dependent graphs…