pg icon indicating copy to clipboard operation
pg copied to clipboard

how does go-pg covers linked tables

Open d-fal opened this issue 4 years ago • 1 comments

Having three tables with the following specifications:

type Devices struct {
   ID         int
   Name  string
}

and

type Features struct {
   ID        int
   Name string
}

I have created a linked table specified by the following struct:

type DevicesFeatures struct {
    DeviceID   int
    Device *Devices
    FeatureID int
    Feature *Feature
}

I want to select all the devices and their features if any. Would you please help me how to select them all? `

Sorry if you find it primitive!

`

d-fal avatar Apr 27 '20 00:04 d-fal

Hey,

You should check out my thread https://github.com/go-pg/pg/issues/1591. Check the tables Contracts -> ClientMaps <- Clients. That's how you do the thing you want :).

RazerBoy1 avatar Apr 29 '20 21:04 RazerBoy1