Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ajpetersons
Copy link

Created RowsScanner interface to enable mocking sql.Rows struct. Potentially solves #24

type BaseRunner interface {
Execer
ExecerContext
Queryer
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The role of the BaseRunner was to determine minimal functionality (be able to Query and Exec) of some DB connection in compile-time. Now Query* methods are gone and the only thing we require from DB connection is existence of Exec* methods. That renders BaseRunner less useful, so it seems like it should be removed completely and interface{} should be used instead of it.
But that means no compile-time checks, only runtime checks in wrapRunner function. Which means "rebuilding lots of stuff". I don't think we should go this way.

// RowsScanner is the interface that wraps the sql row methods.
//
// functions behave like database/sql.Rows methods
type RowsScanner interface {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RowsScanner should be rather renamed to RowCursor, because:

  1. It does more than just scanning.
  2. Having RowsScanner and RowScanner is confusing for a reader.


// otherRunner wraps BaseRunner to implement Runner.
type otherRunner struct {
BaseRunner
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another example of that BaseRunner is not needed anymore with this change. Why should we keep it? For 2 Exec* methods? Doesn't make too much sense IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants