fix/allow-many-rows #1
7
lazy.go
7
lazy.go
@@ -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()
|
||||
|
Reference in New Issue
Block a user