We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello qiangxue, miss you on the Yii team.
I'm diversifying my portfolio, and improving my clients' APIs, I'm learning Go lang.
I followed several tutorials and blog about relationship, and I am 3 days without being able to make a BELONGS TO relationship.
What am I doing wrong, can you help me?
daos/product.go
func (dao *ProductDAO) Query(rs app.RequestScope, offset, limit int) ([]models.Product, error) { products := []models.Product{} err := rs.Tx().Select(). InnerJoin("establishment", dbx.NewExp("`product`.`establishment_id` = `establishment`.`id`")). OrderBy("product.id"). Offset(int64(offset)). Limit(int64(limit)). All(&products) return products, err }
models/product.go
type Product struct { Id int `json:"id" db:"id"` Establishment Establishment `json:"establishment" db:"establishment"` }
models/establishment.go
type Establishment struct { Id int `json:"id" db:"id"` Subtitle string `json:"subtitle" db:"subtitle"` }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hello qiangxue, miss you on the Yii team.
I'm diversifying my portfolio, and improving my clients' APIs, I'm learning Go lang.
I followed several tutorials and blog about relationship, and I am 3 days without being able to make a BELONGS TO relationship.
What am I doing wrong, can you help me?
daos/product.go
models/product.go
models/establishment.go
The text was updated successfully, but these errors were encountered: