2022-10-04 04:27:29 +00:00
|
|
|
package postgresql
|
2022-10-04 04:19:25 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/volatiletech/null/v8"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetString(val null.String) string {
|
|
|
|
if !val.Valid {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return val.String
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetInt(val null.Int) int {
|
|
|
|
if !val.Valid {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return val.Int
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetBool(val null.Bool) bool {
|
|
|
|
if !val.Valid {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return val.Bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetTime(val null.Time) (res time.Time) {
|
|
|
|
if !val.Valid {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
return val.Time
|
|
|
|
}
|