DATA-DOG / go-sqlmock

Sql mock driver for golang to test database interactions
Other
5.95k stars 404 forks source link

how to mock mock preload #302

Closed ShuaiGao closed 1 month ago

ShuaiGao commented 1 year ago

Question

I'm always confused about preload, can you add more usage examples, one-to-one and one-to-many examples

diegommm commented 1 month ago

Hi @ShuaiGao! Closing as there is not enough information to help you, unfortunately. It would appear you are referring to the GORM library? If so, consider that it's a separate library that is unrelated to sqlmock, and it has a completely different approach. GORM can help you do fast prototyping and generate a lot of code for you, but you lose some control on what SQL code is being run and how. This means that GORM adds an abstraction layer that you have to account for. Consider the following instead:

Thank you!