Skip to content

Typed rows via manual assembly #2

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

Merged
merged 2 commits into from
Feb 13, 2014
Merged

Typed rows via manual assembly #2

merged 2 commits into from
Feb 13, 2014

Conversation

Hebo
Copy link
Contributor

@Hebo Hebo commented Feb 13, 2014

Hey,

closes #1

I think this is a decent implementation as it allows for multiple rows to be added as a result with a fairly simple API.

Here's how it looks:

    rs := NewRows([]string{"id", "time", "a_boolean"})
    rs.AddRow(5, time.Now, true)

    ExpectQuery("SELECT (.+) FROM sales WHERE id = ?").
        WithArgs(5).
        WillReturnRows(rs)

Allowing rows to be generated by function calls could make a good future improvement, but I only need a single row for all my current tests and this works nicely.

@l3pp4rd
Copy link
Member

l3pp4rd commented Feb 13, 2014

looks really good, nice contribution to the API, thanks ;) will update few things and merge it

@l3pp4rd l3pp4rd merged commit 517a41f into DATA-DOG:master Feb 13, 2014
l3pp4rd pushed a commit that referenced this pull request May 31, 2017
* Update sqlmock.go

Permit prepares to obey MatchExpectationsInOrder flag, allowing prepared statements to be prepared in a different order than they were added to the expectations.

* Update sqlmock_test.go

Add test case for unordered prepared statements.
@tsuna
Copy link

tsuna commented May 31, 2017

Can you guys make sure you gofmt the code before accepting pull requests?

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.

Unable to mock results with datetime columns
3 participants