Generate interface for model #886
hikyaru-suzuki
started this conversation in
Ideas
Replies: 1 comment
-
sqlmock afaik doesn't require you to know the query. You can say I'd recommend you do not mock your data layer though. It's generally going to be better to just test directly against the database. It's just such a core part of your app, unless you have other integration tests that do it you'd be missing a lot of proper execution of the code. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now, we are taking a position to use Datadog's sql mock library for model mocking.
it's a common usecase useing sqlboiler.
In this case,
users
variable is array ofUser
struct pointer and programmer don't know details of executed query. This is good point of ORM.But, sqlmock need to know raw query for mocking. I don't want to touch query and only would like to touch abstracted API.
So, I propose to add interface for model method and then we can generate that's mock code for testing by third party mock generation library. We will be able to describe test code without knowing raw query!
Please your opinion!
Beta Was this translation helpful? Give feedback.
All reactions