bxcodec / go-clean-arch

Go (Golang) Clean Architecture based on Reading Uncle Bob's Clean Architecture
MIT License
9.03k stars 1.19k forks source link

Questions About Whether Necessary To Use Pointer For Usecase #65

Open fans3210 opened 2 years ago

fans3210 commented 2 years ago

Thanks a lot for the repo and it is really informative. However I have two small questions about pointer and value for usecase.

  1. In this scenario, article usecase is using pointer in both constructor and method receiver, is it because of the repository dependency(sqldb) which is also a pointer?
  2. What if I have a simpler usecase which doesn't have dependencies of references, eg: repository and it's just used to do simple stateless calculations without extra pointer dependencies. For these kind of scenarios, may I use copies instead of pointers?

I would be very appreciated if you could clear some of my doubts.

bxcodec commented 2 years ago

Hi @fans3210

Yes, exactly, no need to use the pointer if needed. I haven't updated the repo for a while. I will check again and remove the unnecessary stuff here.

Thanks for pointing that out. 🙏🏻