chore: initial commit of HouseholdBudgetBook (backend, frontend, desktop)
This commit is contained in:
commit
4a5db3f1f9
167 files changed
+21732
No files matched your search
@@ -0,0 +1,29 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type NullableInt64 struct {
|
||||
Set bool
|
||||
Valid bool
|
||||
Value int64
|
||||
}
|
||||
|
||||
func (n *NullableInt64) UnmarshalJSON(data []byte) error {
|
||||
n.Set = true
|
||||
if bytes.Equal(data, []byte("null")) {
|
||||
n.Valid = false
|
||||
n.Value = 0
|
||||
return nil
|
||||
}
|
||||
|
||||
var value int64
|
||||
if err := json.Unmarshal(data, &value); err != nil {
|
||||
return err
|
||||
}
|
||||
n.Valid = true
|
||||
n.Value = value
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user