-
Notifications
You must be signed in to change notification settings - Fork 39
Create RowsScanner interface #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| type BaseRunner interface { | ||
| Execer | ||
| ExecerContext | ||
| Queryer |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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:
- It does more than just scanning.
- Having
RowsScannerandRowScanneris confusing for a reader.
|
|
||
| // otherRunner wraps BaseRunner to implement Runner. | ||
| type otherRunner struct { | ||
| BaseRunner |
There was a problem hiding this comment.
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.
Created
RowsScannerinterface to enable mockingsql.Rowsstruct. Potentially solves #24