1
0
mirror of https://github.com/DATA-DOG/go-sqlmock.git synced 2025-07-03 00:36:52 +02:00

add AddRows function to allow adding multiple rows

This commit is contained in:
Ajitem Sahasrabuddhe
2021-05-30 13:15:50 +05:30
parent 35c0d3c10b
commit 2df2d8867c
2 changed files with 93 additions and 0 deletions

10
rows.go
View File

@ -188,6 +188,16 @@ func (r *Rows) AddRow(values ...driver.Value) *Rows {
return r
}
// AddRows adds multiple rows composed from database driver.Value slice and
// returns the same instance to perform subsequent actions.
func (r *Rows) AddRows(values ...[]driver.Value) *Rows {
for _, value := range values {
r.AddRow(value...)
}
return r
}
// FromCSVString build rows from csv string.
// return the same instance to perform subsequent actions.
// Note that the number of values must match the number