refactor: change named types in nullables to structs
This commit is contained in:
parent
e8f7a7e329
commit
52814db43d
1 changed files with 6 additions and 2 deletions
|
|
@ -5,7 +5,9 @@ import (
|
|||
"encoding/json"
|
||||
)
|
||||
|
||||
type NullTime sql.NullTime
|
||||
type NullTime struct {
|
||||
sql.NullTime
|
||||
}
|
||||
|
||||
func (nt NullTime) MarshalJSON() ([]byte, error) {
|
||||
if nt.Valid {
|
||||
|
|
@ -26,7 +28,9 @@ func (nt *NullTime) UnmarshalJSON(data []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
type NullString sql.NullString
|
||||
type NullString struct {
|
||||
sql.NullString
|
||||
}
|
||||
|
||||
func (ns NullString) MarshalJSON() ([]byte, error) {
|
||||
if ns.Valid {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue