Currently it is impossible to fully unit test code that is using sqrl since Query method requires *sql.Rows as return value. I am proposing to add RowsScanner interface that would allow *sql.Rows to be replaced by another struct that implements required methods.
type Queryer interface {
Query(query string, args ...interface{}) (RowsScanner, error)
}
As far as I can tell, RowsScanner could look something like this:
type RowsScanner interface {
Columns() ([]string, error)
Next() bool
Close() error
Err() error
RowScanner
}
Currently it is impossible to fully unit test code that is using sqrl since
Querymethod requires*sql.Rowsas return value. I am proposing to add RowsScanner interface that would allow*sql.Rowsto be replaced by another struct that implements required methods.As far as I can tell, RowsScanner could look something like this: