go-clean-arch icon indicating copy to clipboard operation
go-clean-arch copied to clipboard

Questions About Whether Necessary To Use Pointer For Usecase

Open yaodong-li opened this issue 3 years ago • 1 comments

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.

yaodong-li avatar Jun 18 '22 04:06 yaodong-li

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. 🙏🏻

bxcodec avatar Aug 04 '22 01:08 bxcodec