1 回答

TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊
戈布法羅多對(duì)多 ...
type Organization struct {
? ? ID? ? ? ? ? ? ? ?int? ? ? ? ? ? ? ? `json:"id" db:"id"`
? ? Users? ? ? ? ? ? Users? ? ? ? ? ? ? `many_to_many:"user_organizations"`
}
type User struct {
? ? ID? ? ? ? ? ? ? ? int? ? ? ? ? ? ? ? `json:"id" db:"id"`
? ? Organizations? ? ?Organizations? ? ? `many_to_many:"user_organizations" json:"-"`
}
type UserOrganization struct {
? ? ID? ? ? ? ? ? ?int? ? ? ? ? `json:"id" db:"id"`
? ? OrganizationID int? ? ? ? ? `json:"organization_id" db:"organization_id"`
? ? UserID? ? ? ? ?int? ? ? ? ? `json:"user_id" db:"user_id"`
? ? User? ? ? ? ? ?User? ? ? ? ?`belongs_to:"users"`
? ? Organization? ?Organization `belongs_to:"organizations"`
}
每個(gè)結(jié)構(gòu)都在自己的 models/*.go 文件中
- 1 回答
- 0 關(guān)注
- 147 瀏覽
添加回答
舉報(bào)