NewNullFloat

This commit is contained in:
xh
2026-01-19 23:19:42 +08:00
parent ab8eb1142b
commit aafb56ef2b
2 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -36,13 +36,13 @@
"pinia": "^3.0.3",
"query-string": "^9.2.2",
"spark-md5": "^3.0.2",
"vue": "^3.5.26",
"vue": "^3.5.27",
"vue-clipboard3": "^2.0.0",
"vue-router": "^4.6.4",
"vue-virtual-scroller": "2.0.0-beta.8",
"vue3-video-play": "^1.3.2",
"vuedraggable": "^4.1.0",
"vxe-table": "^4.17.42"
"vxe-table": "^4.17.43"
},
"devDependencies": {
"@eslint/css": "^0.14.1",
+7 -2
View File
@@ -17,6 +17,9 @@ type NullFloat struct {
Exist bool // 是否有值
}
func NewNullFloat(val float64) NullFloat {
return NullFloat{Val: &val, Exist: true}
}
func DecodeFloat(value any) (any, error) {
switch v := value.(type) {
case nil:
@@ -123,13 +126,15 @@ func (f *NullFloat) UnmarshalJSON(data []byte) error {
}
}
func (i *NullFloat) SetValue(value float64) {
func (i *NullFloat) SetValue(value float64) *NullFloat {
i.Val = &value
i.Exist = true
return i
}
func (i *NullFloat) SetNull() {
func (i *NullFloat) SetNull() *NullFloat {
i.Val = nil
i.Exist = true
return i
}
func (i *NullFloat) GetValue() *float64 {