2
0

UnmarshalJSON for Int8 missing

This commit is contained in:
eruca
2017-12-29 21:09:22 +08:00
committed by GitHub
parent 81b3e79897
commit fbc0fc7e3e
+12
View File
@@ -184,3 +184,15 @@ func (src *Int8) MarshalJSON() ([]byte, error) {
return nil, errBadStatus
}
func (dst *Int8) UnmarshalJSON(b []byte) error {
var n int64
err := json.Unmarshal(b, &n)
if err != nil {
return err
}
*dst = Int8{Int: n, Status: Present}
return nil
}