You've already forked go-sqlmock
mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-12-03 22:39:23 +02:00
add doc blocks, split files
This commit is contained in:
4
rows.go
4
rows.go
@@ -7,6 +7,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// a struct which implements database/sql/driver.Rows
|
||||
type rows struct {
|
||||
cols []string
|
||||
rows [][]driver.Value
|
||||
@@ -25,6 +26,7 @@ func (r *rows) Err() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// advances to next row
|
||||
func (r *rows) Next(dest []driver.Value) error {
|
||||
r.pos++
|
||||
if r.pos > len(r.rows) {
|
||||
@@ -38,6 +40,8 @@ func (r *rows) Next(dest []driver.Value) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// create rows from a csv string
|
||||
// to be used for mocked queries
|
||||
func RowsFromCSVString(columns []string, s string) driver.Rows {
|
||||
rs := &rows{}
|
||||
rs.cols = columns
|
||||
|
||||
Reference in New Issue
Block a user