Skip to content

Unable to mock results with datetime columns #119

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

Closed
rvmishra opened this issue May 2, 2018 · 2 comments
Closed

Unable to mock results with datetime columns #119

rvmishra opened this issue May 2, 2018 · 2 comments

Comments

@rvmishra
Copy link

rvmishra commented May 2, 2018

Hey!

Related to #1

Is this #1 not resolved? I do not see RowFromInterface in rows.go

I am facing this problem when mocking mysql.

@l3pp4rd
Copy link
Member

l3pp4rd commented May 3, 2018

Hi, I've decided to leave this to users. There are many types of data, which could be translated using reflect and whatever. If the library starts to implement those, it will never finish and will start to conflict in implementation wanted.

So I suggest you to have your own method like AppendRow(rows *sqlmock.Rows, args ...interface{}) under the hood you just call rows.AddRow(argsTranslatedWhicheverWayYouPrefer ...driver.Value)

The reason why I do not want to support any time.Time translations in sqlmock is that databases support custom formats and sqlmock cannot know which one you actually prefer

@l3pp4rd l3pp4rd closed this as completed May 4, 2018
@Nibba2018
Copy link

Hi @l3pp4rd , are you aware of any existing code snippets for time.Time?

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

No branches or pull requests

3 participants