2 Star 0 Fork 0

403716045 / gcore

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
int64.go 360 Bytes
一键复制 编辑 原始数据 按行查看 历史
xingang 提交于 2023-02-17 18:19 . init
package number
import (
"strconv"
"strings"
)
type Int64 int32
func (t *Int64) UnmarshalJSON(data []byte) (err error) {
value := string(data)
value = strings.ReplaceAll(value, "\"", "")
if value == "" || value == "0" || value == "string" {
*t = 0
return nil
}
f, _ := strconv.ParseFloat(value, 64) //string转float32
*t = Int64(f)
return nil
}
Go
1
https://gitee.com/lv_baobao/gcore.git
git@gitee.com:lv_baobao/gcore.git
lv_baobao
gcore
gcore
3bf2efb9b087

搜索帮助