1
0
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:
gedi
2014-02-07 08:58:27 +02:00
parent 2fc5a0dd15
commit ee2ed8f2d5
8 changed files with 160 additions and 131 deletions

View File

@@ -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