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

fix issue 209: add output parameters support #335

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

riccardos77
Copy link

this PR address the lack of support for output parameters adding:

  • sqlmock.NamedOutputArg and sqlmock.NamedInputOutputArg functions that support mapping values for sql.Named output and input/output parameters
  • sqlmock.TypedOutputArg function that support mapping values for unnamed output parameters, matching by type.
    This is required to mock for example go-mssqldb's ReturnStatus (https://github.com/microsoft/go-mssqldb/blob/main/mssql.go).
    To work, the output type doesn't need to be changed, so to avoid breaking changes, I've added a PassthroughValueConverter that allows the specified types to bypass the default ValueConverter. If there is a better solution, I will be happy to improve it.

Examples have been added in examples/output folder.

This PR should completely fix issue #209.

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.

None yet

1 participant