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

fix code
This commit is contained in:
nguyenphamquangtue 2022-10-04 15:57:11 +07:00 committed by GitHub
commit 44182de030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

12
set.go
View File

@ -19,21 +19,27 @@ func SetInt(val int) null.Int {
} }
} }
func SetBool(val bool) null.Bool { func SetBool(val bool) (res null.Bool) {
return null.Bool{ return null.Bool{
Bool: val, Bool: val,
Valid: true, Valid: true,
} }
} }
func SetTime(val time.Time) null.Time { func SetTime(val time.Time) (res null.Time) {
if val.IsZero() {
return
}
return null.Time{ return null.Time{
Time: val, Time: val,
Valid: true, Valid: true,
} }
} }
func SetJSON(val []byte) null.JSON { func SetJSON(val []byte) (res null.JSON) {
if val == nil {
return
}
return null.JSON{ return null.JSON{
JSON: val, JSON: val,
Valid: true, Valid: true,