Updated echo and ent.

This commit is contained in:
mikestefanello 2022-01-28 08:45:16 -05:00
parent 6546418052
commit a82ed9c6d0
15 changed files with 608 additions and 69 deletions

View file

@ -408,6 +408,10 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) {
func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) {
_spec := uq.querySpec()
_spec.Node.Columns = uq.fields
if len(uq.fields) > 0 {
_spec.Unique = uq.unique != nil && *uq.unique
}
return sqlgraph.CountNodes(ctx, uq.driver, _spec)
}
@ -479,6 +483,9 @@ func (uq *UserQuery) sqlQuery(ctx context.Context) *sql.Selector {
selector = uq.sql
selector.Select(selector.Columns(columns...)...)
}
if uq.unique != nil && *uq.unique {
selector.Distinct()
}
for _, p := range uq.predicates {
p(selector)
}
@ -757,9 +764,7 @@ func (ugb *UserGroupBy) sqlQuery() *sql.Selector {
for _, f := range ugb.fields {
columns = append(columns, selector.C(f))
}
for _, c := range aggregation {
columns = append(columns, c)
}
columns = append(columns, aggregation...)
selector.Select(columns...)
}
return selector.GroupBy(selector.Columns(ugb.fields...)...)