This commit is contained in:
2026-03-23 18:55:27 +07:00
parent 6dc0322fe5
commit 3626c12319
47 changed files with 2741 additions and 0 deletions

32
pkg/convert/convert.go Normal file
View File

@@ -0,0 +1,32 @@
package convert
import "github.com/jackc/pgx/v5/pgtype"
func UUIDToString(v pgtype.UUID) string {
if v.Valid {
return v.String()
}
return ""
}
func TextToString(v pgtype.Text) string {
if v.Valid {
return v.String
}
return ""
}
func BoolVal(v pgtype.Bool) bool {
if v.Valid {
return v.Bool
}
return false
}
func TimeToPtr(v pgtype.Timestamptz) *string {
if v.Valid {
t := v.Time.Format("2006-01-02T15:04:05Z07:00")
return &t
}
return nil
}