Skip to content
New issue

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

Postgres hopes to add string.agg to replace GroupConcat #1201

Open
zengshun2019 opened this issue Sep 3, 2024 · 0 comments
Open

Postgres hopes to add string.agg to replace GroupConcat #1201

zengshun2019 opened this issue Sep 3, 2024 · 0 comments

Comments

@zengshun2019
Copy link

Describe the feature

count, err := qu.WithContext(ctx).
Select(
qu.UID,
qu.Name,
qu.Avatar,
qu.PhoneNumber,
qu.Email,
qu.Gender,
qu.BirthDay,
qu.Address,
qu.Desc,
qu.IsDefault,
qu.Status,
qr.Name.GroupConcat().As("Role"),
qd.Name.As("Dept"),
qu.LastLoginTime,
qu.CreatedAt,
).
Where(where...).
LeftJoin(qur, qur.UID.EqCol(qu.UID)).
LeftJoin(qr, qr.Label.EqCol(qur.RoleLabel)).
LeftJoin(qd, qd.Label.EqCol(qu.DepartmentLabel)).
Group(
qu.ID,
qu.UID,
qu.Name,
qu.Avatar,
qu.PhoneNumber,
qu.Email,
qu.Gender,
qu.BirthDay,
qu.Address,
qu.Desc,
qu.IsDefault,
qu.Status,
qd.Name,
qu.LastLoginTime,
qu.CreatedAt,
).
Order(order).
ScanByPage(&result, (s.CurrentPage-1)*s.PageSize, s.PageSize)

Motivation

Related Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant