Ваші коментарі

嗨!

对不起,我的中文不好。 我对Go一无所知,但是我听说它在OOP方面的方法与Java之类的方法截然不同。 GoF模式在Go上下文中是否有意义?

---

Hi!

Sorry for my bad Chinese. I don't know anything about Go, but I heard that it has a very different approach to OOP than languages like Java. Are the GoF patterns even make sense in Go context?

固定! 非常感谢您报告问题!

固定! 非常感谢您报告问题!

Hi Anne!

Thanks for asking! When people ask me questions regarding their own projects & code, the first counter-question I ask is: what do you think is the answer? Sometimes people don't realize they have perfectly good answers for their own questions.

I mean why do you NEED to use a pattern at all? Implement the code without a pattern and then see whether applying a pattern would improve your code. This is the approach I usually take in real-life coding.

В Laravel работа с базой так и сделана, вот тут можно глянуть: https://laravel.com/docs/7.x/queries#selects

Если хотите, можете копнуть в исходники, там всё более-менее понятно. Из того, что я вижу в вашем коде, главное отличие в том, что в ларавеле тип запроса определяется сразу же, а оттуда вы уже достраиваете запрос методами как хотите.

Do you have to apply any patterns at all? Or is it some kind of test that you're taking?

Hi Tomas!

Thanks for reporting it! It seems I had already fixed it in the previous version. You can re-download the book to fetch the latest updates. If you find anything else, please let me know! Thanks a lot!

Hi David!


But what do you think?