build get set null value #3

Merged
nguyenphamquangtue merged 1 commits from feature/fixgetsetupdate into master 2022-10-04 04:43:04 +00:00
2 changed files with 14 additions and 0 deletions

7
get.go
View File

@ -32,3 +32,10 @@ func GetTime(val null.Time) (res time.Time) {
} }
return val.Time return val.Time
} }
func GetJSON(val null.JSON) (res []byte) {
if !val.Valid {
return
}
return val.JSON
}

7
set.go
View File

@ -32,3 +32,10 @@ func SetTime(val time.Time) null.Time {
Valid: true, Valid: true,
} }
} }
func SetJSON(val []byte) null.JSON {
return null.JSON{
JSON: val,
Valid: true,
}
}