ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.
https://www.ardanlabs.com
Apache License 2.0
3.4k stars 612 forks source link

Join #348

Closed himynamej closed 3 months ago

himynamej commented 3 months ago

Hi Can we use join in this struct

ardan-bkennedy commented 3 months ago

? Which struct?

himynamej commented 3 months ago

In user and product ,if I wand to join between user and product,where I can write the code

ardan-bkennedy commented 3 months ago

Yea, that is an excellent question. You CAN'T join data across domains inside the Go code. So NO storage package should have a join to a table outside of its domain.

To make the solution you should follow clearer, I made some code changes today. Take a look at the latest code.

  1. Check out the migration file for a VIEW that JOINS product with some user information.
  2. Check out the new vproduct domain. There is a new core, storage, and app layer package.

This is how you need to do it. Create a VIEW and build a new domain around that.