尝试将decimal.Decimal类型转换为字符串
func main() {
a := strconv.Itoa(Price) // Price of type decimal.Decimal
fmt.Printf("%q\n", a)
}问题:不能将(decimal.Decimal类型的变量)用作strconv.Itoa (编译)的参数中的int值
工作的示例代码将被接受。
发布于 2022-03-25 08:31:05
价格是decimal.Decimal而不是整数。strconv.Itoa接受int。
从docs https://pkg.go.dev/github.com/shopspring/decimal#Decimal.String使用.String()。
https://stackoverflow.com/questions/71613959
复制相似问题