fix/allow-many-rows #1

Merged
jake merged 8 commits from fix/allow-many-rows into main 2025-09-26 22:58:51 +00:00
Showing only changes of commit 92b673cb46 - Show all commits

View File

@@ -17,13 +17,18 @@ type MockResults struct {
Rows [][]driver.Value
}
func GenerateRandomResults(query string, exampleObj any, keyVal any, rowCount int) (*MockResults, error) {
func GenerateRandomResults(query string, exampleObj any, keyVal []any, rowCount int) (*MockResults, error) {
if exampleObj == nil {
return nil, errors.New("exampleObj cannot be nil")
}
if rowCount == 0 {
rowCount = 1
}
if len(keyVal) != 0 {
if len(keyVal) != rowCount {
return nil, errors.New("you must provide a key for each row")
}
}
retType := reflect.TypeOf(exampleObj)
maxFieldCount := retType.NumField()