Go variables are explicitly declared.
Ex:
var num1 int32 = 10
var num2 int64 = 20
num2 = num1
This will result in compile error. Because you have two different type of integers ( int32 and int64).
This is the most likely scenario you are facing in your application as well. Output you are getting from DB is different to variable you are declaring in your function.
But it is hard to give you an exact answer without more details.
Update :
But as your question header suggest, if the error you are getting is " unsigned integer out of range " , this is again most likely due to you are using smaller unsigned integer type and the number you are expecting has much larger value.
for you you reference Go has 4 unsigned integer types.
- uint8 (8-bit unsigned integer whose range is 0 to 255 )
- uint16 (16-bit unsigned integer whose range is 0 to 65535 )
- uint32 (32-bit unsigned integer whose range is 0 to 4294967295 )
- uint64 (64-bit unsigned integer whose range is 0 to
18446744073709551615 )