just file typo

x/navis
Michael Li 1 year ago
parent 8f834e71a2
commit 4828f285ec
No known key found for this signature in database

@ -27,13 +27,6 @@ type JsonBox[T any] struct {
data T
}
func (j *JsonBox[T]) MarshalJSON() ([]byte, error) {
if j == nil {
return []byte(`null`), nil
}
return json.Marshal(j.data)
}
func (j *JsonBox[T]) Box(t T) {
j.data = t
}
@ -42,6 +35,13 @@ func (j *JsonBox[T]) Unbox() T {
return j.data
}
func (j *JsonBox[T]) MarshalJSON() ([]byte, error) {
if j == nil {
return []byte(`null`), nil
}
return json.Marshal(j.data)
}
func (j *JsonBox[T]) UnmarshalJSON(data []byte) error {
if j == nil {
return errors.New("JsonBox.UnmarshalJSON: on nil pointer")

Loading…
Cancel
Save