Skip to content

Add RowsScanner interface #24

@ajpetersons

Description

@ajpetersons

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions