doc: add readme
This commit is contained in:
		
							
								
								
									
										25
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								README.md
									
									
									
									
									
								
							@ -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`.
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user