adding proper allocations

This commit is contained in:
2025-09-26 16:18:27 -04:00
parent 891cd03b5a
commit 428381545d

View File

@@ -28,10 +28,10 @@ func GenerateRandomResults(query string, exampleObj any, keyVal any, rowCount in
retType := reflect.TypeOf(exampleObj) retType := reflect.TypeOf(exampleObj)
maxFieldCount := retType.NumField() maxFieldCount := retType.NumField()
columns := make([]string, 0, maxFieldCount) columns := make([]string, 0, maxFieldCount)
rows := make([][]driver.Value, 0, maxFieldCount) rows := make([][]driver.Value, 0)
//double loop here to allow for multiple rows
for y := 0; y < rowCount; y++ { for y := 0; y < rowCount; y++ {
rows[y] = make([]driver.Value, 0)
for x := 0; x < maxFieldCount; x++ { for x := 0; x < maxFieldCount; x++ {
field := retType.Field(x) field := retType.Field(x)
dbTag := field.Tag.Get("db") dbTag := field.Tag.Get("db")