I have an interface{}
type value received from *gin.Context
:
c.MustGet("account")
When I try to convert this into int
using :
c.MustGet("account").(int)
I get an error:
interface conversion: interface is float64, not int
The value of this interface is 1
. Why am I receiving this error? I am using this value in a sql query. I cannot convert this to float64
as the sql statement fails then. How can I convert this into int
?