1
0
mirror of https://github.com/DATA-DOG/go-sqlmock.git synced 2025-06-23 00:17:47 +02:00

implements next rows result set support

This commit is contained in:
gedi
2017-02-08 17:35:32 +02:00
parent 42ab7c33d0
commit 128bf5c539
6 changed files with 178 additions and 60 deletions

View File

@ -144,13 +144,6 @@ func (e *ExpectedQuery) WillReturnError(err error) *ExpectedQuery {
return e
}
// WillReturnRows specifies the set of resulting rows that will be returned
// by the triggered query
func (e *ExpectedQuery) WillReturnRows(rows driver.Rows) *ExpectedQuery {
e.rows = rows
return e
}
// WillDelayFor allows to specify duration for which it will delay
// result. May be used together with Context
func (e *ExpectedQuery) WillDelayFor(duration time.Duration) *ExpectedQuery {
@ -175,9 +168,11 @@ func (e *ExpectedQuery) String() string {
if e.rows != nil {
msg += "\n - should return rows:\n"
rs, _ := e.rows.(*rows)
for i, row := range rs.rows {
msg += fmt.Sprintf(" %d - %+v\n", i, row)
rs, _ := e.rows.(*rowSets)
for _, set := range rs.sets {
for i, row := range set.rows {
msg += fmt.Sprintf(" %d - %+v\n", i, row)
}
}
msg = strings.TrimSpace(msg)
}