'storing decimal into pgtype numeric

I was working with pgtype.NumRange. The lower and upper bounds are typed pgtype.Numeric. pgtype.Numeric has the following fields

type Numeric struct {
    Int              *big.Int
    Exp              int32
    Status           Status
    NaN              bool
    InfinityModifier InfinityModifier
}

I guess I'm suppose to able to represent any number using the duo of the Int and Exp fields, but I don't know how to, as big.Int and `int32' are integer types.

From Postgres docs, I can see that numrange can take decimal values in any of lower and upper bounds and data type numeric is a superset of decimal type. So I know I should be able to use decimals, but how can I go about this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source