doc: add readme

This commit is contained in:
Muyao CHEN 2024-10-20 22:57:28 +02:00
parent b4259e9a51
commit 74ae6b7877

View File

@ -521,3 +521,28 @@ is on my future learning plan!
_I found it quite interesting that simply with SQL, we can simulate the most
business logic. It is a must-have competence for software design and
development._
### 2024/10/20
I was thinking that I should write test for `sqlc` generated code. And then
I found out `gomock` and see how it is done in the project of
`techschoo/simplebank`. It's a great tutorial project. It makes me questioning
my own project's structure. It seems overwhelmed at least at the repo level.
I don't actually use the sqlc generated object, instead I do a conversion to
my `Retrieved` objects. But with some advanced configuration we could make the
output of sqlc object directly usable. That will save a lot of code.
The problem I saw here is the dependency on `sqlc/models`, and the model
designed there has no business logic. Everything is done in the handlers
and the handlers query directly the DB.
More concretely, `sqlc` generates `RawJSON` for some fields that are embedded
structs. So I have to do the translation somewhere.
So I will just stick to the plan and keep going with the predefined structure.
I have to figure out how to use the generated mock files.
The goals for the next week is to finish the basic operations for each level
and run some integration tests with `curl`.