entc/gen: add eager-load edges to query clone (#888)

Closed #878
This commit is contained in:
Ariel Mashraki
2020-10-27 21:16:30 +02:00
committed by GitHub
parent fb97ca66ac
commit 967c10819a
77 changed files with 459 additions and 104 deletions

View File

@@ -248,6 +248,9 @@ func (gq *GroupQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the query builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (gq *GroupQuery) Clone() *GroupQuery {
if gq == nil {
return nil
}
return &GroupQuery{
config: gq.config,
limit: gq.limit,
@@ -255,6 +258,7 @@ func (gq *GroupQuery) Clone() *GroupQuery {
order: append([]OrderFunc{}, gq.order...),
unique: append([]string{}, gq.unique...),
predicates: append([]predicate.Group{}, gq.predicates...),
withUsers: gq.withUsers.Clone(),
// clone intermediate query.
sql: gq.sql.Clone(),
path: gq.path,

View File

@@ -248,6 +248,9 @@ func (uq *UserQuery) ExistX(ctx context.Context) bool {
// Clone returns a duplicate of the query builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func (uq *UserQuery) Clone() *UserQuery {
if uq == nil {
return nil
}
return &UserQuery{
config: uq.config,
limit: uq.limit,
@@ -255,6 +258,7 @@ func (uq *UserQuery) Clone() *UserQuery {
order: append([]OrderFunc{}, uq.order...),
unique: append([]string{}, uq.unique...),
predicates: append([]predicate.User{}, uq.predicates...),
withGroups: uq.withGroups.Clone(),
// clone intermediate query.
sql: uq.sql.Clone(),
path: uq.path,