chore: initial commit

This commit is contained in:
2026-07-22 17:50:33 +08:00
parent 82936a8987
commit ee9f50b859
107 changed files with 8346 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package validator
import "encoding/json"
// NullInt32 Valid(false) + Set(true) = null | Valid(false) + Set(false) = nil
type NullInt32 struct {
Value int32
Valid bool
Set bool
}
func (i *NullInt32) UnmarshalJSON(data []byte) error {
i.Set = true
if string(data) == "null" {
i.Valid = false
return nil
}
var temp int32
if err := json.Unmarshal(data, &temp); err != nil {
return err
}
i.Value = temp
i.Valid = true
return nil
}