Skip to content
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

QueryRowContext support #237

Open
sheepman-x opened this issue Sep 22, 2020 · 1 comment
Open

QueryRowContext support #237

sheepman-x opened this issue Sep 22, 2020 · 1 comment
Labels

Comments

@sheepman-x
Copy link

mycode

m.ExpectQuery("select name from t").WithArgs(1, 2)
db.QueryRow("select name from t where id in ? limit 1", []int{1, 2})
if err := m.ExpectationsWereMet(); err != nil {
	t.Errorf("there were unfulfilled expectations: %s", err)
}

i got

there were unfulfilled expectations: there is a remaining expectation which was not matched: ExpectedQuery => expecting Query, QueryContext or QueryRow which:
              - matches sql: 'select name from t'
              - is with arguments:
                0 - 1
                1 - 2

Query, QueryContext or QueryRow
no QueryRowContext

@kachan1208 kachan1208 self-assigned this Sep 22, 2020
@fatelei
Copy link
Collaborator

fatelei commented Jul 30, 2022

Firstly, sqlmocks support QueryRowContext, this is an example: https://go.dev/play/p/ExJZSW3TLDb
Secondly, you do it in a wrong, this is a corret way: https://go.dev/play/p/Rucz0hKBNc3

Maybe the error message is misinformation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants