using proper struct for nulltypes

This commit is contained in:
2026-01-16 10:31:40 -05:00
parent 7ce271bdb7
commit b4428e397e

13
lazy.go
View File

@@ -103,11 +103,14 @@ func RandomGenerate(m Config) (*Mock, error) {
nullType := false
switch field.Type {
case reflect.TypeOf(sql.NullTime{}):
// if isNull() {
rows[y] = append(rows[y], nil)
// } else {
// rows[y] = append(rows[y], time.Now())
// }
var temp sql.NullTime
if isNull() {
temp.Valid = false
} else {
temp.Valid = true
temp.Time = time.Now()
}
rows[y] = append(rows[y], temp)
nullType = true
case reflect.TypeOf(sql.NullInt16{}):
if isNull() {