DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
6.16k stars 407 forks source link

feature: create rows columns and value from structs and slice by custom tag #280

Open Rennbon opened 2 years ago

Rennbon commented 2 years ago

It's easier to develop

theodesp commented 2 years ago

Hello @Rennbon. That is a great addition. I noticed that you add a new dependency for testing here. Do you think you can rewrite the test cases using the vanilla testing package only as I'm not sure if there is a need to change that at the moment? @l3pp4rd do you agree?

danpi commented 2 years ago

您好,我已经收到您的邮件,我会尽快给您回复,祝您好运。

AlekSi commented 2 years ago

I wonder why you ask me :)

Personally, I do use testify; but if this project does not use it yet and has the policy to avoid external testing libraries, I agree that introducing it there is not a good idea.

theodesp commented 2 years ago

I wonder why you ask me :)

Personally, I do use testify; but if this project does not use it yet and has the policy to avoid external testing libraries, I agree that introducing it there is not a good idea.

Hey @AlekSi Sorry I tagged you wrongly. Glad to get some feedback though.

Rennbon commented 2 years ago

That is a great addition. I noticed that you add a new dependency for testing here. Do you think you can rewrite the test cases using the vanilla testing package only as I'm not sure if there is a need to change that at the moment? @l3pp4rd do you agree?

OK

Rennbon commented 2 years ago

@theodesp I removed testify and used reflect.DeepEqual to verify that it was as expected.

theodesp commented 2 years ago

@Rennbon Thank you. Will try to test it this week a bit more.

Rennbon commented 2 years ago

@Rennbon Thank you. Will try to test it this week a bit more.

Ok, hope to merge soon.

Rennbon commented 2 years ago

@theodesp Is there anything wrong with this PR

theodesp commented 2 years ago

@l3pp4rd Is there a way to add this PR in Travis CI/CD pipeline please. It seems that I'm not able to see the test results in order to merge. Thank you.

dolmen commented 2 years ago

Those are utility functions. They don't have to be in the sqlmock core. They could be published as a separate package.

Rennbon commented 2 years ago

Those are utility functions. They don't have to be in the sqlmock core. They could be published as a separate package.

From a usage perspective, this commit reduces mock writing complexity. If go-sqlmock implements this functionality directly, it will be easier for developers to use.

Rennbon commented 2 years ago

@dolmen 这个库是Go 1.15的,不是所有引用库都会升级到1.18的