Closed ShuaiGao closed 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:
database/sql
instead and building the SQL code so that the code you run is predictable and deterministic.Thank you!
Question
I'm always confused about preload, can you add more usage examples, one-to-one and one-to-many examples