Merge pull request #3 from Selly-Modules/feature/fixgetsetupdate

build get set null value
This commit is contained in:
nguyenphamquangtue 2022-10-04 11:43:04 +07:00 committed by GitHub
commit 44034adbcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}
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,
}
}
func SetJSON(val []byte) null.JSON {
return null.JSON{
JSON: val,
Valid: true,
}
}