From 21ecfa0872d4d633ba8ad0d4c0bec1557a693d61 Mon Sep 17 00:00:00 2001 From: eiixy <990656271@qq.com> Date: Fri, 23 May 2025 16:20:27 +0800 Subject: [PATCH] entc: update groupReceiver and selectReceiver (#4395) * update GroupReceiver and SelectReceiver * update examples * update entc/integration generated code * Update entc/gen/type.go Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com> --------- Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com> --- entc/gen/template/builder/query.tmpl | 4 +- entc/gen/type.go | 10 ++++ .../cascadelete/ent/comment_query.go | 52 ++++++++--------- .../integration/cascadelete/ent/post_query.go | 52 ++++++++--------- .../integration/cascadelete/ent/user_query.go | 52 ++++++++--------- entc/integration/config/ent/user_query.go | 52 ++++++++--------- .../integration/customid/ent/account_query.go | 52 ++++++++--------- entc/integration/customid/ent/blob_query.go | 52 ++++++++--------- .../customid/ent/bloblink_query.go | 52 ++++++++--------- entc/integration/customid/ent/car_query.go | 52 ++++++++--------- entc/integration/customid/ent/device_query.go | 52 ++++++++--------- entc/integration/customid/ent/doc_query.go | 52 ++++++++--------- entc/integration/customid/ent/group_query.go | 52 ++++++++--------- entc/integration/customid/ent/intsid_query.go | 52 ++++++++--------- entc/integration/customid/ent/link_query.go | 52 ++++++++--------- .../integration/customid/ent/mixinid_query.go | 52 ++++++++--------- entc/integration/customid/ent/note_query.go | 52 ++++++++--------- entc/integration/customid/ent/other_query.go | 52 ++++++++--------- entc/integration/customid/ent/pet_query.go | 52 ++++++++--------- .../customid/ent/revision_query.go | 52 ++++++++--------- .../integration/customid/ent/session_query.go | 52 ++++++++--------- entc/integration/customid/ent/token_query.go | 52 ++++++++--------- entc/integration/customid/ent/user_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/car_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/card_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/info_query.go | 52 ++++++++--------- .../edgefield/ent/metadata_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/node_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/pet_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/post_query.go | 52 ++++++++--------- .../integration/edgefield/ent/rental_query.go | 52 ++++++++--------- entc/integration/edgefield/ent/user_query.go | 52 ++++++++--------- .../edgeschema/ent/attachedfile_query.go | 52 ++++++++--------- entc/integration/edgeschema/ent/file_query.go | 52 ++++++++--------- .../edgeschema/ent/friendship_query.go | 52 ++++++++--------- .../integration/edgeschema/ent/group_query.go | 52 ++++++++--------- .../edgeschema/ent/grouptag_query.go | 52 ++++++++--------- .../edgeschema/ent/process_query.go | 52 ++++++++--------- .../edgeschema/ent/relationship_query.go | 52 ++++++++--------- .../edgeschema/ent/relationshipinfo_query.go | 52 ++++++++--------- entc/integration/edgeschema/ent/role_query.go | 52 ++++++++--------- .../edgeschema/ent/roleuser_query.go | 52 ++++++++--------- entc/integration/edgeschema/ent/tag_query.go | 52 ++++++++--------- .../integration/edgeschema/ent/tweet_query.go | 52 ++++++++--------- .../edgeschema/ent/tweetlike_query.go | 52 ++++++++--------- .../edgeschema/ent/tweettag_query.go | 52 ++++++++--------- entc/integration/edgeschema/ent/user_query.go | 52 ++++++++--------- .../edgeschema/ent/usergroup_query.go | 52 ++++++++--------- .../edgeschema/ent/usertweet_query.go | 52 ++++++++--------- entc/integration/ent/api_query.go | 58 +++++++++---------- entc/integration/ent/builder_query.go | 58 +++++++++---------- entc/integration/ent/card_query.go | 58 +++++++++---------- entc/integration/ent/comment_query.go | 58 +++++++++---------- entc/integration/ent/exvaluescan_query.go | 58 +++++++++---------- entc/integration/ent/fieldtype_query.go | 58 +++++++++---------- entc/integration/ent/file_query.go | 58 +++++++++---------- entc/integration/ent/filetype_query.go | 58 +++++++++---------- entc/integration/ent/goods_query.go | 58 +++++++++---------- entc/integration/ent/group_query.go | 58 +++++++++---------- entc/integration/ent/groupinfo_query.go | 58 +++++++++---------- entc/integration/ent/item_query.go | 58 +++++++++---------- entc/integration/ent/license_query.go | 58 +++++++++---------- entc/integration/ent/node_query.go | 58 +++++++++---------- entc/integration/ent/pc_query.go | 58 +++++++++---------- entc/integration/ent/pet_query.go | 58 +++++++++---------- entc/integration/ent/spec_query.go | 58 +++++++++---------- entc/integration/ent/task_query.go | 58 +++++++++---------- entc/integration/ent/user_query.go | 58 +++++++++---------- entc/integration/gremlin/ent/api_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/builder_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/card_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/comment_query.go | 50 ++++++++-------- .../gremlin/ent/exvaluescan_query.go | 50 ++++++++-------- .../gremlin/ent/fieldtype_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/file_query.go | 50 ++++++++-------- .../integration/gremlin/ent/filetype_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/goods_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/group_query.go | 50 ++++++++-------- .../gremlin/ent/groupinfo_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/item_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/license_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/node_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/pc_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/pet_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/spec_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/task_query.go | 50 ++++++++-------- entc/integration/gremlin/ent/user_query.go | 50 ++++++++-------- entc/integration/hooks/ent/card_query.go | 52 ++++++++--------- entc/integration/hooks/ent/pet_query.go | 52 ++++++++--------- entc/integration/hooks/ent/user_query.go | 52 ++++++++--------- entc/integration/idtype/ent/user_query.go | 52 ++++++++--------- entc/integration/json/ent/user_query.go | 58 +++++++++---------- entc/integration/migrate/entv1/car_query.go | 52 ++++++++--------- .../migrate/entv1/conversion_query.go | 52 ++++++++--------- .../migrate/entv1/customtype_query.go | 52 ++++++++--------- entc/integration/migrate/entv1/user_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/blog_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/car_query.go | 52 ++++++++--------- .../migrate/entv2/conversion_query.go | 52 ++++++++--------- .../migrate/entv2/customtype_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/group_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/media_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/pet_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/user_query.go | 52 ++++++++--------- entc/integration/migrate/entv2/zoo_query.go | 52 ++++++++--------- .../migrate/versioned/group_query.go | 52 ++++++++--------- .../migrate/versioned/user_query.go | 52 ++++++++--------- .../multischema/ent/cleanuser_query.go | 58 +++++++++---------- .../multischema/ent/friendship_query.go | 58 +++++++++---------- .../multischema/ent/group_query.go | 58 +++++++++---------- .../multischema/ent/parent_query.go | 58 +++++++++---------- entc/integration/multischema/ent/pet_query.go | 58 +++++++++---------- .../integration/multischema/ent/user_query.go | 58 +++++++++---------- .../multischema/versioned/friendship_query.go | 58 +++++++++---------- .../multischema/versioned/group_query.go | 58 +++++++++---------- .../multischema/versioned/pet_query.go | 58 +++++++++---------- .../multischema/versioned/user_query.go | 58 +++++++++---------- entc/integration/privacy/ent/task_query.go | 52 ++++++++--------- entc/integration/privacy/ent/team_query.go | 52 ++++++++--------- entc/integration/privacy/ent/user_query.go | 52 ++++++++--------- entc/integration/template/ent/group_query.go | 52 ++++++++--------- entc/integration/template/ent/pet_query.go | 52 ++++++++--------- entc/integration/template/ent/user_query.go | 52 ++++++++--------- examples/compositetypes/ent/user_query.go | 52 ++++++++--------- examples/domaintypes/ent/user_query.go | 52 ++++++++--------- examples/edgeindex/ent/city_query.go | 52 ++++++++--------- examples/edgeindex/ent/street_query.go | 52 ++++++++--------- examples/encryptfield/ent/user_query.go | 52 ++++++++--------- examples/entcpkg/ent/user_query.go | 52 ++++++++--------- examples/enumtypes/ent/user_query.go | 52 ++++++++--------- examples/extensions/ent/user_query.go | 52 ++++++++--------- examples/fs/ent/file_query.go | 52 ++++++++--------- examples/functionalidx/ent/user_query.go | 52 ++++++++--------- examples/jsonencode/ent/card_query.go | 52 ++++++++--------- examples/jsonencode/ent/pet_query.go | 52 ++++++++--------- examples/jsonencode/ent/user_query.go | 52 ++++++++--------- examples/m2m2types/ent/group_query.go | 52 ++++++++--------- examples/m2m2types/ent/user_query.go | 52 ++++++++--------- examples/m2mbidi/ent/user_query.go | 52 ++++++++--------- examples/m2mrecur/ent/user_query.go | 52 ++++++++--------- examples/migration/ent/card_query.go | 52 ++++++++--------- examples/migration/ent/payment_query.go | 52 ++++++++--------- examples/migration/ent/pet_query.go | 52 ++++++++--------- examples/migration/ent/session_query.go | 52 ++++++++--------- examples/migration/ent/sessiondevice_query.go | 52 ++++++++--------- examples/migration/ent/user_query.go | 52 ++++++++--------- examples/o2m2types/ent/pet_query.go | 52 ++++++++--------- examples/o2m2types/ent/user_query.go | 52 ++++++++--------- examples/o2mrecur/ent/node_query.go | 52 ++++++++--------- examples/o2o2types/ent/card_query.go | 52 ++++++++--------- examples/o2o2types/ent/user_query.go | 52 ++++++++--------- examples/o2obidi/ent/user_query.go | 52 ++++++++--------- examples/o2orecur/ent/node_query.go | 52 ++++++++--------- examples/privacyadmin/ent/user_query.go | 52 ++++++++--------- examples/privacytenant/ent/group_query.go | 52 ++++++++--------- examples/privacytenant/ent/tenant_query.go | 52 ++++++++--------- examples/privacytenant/ent/user_query.go | 52 ++++++++--------- examples/rls/ent/tenant_query.go | 52 ++++++++--------- examples/rls/ent/user_query.go | 52 ++++++++--------- examples/start/ent/car_query.go | 52 ++++++++--------- examples/start/ent/group_query.go | 52 ++++++++--------- examples/start/ent/user_query.go | 52 ++++++++--------- examples/traversal/ent/group_query.go | 52 ++++++++--------- examples/traversal/ent/pet_query.go | 52 ++++++++--------- examples/traversal/ent/user_query.go | 52 ++++++++--------- examples/triggers/ent/user_query.go | 52 ++++++++--------- examples/triggers/ent/userauditlog_query.go | 52 ++++++++--------- examples/version/ent/user_query.go | 52 ++++++++--------- examples/viewcomposite/ent/cleanuser_query.go | 52 ++++++++--------- examples/viewcomposite/ent/pet_query.go | 52 ++++++++--------- .../viewcomposite/ent/petusername_query.go | 52 ++++++++--------- examples/viewcomposite/ent/user_query.go | 52 ++++++++--------- examples/viewschema/ent/cleanuser_query.go | 52 ++++++++--------- examples/viewschema/ent/pet_query.go | 52 ++++++++--------- examples/viewschema/ent/petusername_query.go | 52 ++++++++--------- examples/viewschema/ent/user_query.go | 52 ++++++++--------- 176 files changed, 4607 insertions(+), 4597 deletions(-) diff --git a/entc/gen/template/builder/query.tmpl b/entc/gen/template/builder/query.tmpl index 966ba2083..780422f33 100644 --- a/entc/gen/template/builder/query.tmpl +++ b/entc/gen/template/builder/query.tmpl @@ -428,7 +428,7 @@ func ({{ $receiver }} *{{ $builder }}) prepareQuery(ctx context.Context) error { {{/* groupby builder */}} -{{ $groupReceiver := receiver $groupBuilder }} +{{ $groupReceiver := $.GroupReceiver }} // {{ $groupBuilder }} is the group-by builder for {{ $.Name }} entities. type {{ $groupBuilder }} struct { @@ -458,7 +458,7 @@ func ({{ $groupReceiver }} *{{ $groupBuilder }}) Scan(ctx context.Context, v any {{/* select builder */}} -{{ $selectReceiver := receiver $selectBuilder }} +{{ $selectReceiver := $.SelectReceiver }} // {{ $selectBuilder }} is the builder for selecting fields of {{ pascal $.Name }} entities. type {{ $selectBuilder }} struct { diff --git a/entc/gen/type.go b/entc/gen/type.go index 96ee633db..76603c08d 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -899,6 +899,16 @@ func (t Type) MutationName() string { return pascal(t.Name) + "Mutation" } +// GroupReceiver returns the receiver name of the group-by builder for this type. +func (t Type) GroupReceiver() string { + return "_g" +} + +// SelectReceiver returns the receiver name of the selector builder for this type. +func (t Type) SelectReceiver() string { + return "_s" +} + // TypeName returns the constant name of the type defined in mutation.go. func (t Type) TypeName() string { return "Type" + pascal(t.Name) diff --git a/entc/integration/cascadelete/ent/comment_query.go b/entc/integration/cascadelete/ent/comment_query.go index 4d73e88e9..4c47a911f 100644 --- a/entc/integration/cascadelete/ent/comment_query.go +++ b/entc/integration/cascadelete/ent/comment_query.go @@ -526,41 +526,41 @@ type CommentGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CommentGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CommentGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CommentGroupBy) sqlScan(ctx context.Context, root *CommentQuery, v any) error { +func (_g *CommentGroupBy) sqlScan(ctx context.Context, root *CommentQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type CommentSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CommentSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CommentSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, cs.CommentQuery, cs, cs.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, _s.CommentQuery, _s, _s.inters, v) } -func (cs *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) error { +func (_s *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (cs *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/cascadelete/ent/post_query.go b/entc/integration/cascadelete/ent/post_query.go index 3db11a013..c59afcabd 100644 --- a/entc/integration/cascadelete/ent/post_query.go +++ b/entc/integration/cascadelete/ent/post_query.go @@ -601,41 +601,41 @@ type PostGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PostGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PostGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PostQuery, *PostGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PostQuery, *PostGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PostGroupBy) sqlScan(ctx context.Context, root *PostQuery, v any) error { +func (_g *PostGroupBy) sqlScan(ctx context.Context, root *PostQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type PostSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PostSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PostSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PostQuery, *PostSelect](ctx, ps.PostQuery, ps, ps.inters, v) + return scanWithInterceptors[*PostQuery, *PostSelect](ctx, _s.PostQuery, _s, _s.inters, v) } -func (ps *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error { +func (_s *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (ps *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/cascadelete/ent/user_query.go b/entc/integration/cascadelete/ent/user_query.go index 5386a3aac..948eb08ce 100644 --- a/entc/integration/cascadelete/ent/user_query.go +++ b/entc/integration/cascadelete/ent/user_query.go @@ -526,41 +526,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/config/ent/user_query.go b/entc/integration/config/ent/user_query.go index c2614f9b0..e342d27f0 100644 --- a/entc/integration/config/ent/user_query.go +++ b/entc/integration/config/ent/user_query.go @@ -447,41 +447,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/account_query.go b/entc/integration/customid/ent/account_query.go index 80bb5ceef..c55e8b185 100644 --- a/entc/integration/customid/ent/account_query.go +++ b/entc/integration/customid/ent/account_query.go @@ -528,41 +528,41 @@ type AccountGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (agb *AccountGroupBy) Aggregate(fns ...AggregateFunc) *AccountGroupBy { - agb.fns = append(agb.fns, fns...) - return agb +func (_g *AccountGroupBy) Aggregate(fns ...AggregateFunc) *AccountGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (agb *AccountGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy) - if err := agb.build.prepareQuery(ctx); err != nil { +func (_g *AccountGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AccountQuery, *AccountGroupBy](ctx, agb.build, agb, agb.build.inters, v) + return scanWithInterceptors[*AccountQuery, *AccountGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (agb *AccountGroupBy) sqlScan(ctx context.Context, root *AccountQuery, v any) error { +func (_g *AccountGroupBy) sqlScan(ctx context.Context, root *AccountQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(agb.fns)) - for _, fn := range agb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*agb.flds)+len(agb.fns)) - for _, f := range *agb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*agb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := agb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -576,27 +576,27 @@ type AccountSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (as *AccountSelect) Aggregate(fns ...AggregateFunc) *AccountSelect { - as.fns = append(as.fns, fns...) - return as +func (_s *AccountSelect) Aggregate(fns ...AggregateFunc) *AccountSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (as *AccountSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect) - if err := as.prepareQuery(ctx); err != nil { +func (_s *AccountSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AccountQuery, *AccountSelect](ctx, as.AccountQuery, as, as.inters, v) + return scanWithInterceptors[*AccountQuery, *AccountSelect](ctx, _s.AccountQuery, _s, _s.inters, v) } -func (as *AccountSelect) sqlScan(ctx context.Context, root *AccountQuery, v any) error { +func (_s *AccountSelect) sqlScan(ctx context.Context, root *AccountQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(as.fns)) - for _, fn := range as.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*as.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -604,7 +604,7 @@ func (as *AccountSelect) sqlScan(ctx context.Context, root *AccountQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := as.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/blob_query.go b/entc/integration/customid/ent/blob_query.go index d36a26b2a..8d9ed7c3b 100644 --- a/entc/integration/customid/ent/blob_query.go +++ b/entc/integration/customid/ent/blob_query.go @@ -713,41 +713,41 @@ type BlobGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (bgb *BlobGroupBy) Aggregate(fns ...AggregateFunc) *BlobGroupBy { - bgb.fns = append(bgb.fns, fns...) - return bgb +func (_g *BlobGroupBy) Aggregate(fns ...AggregateFunc) *BlobGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (bgb *BlobGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) - if err := bgb.build.prepareQuery(ctx); err != nil { +func (_g *BlobGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlobQuery, *BlobGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) + return scanWithInterceptors[*BlobQuery, *BlobGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (bgb *BlobGroupBy) sqlScan(ctx context.Context, root *BlobQuery, v any) error { +func (_g *BlobGroupBy) sqlScan(ctx context.Context, root *BlobQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(bgb.fns)) - for _, fn := range bgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns)) - for _, f := range *bgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*bgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -761,27 +761,27 @@ type BlobSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bs *BlobSelect) Aggregate(fns ...AggregateFunc) *BlobSelect { - bs.fns = append(bs.fns, fns...) - return bs +func (_s *BlobSelect) Aggregate(fns ...AggregateFunc) *BlobSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bs *BlobSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) - if err := bs.prepareQuery(ctx); err != nil { +func (_s *BlobSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlobQuery, *BlobSelect](ctx, bs.BlobQuery, bs, bs.inters, v) + return scanWithInterceptors[*BlobQuery, *BlobSelect](ctx, _s.BlobQuery, _s, _s.inters, v) } -func (bs *BlobSelect) sqlScan(ctx context.Context, root *BlobQuery, v any) error { +func (_s *BlobSelect) sqlScan(ctx context.Context, root *BlobQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(bs.fns)) - for _, fn := range bs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*bs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -789,7 +789,7 @@ func (bs *BlobSelect) sqlScan(ctx context.Context, root *BlobQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := bs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/bloblink_query.go b/entc/integration/customid/ent/bloblink_query.go index 307903851..7eb92d12d 100644 --- a/entc/integration/customid/ent/bloblink_query.go +++ b/entc/integration/customid/ent/bloblink_query.go @@ -523,41 +523,41 @@ type BlobLinkGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (blgb *BlobLinkGroupBy) Aggregate(fns ...AggregateFunc) *BlobLinkGroupBy { - blgb.fns = append(blgb.fns, fns...) - return blgb +func (_g *BlobLinkGroupBy) Aggregate(fns ...AggregateFunc) *BlobLinkGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (blgb *BlobLinkGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, blgb.build.ctx, ent.OpQueryGroupBy) - if err := blgb.build.prepareQuery(ctx); err != nil { +func (_g *BlobLinkGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlobLinkQuery, *BlobLinkGroupBy](ctx, blgb.build, blgb, blgb.build.inters, v) + return scanWithInterceptors[*BlobLinkQuery, *BlobLinkGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (blgb *BlobLinkGroupBy) sqlScan(ctx context.Context, root *BlobLinkQuery, v any) error { +func (_g *BlobLinkGroupBy) sqlScan(ctx context.Context, root *BlobLinkQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(blgb.fns)) - for _, fn := range blgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*blgb.flds)+len(blgb.fns)) - for _, f := range *blgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*blgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := blgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -571,27 +571,27 @@ type BlobLinkSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bls *BlobLinkSelect) Aggregate(fns ...AggregateFunc) *BlobLinkSelect { - bls.fns = append(bls.fns, fns...) - return bls +func (_s *BlobLinkSelect) Aggregate(fns ...AggregateFunc) *BlobLinkSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bls *BlobLinkSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bls.ctx, ent.OpQuerySelect) - if err := bls.prepareQuery(ctx); err != nil { +func (_s *BlobLinkSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlobLinkQuery, *BlobLinkSelect](ctx, bls.BlobLinkQuery, bls, bls.inters, v) + return scanWithInterceptors[*BlobLinkQuery, *BlobLinkSelect](ctx, _s.BlobLinkQuery, _s, _s.inters, v) } -func (bls *BlobLinkSelect) sqlScan(ctx context.Context, root *BlobLinkQuery, v any) error { +func (_s *BlobLinkSelect) sqlScan(ctx context.Context, root *BlobLinkQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(bls.fns)) - for _, fn := range bls.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*bls.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -599,7 +599,7 @@ func (bls *BlobLinkSelect) sqlScan(ctx context.Context, root *BlobLinkQuery, v a } rows := &sql.Rows{} query, args := selector.Query() - if err := bls.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/car_query.go b/entc/integration/customid/ent/car_query.go index c0c36feb6..61fbe334d 100644 --- a/entc/integration/customid/ent/car_query.go +++ b/entc/integration/customid/ent/car_query.go @@ -534,41 +534,41 @@ type CarGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CarGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_g *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type CarSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CarSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CarSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarSelect](ctx, cs.CarQuery, cs, cs.inters, v) + return scanWithInterceptors[*CarQuery, *CarSelect](ctx, _s.CarQuery, _s, _s.inters, v) } -func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_s *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/device_query.go b/entc/integration/customid/ent/device_query.go index d72deb3a3..c880f5d18 100644 --- a/entc/integration/customid/ent/device_query.go +++ b/entc/integration/customid/ent/device_query.go @@ -588,41 +588,41 @@ type DeviceGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (dgb *DeviceGroupBy) Aggregate(fns ...AggregateFunc) *DeviceGroupBy { - dgb.fns = append(dgb.fns, fns...) - return dgb +func (_g *DeviceGroupBy) Aggregate(fns ...AggregateFunc) *DeviceGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (dgb *DeviceGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, dgb.build.ctx, ent.OpQueryGroupBy) - if err := dgb.build.prepareQuery(ctx); err != nil { +func (_g *DeviceGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DeviceQuery, *DeviceGroupBy](ctx, dgb.build, dgb, dgb.build.inters, v) + return scanWithInterceptors[*DeviceQuery, *DeviceGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (dgb *DeviceGroupBy) sqlScan(ctx context.Context, root *DeviceQuery, v any) error { +func (_g *DeviceGroupBy) sqlScan(ctx context.Context, root *DeviceQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(dgb.fns)) - for _, fn := range dgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*dgb.flds)+len(dgb.fns)) - for _, f := range *dgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*dgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := dgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -636,27 +636,27 @@ type DeviceSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ds *DeviceSelect) Aggregate(fns ...AggregateFunc) *DeviceSelect { - ds.fns = append(ds.fns, fns...) - return ds +func (_s *DeviceSelect) Aggregate(fns ...AggregateFunc) *DeviceSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ds *DeviceSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ds.ctx, ent.OpQuerySelect) - if err := ds.prepareQuery(ctx); err != nil { +func (_s *DeviceSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DeviceQuery, *DeviceSelect](ctx, ds.DeviceQuery, ds, ds.inters, v) + return scanWithInterceptors[*DeviceQuery, *DeviceSelect](ctx, _s.DeviceQuery, _s, _s.inters, v) } -func (ds *DeviceSelect) sqlScan(ctx context.Context, root *DeviceQuery, v any) error { +func (_s *DeviceSelect) sqlScan(ctx context.Context, root *DeviceQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ds.fns)) - for _, fn := range ds.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ds.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -664,7 +664,7 @@ func (ds *DeviceSelect) sqlScan(ctx context.Context, root *DeviceQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ds.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/doc_query.go b/entc/integration/customid/ent/doc_query.go index d3826305b..5c57b4711 100644 --- a/entc/integration/customid/ent/doc_query.go +++ b/entc/integration/customid/ent/doc_query.go @@ -713,41 +713,41 @@ type DocGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (dgb *DocGroupBy) Aggregate(fns ...AggregateFunc) *DocGroupBy { - dgb.fns = append(dgb.fns, fns...) - return dgb +func (_g *DocGroupBy) Aggregate(fns ...AggregateFunc) *DocGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (dgb *DocGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, dgb.build.ctx, ent.OpQueryGroupBy) - if err := dgb.build.prepareQuery(ctx); err != nil { +func (_g *DocGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DocQuery, *DocGroupBy](ctx, dgb.build, dgb, dgb.build.inters, v) + return scanWithInterceptors[*DocQuery, *DocGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (dgb *DocGroupBy) sqlScan(ctx context.Context, root *DocQuery, v any) error { +func (_g *DocGroupBy) sqlScan(ctx context.Context, root *DocQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(dgb.fns)) - for _, fn := range dgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*dgb.flds)+len(dgb.fns)) - for _, f := range *dgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*dgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := dgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -761,27 +761,27 @@ type DocSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ds *DocSelect) Aggregate(fns ...AggregateFunc) *DocSelect { - ds.fns = append(ds.fns, fns...) - return ds +func (_s *DocSelect) Aggregate(fns ...AggregateFunc) *DocSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ds *DocSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ds.ctx, ent.OpQuerySelect) - if err := ds.prepareQuery(ctx); err != nil { +func (_s *DocSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*DocQuery, *DocSelect](ctx, ds.DocQuery, ds, ds.inters, v) + return scanWithInterceptors[*DocQuery, *DocSelect](ctx, _s.DocQuery, _s, _s.inters, v) } -func (ds *DocSelect) sqlScan(ctx context.Context, root *DocQuery, v any) error { +func (_s *DocSelect) sqlScan(ctx context.Context, root *DocQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ds.fns)) - for _, fn := range ds.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ds.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -789,7 +789,7 @@ func (ds *DocSelect) sqlScan(ctx context.Context, root *DocQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ds.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/group_query.go b/entc/integration/customid/ent/group_query.go index 17b4d7b94..ad1b7adaa 100644 --- a/entc/integration/customid/ent/group_query.go +++ b/entc/integration/customid/ent/group_query.go @@ -535,41 +535,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -583,27 +583,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -611,7 +611,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/intsid_query.go b/entc/integration/customid/ent/intsid_query.go index 0e5aeb770..921a1f917 100644 --- a/entc/integration/customid/ent/intsid_query.go +++ b/entc/integration/customid/ent/intsid_query.go @@ -587,41 +587,41 @@ type IntSIDGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (isgb *IntSIDGroupBy) Aggregate(fns ...AggregateFunc) *IntSIDGroupBy { - isgb.fns = append(isgb.fns, fns...) - return isgb +func (_g *IntSIDGroupBy) Aggregate(fns ...AggregateFunc) *IntSIDGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (isgb *IntSIDGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, isgb.build.ctx, ent.OpQueryGroupBy) - if err := isgb.build.prepareQuery(ctx); err != nil { +func (_g *IntSIDGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*IntSIDQuery, *IntSIDGroupBy](ctx, isgb.build, isgb, isgb.build.inters, v) + return scanWithInterceptors[*IntSIDQuery, *IntSIDGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (isgb *IntSIDGroupBy) sqlScan(ctx context.Context, root *IntSIDQuery, v any) error { +func (_g *IntSIDGroupBy) sqlScan(ctx context.Context, root *IntSIDQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(isgb.fns)) - for _, fn := range isgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*isgb.flds)+len(isgb.fns)) - for _, f := range *isgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*isgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := isgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -635,27 +635,27 @@ type IntSIDSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (iss *IntSIDSelect) Aggregate(fns ...AggregateFunc) *IntSIDSelect { - iss.fns = append(iss.fns, fns...) - return iss +func (_s *IntSIDSelect) Aggregate(fns ...AggregateFunc) *IntSIDSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (iss *IntSIDSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, iss.ctx, ent.OpQuerySelect) - if err := iss.prepareQuery(ctx); err != nil { +func (_s *IntSIDSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*IntSIDQuery, *IntSIDSelect](ctx, iss.IntSIDQuery, iss, iss.inters, v) + return scanWithInterceptors[*IntSIDQuery, *IntSIDSelect](ctx, _s.IntSIDQuery, _s, _s.inters, v) } -func (iss *IntSIDSelect) sqlScan(ctx context.Context, root *IntSIDQuery, v any) error { +func (_s *IntSIDSelect) sqlScan(ctx context.Context, root *IntSIDQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(iss.fns)) - for _, fn := range iss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*iss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -663,7 +663,7 @@ func (iss *IntSIDSelect) sqlScan(ctx context.Context, root *IntSIDQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := iss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/link_query.go b/entc/integration/customid/ent/link_query.go index 91b136b40..9381ea887 100644 --- a/entc/integration/customid/ent/link_query.go +++ b/entc/integration/customid/ent/link_query.go @@ -448,41 +448,41 @@ type LinkGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (lgb *LinkGroupBy) Aggregate(fns ...AggregateFunc) *LinkGroupBy { - lgb.fns = append(lgb.fns, fns...) - return lgb +func (_g *LinkGroupBy) Aggregate(fns ...AggregateFunc) *LinkGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (lgb *LinkGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy) - if err := lgb.build.prepareQuery(ctx); err != nil { +func (_g *LinkGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LinkQuery, *LinkGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v) + return scanWithInterceptors[*LinkQuery, *LinkGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (lgb *LinkGroupBy) sqlScan(ctx context.Context, root *LinkQuery, v any) error { +func (_g *LinkGroupBy) sqlScan(ctx context.Context, root *LinkQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(lgb.fns)) - for _, fn := range lgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*lgb.flds)+len(lgb.fns)) - for _, f := range *lgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*lgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := lgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -496,27 +496,27 @@ type LinkSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ls *LinkSelect) Aggregate(fns ...AggregateFunc) *LinkSelect { - ls.fns = append(ls.fns, fns...) - return ls +func (_s *LinkSelect) Aggregate(fns ...AggregateFunc) *LinkSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ls *LinkSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect) - if err := ls.prepareQuery(ctx); err != nil { +func (_s *LinkSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LinkQuery, *LinkSelect](ctx, ls.LinkQuery, ls, ls.inters, v) + return scanWithInterceptors[*LinkQuery, *LinkSelect](ctx, _s.LinkQuery, _s, _s.inters, v) } -func (ls *LinkSelect) sqlScan(ctx context.Context, root *LinkQuery, v any) error { +func (_s *LinkSelect) sqlScan(ctx context.Context, root *LinkQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ls.fns)) - for _, fn := range ls.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ls.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -524,7 +524,7 @@ func (ls *LinkSelect) sqlScan(ctx context.Context, root *LinkQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ls.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/mixinid_query.go b/entc/integration/customid/ent/mixinid_query.go index d5951f57a..0eb9f1435 100644 --- a/entc/integration/customid/ent/mixinid_query.go +++ b/entc/integration/customid/ent/mixinid_query.go @@ -448,41 +448,41 @@ type MixinIDGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (migb *MixinIDGroupBy) Aggregate(fns ...AggregateFunc) *MixinIDGroupBy { - migb.fns = append(migb.fns, fns...) - return migb +func (_g *MixinIDGroupBy) Aggregate(fns ...AggregateFunc) *MixinIDGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (migb *MixinIDGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, migb.build.ctx, ent.OpQueryGroupBy) - if err := migb.build.prepareQuery(ctx); err != nil { +func (_g *MixinIDGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MixinIDQuery, *MixinIDGroupBy](ctx, migb.build, migb, migb.build.inters, v) + return scanWithInterceptors[*MixinIDQuery, *MixinIDGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (migb *MixinIDGroupBy) sqlScan(ctx context.Context, root *MixinIDQuery, v any) error { +func (_g *MixinIDGroupBy) sqlScan(ctx context.Context, root *MixinIDQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(migb.fns)) - for _, fn := range migb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*migb.flds)+len(migb.fns)) - for _, f := range *migb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*migb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := migb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -496,27 +496,27 @@ type MixinIDSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (mis *MixinIDSelect) Aggregate(fns ...AggregateFunc) *MixinIDSelect { - mis.fns = append(mis.fns, fns...) - return mis +func (_s *MixinIDSelect) Aggregate(fns ...AggregateFunc) *MixinIDSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (mis *MixinIDSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mis.ctx, ent.OpQuerySelect) - if err := mis.prepareQuery(ctx); err != nil { +func (_s *MixinIDSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MixinIDQuery, *MixinIDSelect](ctx, mis.MixinIDQuery, mis, mis.inters, v) + return scanWithInterceptors[*MixinIDQuery, *MixinIDSelect](ctx, _s.MixinIDQuery, _s, _s.inters, v) } -func (mis *MixinIDSelect) sqlScan(ctx context.Context, root *MixinIDQuery, v any) error { +func (_s *MixinIDSelect) sqlScan(ctx context.Context, root *MixinIDQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(mis.fns)) - for _, fn := range mis.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*mis.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -524,7 +524,7 @@ func (mis *MixinIDSelect) sqlScan(ctx context.Context, root *MixinIDQuery, v any } rows := &sql.Rows{} query, args := selector.Query() - if err := mis.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/note_query.go b/entc/integration/customid/ent/note_query.go index 522c4bc1e..840fe83f9 100644 --- a/entc/integration/customid/ent/note_query.go +++ b/entc/integration/customid/ent/note_query.go @@ -609,41 +609,41 @@ type NoteGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NoteGroupBy) Aggregate(fns ...AggregateFunc) *NoteGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NoteGroupBy) Aggregate(fns ...AggregateFunc) *NoteGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NoteGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NoteGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NoteQuery, *NoteGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NoteQuery, *NoteGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NoteGroupBy) sqlScan(ctx context.Context, root *NoteQuery, v any) error { +func (_g *NoteGroupBy) sqlScan(ctx context.Context, root *NoteQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ngb.fns)) - for _, fn := range ngb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns)) - for _, f := range *ngb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ngb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -657,27 +657,27 @@ type NoteSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NoteSelect) Aggregate(fns ...AggregateFunc) *NoteSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NoteSelect) Aggregate(fns ...AggregateFunc) *NoteSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NoteSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NoteSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NoteQuery, *NoteSelect](ctx, ns.NoteQuery, ns, ns.inters, v) + return scanWithInterceptors[*NoteQuery, *NoteSelect](ctx, _s.NoteQuery, _s, _s.inters, v) } -func (ns *NoteSelect) sqlScan(ctx context.Context, root *NoteQuery, v any) error { +func (_s *NoteSelect) sqlScan(ctx context.Context, root *NoteQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ns.fns)) - for _, fn := range ns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -685,7 +685,7 @@ func (ns *NoteSelect) sqlScan(ctx context.Context, root *NoteQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/other_query.go b/entc/integration/customid/ent/other_query.go index 496e5cc4a..7f6b58794 100644 --- a/entc/integration/customid/ent/other_query.go +++ b/entc/integration/customid/ent/other_query.go @@ -426,41 +426,41 @@ type OtherGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ogb *OtherGroupBy) Aggregate(fns ...AggregateFunc) *OtherGroupBy { - ogb.fns = append(ogb.fns, fns...) - return ogb +func (_g *OtherGroupBy) Aggregate(fns ...AggregateFunc) *OtherGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ogb *OtherGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ogb.build.ctx, ent.OpQueryGroupBy) - if err := ogb.build.prepareQuery(ctx); err != nil { +func (_g *OtherGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*OtherQuery, *OtherGroupBy](ctx, ogb.build, ogb, ogb.build.inters, v) + return scanWithInterceptors[*OtherQuery, *OtherGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ogb *OtherGroupBy) sqlScan(ctx context.Context, root *OtherQuery, v any) error { +func (_g *OtherGroupBy) sqlScan(ctx context.Context, root *OtherQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ogb.fns)) - for _, fn := range ogb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ogb.flds)+len(ogb.fns)) - for _, f := range *ogb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ogb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ogb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -474,27 +474,27 @@ type OtherSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (os *OtherSelect) Aggregate(fns ...AggregateFunc) *OtherSelect { - os.fns = append(os.fns, fns...) - return os +func (_s *OtherSelect) Aggregate(fns ...AggregateFunc) *OtherSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (os *OtherSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, os.ctx, ent.OpQuerySelect) - if err := os.prepareQuery(ctx); err != nil { +func (_s *OtherSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*OtherQuery, *OtherSelect](ctx, os.OtherQuery, os, os.inters, v) + return scanWithInterceptors[*OtherQuery, *OtherSelect](ctx, _s.OtherQuery, _s, _s.inters, v) } -func (os *OtherSelect) sqlScan(ctx context.Context, root *OtherQuery, v any) error { +func (_s *OtherSelect) sqlScan(ctx context.Context, root *OtherQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(os.fns)) - for _, fn := range os.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*os.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -502,7 +502,7 @@ func (os *OtherSelect) sqlScan(ctx context.Context, root *OtherQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := os.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/pet_query.go b/entc/integration/customid/ent/pet_query.go index 3075bec40..a6eaf8dca 100644 --- a/entc/integration/customid/ent/pet_query.go +++ b/entc/integration/customid/ent/pet_query.go @@ -766,41 +766,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -814,27 +814,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -842,7 +842,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/revision_query.go b/entc/integration/customid/ent/revision_query.go index e77e63c4a..bed03df83 100644 --- a/entc/integration/customid/ent/revision_query.go +++ b/entc/integration/customid/ent/revision_query.go @@ -425,41 +425,41 @@ type RevisionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rgb *RevisionGroupBy) Aggregate(fns ...AggregateFunc) *RevisionGroupBy { - rgb.fns = append(rgb.fns, fns...) - return rgb +func (_g *RevisionGroupBy) Aggregate(fns ...AggregateFunc) *RevisionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rgb *RevisionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rgb.build.ctx, ent.OpQueryGroupBy) - if err := rgb.build.prepareQuery(ctx); err != nil { +func (_g *RevisionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RevisionQuery, *RevisionGroupBy](ctx, rgb.build, rgb, rgb.build.inters, v) + return scanWithInterceptors[*RevisionQuery, *RevisionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rgb *RevisionGroupBy) sqlScan(ctx context.Context, root *RevisionQuery, v any) error { +func (_g *RevisionGroupBy) sqlScan(ctx context.Context, root *RevisionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rgb.fns)) - for _, fn := range rgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rgb.flds)+len(rgb.fns)) - for _, f := range *rgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -473,27 +473,27 @@ type RevisionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (rs *RevisionSelect) Aggregate(fns ...AggregateFunc) *RevisionSelect { - rs.fns = append(rs.fns, fns...) - return rs +func (_s *RevisionSelect) Aggregate(fns ...AggregateFunc) *RevisionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (rs *RevisionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rs.ctx, ent.OpQuerySelect) - if err := rs.prepareQuery(ctx); err != nil { +func (_s *RevisionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RevisionQuery, *RevisionSelect](ctx, rs.RevisionQuery, rs, rs.inters, v) + return scanWithInterceptors[*RevisionQuery, *RevisionSelect](ctx, _s.RevisionQuery, _s, _s.inters, v) } -func (rs *RevisionSelect) sqlScan(ctx context.Context, root *RevisionQuery, v any) error { +func (_s *RevisionSelect) sqlScan(ctx context.Context, root *RevisionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(rs.fns)) - for _, fn := range rs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*rs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -501,7 +501,7 @@ func (rs *RevisionSelect) sqlScan(ctx context.Context, root *RevisionQuery, v an } rows := &sql.Rows{} query, args := selector.Query() - if err := rs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/session_query.go b/entc/integration/customid/ent/session_query.go index 4a817ad68..dbd63ea05 100644 --- a/entc/integration/customid/ent/session_query.go +++ b/entc/integration/customid/ent/session_query.go @@ -513,41 +513,41 @@ type SessionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb +func (_g *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sgb *SessionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) - if err := sgb.build.prepareQuery(ctx); err != nil { +func (_g *SessionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionQuery, *SessionGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v) + return scanWithInterceptors[*SessionQuery, *SessionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sgb *SessionGroupBy) sqlScan(ctx context.Context, root *SessionQuery, v any) error { +func (_g *SessionGroupBy) sqlScan(ctx context.Context, root *SessionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*sgb.flds)+len(sgb.fns)) - for _, f := range *sgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*sgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := sgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -561,27 +561,27 @@ type SessionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ss *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect { - ss.fns = append(ss.fns, fns...) - return ss +func (_s *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ss *SessionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) - if err := ss.prepareQuery(ctx); err != nil { +func (_s *SessionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionQuery, *SessionSelect](ctx, ss.SessionQuery, ss, ss.inters, v) + return scanWithInterceptors[*SessionQuery, *SessionSelect](ctx, _s.SessionQuery, _s, _s.inters, v) } -func (ss *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) error { +func (_s *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ss.fns)) - for _, fn := range ss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -589,7 +589,7 @@ func (ss *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/token_query.go b/entc/integration/customid/ent/token_query.go index 3efc66787..58791af6a 100644 --- a/entc/integration/customid/ent/token_query.go +++ b/entc/integration/customid/ent/token_query.go @@ -535,41 +535,41 @@ type TokenGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TokenGroupBy) Aggregate(fns ...AggregateFunc) *TokenGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TokenGroupBy) Aggregate(fns ...AggregateFunc) *TokenGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TokenGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TokenGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TokenQuery, *TokenGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TokenQuery, *TokenGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TokenGroupBy) sqlScan(ctx context.Context, root *TokenQuery, v any) error { +func (_g *TokenGroupBy) sqlScan(ctx context.Context, root *TokenQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -583,27 +583,27 @@ type TokenSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TokenSelect) Aggregate(fns ...AggregateFunc) *TokenSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TokenSelect) Aggregate(fns ...AggregateFunc) *TokenSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TokenSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TokenSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TokenQuery, *TokenSelect](ctx, ts.TokenQuery, ts, ts.inters, v) + return scanWithInterceptors[*TokenQuery, *TokenSelect](ctx, _s.TokenQuery, _s, _s.inters, v) } -func (ts *TokenSelect) sqlScan(ctx context.Context, root *TokenQuery, v any) error { +func (_s *TokenSelect) sqlScan(ctx context.Context, root *TokenQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -611,7 +611,7 @@ func (ts *TokenSelect) sqlScan(ctx context.Context, root *TokenQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/customid/ent/user_query.go b/entc/integration/customid/ent/user_query.go index 8aa877932..9a9ac009f 100644 --- a/entc/integration/customid/ent/user_query.go +++ b/entc/integration/customid/ent/user_query.go @@ -766,41 +766,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -814,27 +814,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -842,7 +842,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/car_query.go b/entc/integration/edgefield/ent/car_query.go index a80886dd6..97f79f09c 100644 --- a/entc/integration/edgefield/ent/car_query.go +++ b/entc/integration/edgefield/ent/car_query.go @@ -549,41 +549,41 @@ type CarGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CarGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_g *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -597,27 +597,27 @@ type CarSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CarSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CarSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarSelect](ctx, cs.CarQuery, cs, cs.inters, v) + return scanWithInterceptors[*CarQuery, *CarSelect](ctx, _s.CarQuery, _s, _s.inters, v) } -func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_s *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -625,7 +625,7 @@ func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/card_query.go b/entc/integration/edgefield/ent/card_query.go index 4b711b662..227a87fb0 100644 --- a/entc/integration/edgefield/ent/card_query.go +++ b/entc/integration/edgefield/ent/card_query.go @@ -526,41 +526,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/info_query.go b/entc/integration/edgefield/ent/info_query.go index f8845005d..0d9829ffb 100644 --- a/entc/integration/edgefield/ent/info_query.go +++ b/entc/integration/edgefield/ent/info_query.go @@ -523,41 +523,41 @@ type InfoGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (igb *InfoGroupBy) Aggregate(fns ...AggregateFunc) *InfoGroupBy { - igb.fns = append(igb.fns, fns...) - return igb +func (_g *InfoGroupBy) Aggregate(fns ...AggregateFunc) *InfoGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (igb *InfoGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, igb.build.ctx, ent.OpQueryGroupBy) - if err := igb.build.prepareQuery(ctx); err != nil { +func (_g *InfoGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*InfoQuery, *InfoGroupBy](ctx, igb.build, igb, igb.build.inters, v) + return scanWithInterceptors[*InfoQuery, *InfoGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (igb *InfoGroupBy) sqlScan(ctx context.Context, root *InfoQuery, v any) error { +func (_g *InfoGroupBy) sqlScan(ctx context.Context, root *InfoQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(igb.fns)) - for _, fn := range igb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*igb.flds)+len(igb.fns)) - for _, f := range *igb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*igb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := igb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -571,27 +571,27 @@ type InfoSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (is *InfoSelect) Aggregate(fns ...AggregateFunc) *InfoSelect { - is.fns = append(is.fns, fns...) - return is +func (_s *InfoSelect) Aggregate(fns ...AggregateFunc) *InfoSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (is *InfoSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, is.ctx, ent.OpQuerySelect) - if err := is.prepareQuery(ctx); err != nil { +func (_s *InfoSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*InfoQuery, *InfoSelect](ctx, is.InfoQuery, is, is.inters, v) + return scanWithInterceptors[*InfoQuery, *InfoSelect](ctx, _s.InfoQuery, _s, _s.inters, v) } -func (is *InfoSelect) sqlScan(ctx context.Context, root *InfoQuery, v any) error { +func (_s *InfoSelect) sqlScan(ctx context.Context, root *InfoQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(is.fns)) - for _, fn := range is.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*is.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -599,7 +599,7 @@ func (is *InfoSelect) sqlScan(ctx context.Context, root *InfoQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := is.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/metadata_query.go b/entc/integration/edgefield/ent/metadata_query.go index ee224374e..449f7d9bf 100644 --- a/entc/integration/edgefield/ent/metadata_query.go +++ b/entc/integration/edgefield/ent/metadata_query.go @@ -693,41 +693,41 @@ type MetadataGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (mgb *MetadataGroupBy) Aggregate(fns ...AggregateFunc) *MetadataGroupBy { - mgb.fns = append(mgb.fns, fns...) - return mgb +func (_g *MetadataGroupBy) Aggregate(fns ...AggregateFunc) *MetadataGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (mgb *MetadataGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) - if err := mgb.build.prepareQuery(ctx); err != nil { +func (_g *MetadataGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetadataQuery, *MetadataGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v) + return scanWithInterceptors[*MetadataQuery, *MetadataGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (mgb *MetadataGroupBy) sqlScan(ctx context.Context, root *MetadataQuery, v any) error { +func (_g *MetadataGroupBy) sqlScan(ctx context.Context, root *MetadataQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(mgb.fns)) - for _, fn := range mgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns)) - for _, f := range *mgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*mgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -741,27 +741,27 @@ type MetadataSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ms *MetadataSelect) Aggregate(fns ...AggregateFunc) *MetadataSelect { - ms.fns = append(ms.fns, fns...) - return ms +func (_s *MetadataSelect) Aggregate(fns ...AggregateFunc) *MetadataSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ms *MetadataSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) - if err := ms.prepareQuery(ctx); err != nil { +func (_s *MetadataSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MetadataQuery, *MetadataSelect](ctx, ms.MetadataQuery, ms, ms.inters, v) + return scanWithInterceptors[*MetadataQuery, *MetadataSelect](ctx, _s.MetadataQuery, _s, _s.inters, v) } -func (ms *MetadataSelect) sqlScan(ctx context.Context, root *MetadataQuery, v any) error { +func (_s *MetadataSelect) sqlScan(ctx context.Context, root *MetadataQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ms.fns)) - for _, fn := range ms.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ms.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -769,7 +769,7 @@ func (ms *MetadataSelect) sqlScan(ctx context.Context, root *MetadataQuery, v an } rows := &sql.Rows{} query, args := selector.Query() - if err := ms.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/node_query.go b/entc/integration/edgefield/ent/node_query.go index 850152732..8441377ea 100644 --- a/entc/integration/edgefield/ent/node_query.go +++ b/entc/integration/edgefield/ent/node_query.go @@ -595,41 +595,41 @@ type NodeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_g *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ngb.fns)) - for _, fn := range ngb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns)) - for _, f := range *ngb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ngb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -643,27 +643,27 @@ type NodeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NodeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, ns.NodeQuery, ns, ns.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, _s.NodeQuery, _s, _s.inters, v) } -func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_s *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ns.fns)) - for _, fn := range ns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -671,7 +671,7 @@ func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/pet_query.go b/entc/integration/edgefield/ent/pet_query.go index 558f10d72..34deb3cb0 100644 --- a/entc/integration/edgefield/ent/pet_query.go +++ b/entc/integration/edgefield/ent/pet_query.go @@ -526,41 +526,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/post_query.go b/entc/integration/edgefield/ent/post_query.go index f74593548..e69ac8158 100644 --- a/entc/integration/edgefield/ent/post_query.go +++ b/entc/integration/edgefield/ent/post_query.go @@ -529,41 +529,41 @@ type PostGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PostGroupBy) Aggregate(fns ...AggregateFunc) *PostGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PostGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PostGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PostQuery, *PostGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PostQuery, *PostGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PostGroupBy) sqlScan(ctx context.Context, root *PostQuery, v any) error { +func (_g *PostGroupBy) sqlScan(ctx context.Context, root *PostQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -577,27 +577,27 @@ type PostSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PostSelect) Aggregate(fns ...AggregateFunc) *PostSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PostSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PostSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PostQuery, *PostSelect](ctx, ps.PostQuery, ps, ps.inters, v) + return scanWithInterceptors[*PostQuery, *PostSelect](ctx, _s.PostQuery, _s, _s.inters, v) } -func (ps *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error { +func (_s *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -605,7 +605,7 @@ func (ps *PostSelect) sqlScan(ctx context.Context, root *PostQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/rental_query.go b/entc/integration/edgefield/ent/rental_query.go index 367853af3..3ec21aad9 100644 --- a/entc/integration/edgefield/ent/rental_query.go +++ b/entc/integration/edgefield/ent/rental_query.go @@ -602,41 +602,41 @@ type RentalGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rgb *RentalGroupBy) Aggregate(fns ...AggregateFunc) *RentalGroupBy { - rgb.fns = append(rgb.fns, fns...) - return rgb +func (_g *RentalGroupBy) Aggregate(fns ...AggregateFunc) *RentalGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rgb *RentalGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rgb.build.ctx, ent.OpQueryGroupBy) - if err := rgb.build.prepareQuery(ctx); err != nil { +func (_g *RentalGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RentalQuery, *RentalGroupBy](ctx, rgb.build, rgb, rgb.build.inters, v) + return scanWithInterceptors[*RentalQuery, *RentalGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rgb *RentalGroupBy) sqlScan(ctx context.Context, root *RentalQuery, v any) error { +func (_g *RentalGroupBy) sqlScan(ctx context.Context, root *RentalQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rgb.fns)) - for _, fn := range rgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rgb.flds)+len(rgb.fns)) - for _, f := range *rgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -650,27 +650,27 @@ type RentalSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (rs *RentalSelect) Aggregate(fns ...AggregateFunc) *RentalSelect { - rs.fns = append(rs.fns, fns...) - return rs +func (_s *RentalSelect) Aggregate(fns ...AggregateFunc) *RentalSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (rs *RentalSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rs.ctx, ent.OpQuerySelect) - if err := rs.prepareQuery(ctx); err != nil { +func (_s *RentalSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RentalQuery, *RentalSelect](ctx, rs.RentalQuery, rs, rs.inters, v) + return scanWithInterceptors[*RentalQuery, *RentalSelect](ctx, _s.RentalQuery, _s, _s.inters, v) } -func (rs *RentalSelect) sqlScan(ctx context.Context, root *RentalQuery, v any) error { +func (_s *RentalSelect) sqlScan(ctx context.Context, root *RentalQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(rs.fns)) - for _, fn := range rs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*rs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -678,7 +678,7 @@ func (rs *RentalSelect) sqlScan(ctx context.Context, root *RentalQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := rs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgefield/ent/user_query.go b/entc/integration/edgefield/ent/user_query.go index 9a1c8945d..c6df60be1 100644 --- a/entc/integration/edgefield/ent/user_query.go +++ b/entc/integration/edgefield/ent/user_query.go @@ -1117,41 +1117,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1165,27 +1165,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1193,7 +1193,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/attachedfile_query.go b/entc/integration/edgeschema/ent/attachedfile_query.go index d3a805a04..b011ee1d9 100644 --- a/entc/integration/edgeschema/ent/attachedfile_query.go +++ b/entc/integration/edgeschema/ent/attachedfile_query.go @@ -601,41 +601,41 @@ type AttachedFileGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (afgb *AttachedFileGroupBy) Aggregate(fns ...AggregateFunc) *AttachedFileGroupBy { - afgb.fns = append(afgb.fns, fns...) - return afgb +func (_g *AttachedFileGroupBy) Aggregate(fns ...AggregateFunc) *AttachedFileGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (afgb *AttachedFileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, afgb.build.ctx, ent.OpQueryGroupBy) - if err := afgb.build.prepareQuery(ctx); err != nil { +func (_g *AttachedFileGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AttachedFileQuery, *AttachedFileGroupBy](ctx, afgb.build, afgb, afgb.build.inters, v) + return scanWithInterceptors[*AttachedFileQuery, *AttachedFileGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (afgb *AttachedFileGroupBy) sqlScan(ctx context.Context, root *AttachedFileQuery, v any) error { +func (_g *AttachedFileGroupBy) sqlScan(ctx context.Context, root *AttachedFileQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(afgb.fns)) - for _, fn := range afgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*afgb.flds)+len(afgb.fns)) - for _, f := range *afgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*afgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := afgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type AttachedFileSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (afs *AttachedFileSelect) Aggregate(fns ...AggregateFunc) *AttachedFileSelect { - afs.fns = append(afs.fns, fns...) - return afs +func (_s *AttachedFileSelect) Aggregate(fns ...AggregateFunc) *AttachedFileSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (afs *AttachedFileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, afs.ctx, ent.OpQuerySelect) - if err := afs.prepareQuery(ctx); err != nil { +func (_s *AttachedFileSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*AttachedFileQuery, *AttachedFileSelect](ctx, afs.AttachedFileQuery, afs, afs.inters, v) + return scanWithInterceptors[*AttachedFileQuery, *AttachedFileSelect](ctx, _s.AttachedFileQuery, _s, _s.inters, v) } -func (afs *AttachedFileSelect) sqlScan(ctx context.Context, root *AttachedFileQuery, v any) error { +func (_s *AttachedFileSelect) sqlScan(ctx context.Context, root *AttachedFileQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(afs.fns)) - for _, fn := range afs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*afs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (afs *AttachedFileSelect) sqlScan(ctx context.Context, root *AttachedFileQu } rows := &sql.Rows{} query, args := selector.Query() - if err := afs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/file_query.go b/entc/integration/edgeschema/ent/file_query.go index f0b747d09..95307a572 100644 --- a/entc/integration/edgeschema/ent/file_query.go +++ b/entc/integration/edgeschema/ent/file_query.go @@ -557,41 +557,41 @@ type FileGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FileGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_g *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -605,27 +605,27 @@ type FileSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FileSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileSelect](ctx, fs.FileQuery, fs, fs.inters, v) + return scanWithInterceptors[*FileQuery, *FileSelect](ctx, _s.FileQuery, _s, _s.inters, v) } -func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_s *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -633,7 +633,7 @@ func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/friendship_query.go b/entc/integration/edgeschema/ent/friendship_query.go index 013ff524f..f92ee6d24 100644 --- a/entc/integration/edgeschema/ent/friendship_query.go +++ b/entc/integration/edgeschema/ent/friendship_query.go @@ -600,41 +600,41 @@ type FriendshipGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FriendshipGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FriendshipGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_g *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -648,27 +648,27 @@ type FriendshipSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FriendshipSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FriendshipSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, fs.FriendshipQuery, fs, fs.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, _s.FriendshipQuery, _s, _s.inters, v) } -func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_s *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -676,7 +676,7 @@ func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/group_query.go b/entc/integration/edgeschema/ent/group_query.go index 2bfef5934..bfcc431ea 100644 --- a/entc/integration/edgeschema/ent/group_query.go +++ b/entc/integration/edgeschema/ent/group_query.go @@ -810,41 +810,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -858,27 +858,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -886,7 +886,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/grouptag_query.go b/entc/integration/edgeschema/ent/grouptag_query.go index 175b93c8b..979763a90 100644 --- a/entc/integration/edgeschema/ent/grouptag_query.go +++ b/entc/integration/edgeschema/ent/grouptag_query.go @@ -601,41 +601,41 @@ type GroupTagGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (gtgb *GroupTagGroupBy) Aggregate(fns ...AggregateFunc) *GroupTagGroupBy { - gtgb.fns = append(gtgb.fns, fns...) - return gtgb +func (_g *GroupTagGroupBy) Aggregate(fns ...AggregateFunc) *GroupTagGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (gtgb *GroupTagGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gtgb.build.ctx, ent.OpQueryGroupBy) - if err := gtgb.build.prepareQuery(ctx); err != nil { +func (_g *GroupTagGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupTagQuery, *GroupTagGroupBy](ctx, gtgb.build, gtgb, gtgb.build.inters, v) + return scanWithInterceptors[*GroupTagQuery, *GroupTagGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (gtgb *GroupTagGroupBy) sqlScan(ctx context.Context, root *GroupTagQuery, v any) error { +func (_g *GroupTagGroupBy) sqlScan(ctx context.Context, root *GroupTagQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(gtgb.fns)) - for _, fn := range gtgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*gtgb.flds)+len(gtgb.fns)) - for _, f := range *gtgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*gtgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := gtgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type GroupTagSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gts *GroupTagSelect) Aggregate(fns ...AggregateFunc) *GroupTagSelect { - gts.fns = append(gts.fns, fns...) - return gts +func (_s *GroupTagSelect) Aggregate(fns ...AggregateFunc) *GroupTagSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gts *GroupTagSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gts.ctx, ent.OpQuerySelect) - if err := gts.prepareQuery(ctx); err != nil { +func (_s *GroupTagSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupTagQuery, *GroupTagSelect](ctx, gts.GroupTagQuery, gts, gts.inters, v) + return scanWithInterceptors[*GroupTagQuery, *GroupTagSelect](ctx, _s.GroupTagQuery, _s, _s.inters, v) } -func (gts *GroupTagSelect) sqlScan(ctx context.Context, root *GroupTagQuery, v any) error { +func (_s *GroupTagSelect) sqlScan(ctx context.Context, root *GroupTagQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gts.fns)) - for _, fn := range gts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (gts *GroupTagSelect) sqlScan(ctx context.Context, root *GroupTagQuery, v a } rows := &sql.Rows{} query, args := selector.Query() - if err := gts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/process_query.go b/entc/integration/edgeschema/ent/process_query.go index 6a7ce2273..6c9dd39b8 100644 --- a/entc/integration/edgeschema/ent/process_query.go +++ b/entc/integration/edgeschema/ent/process_query.go @@ -609,41 +609,41 @@ type ProcessGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *ProcessGroupBy) Aggregate(fns ...AggregateFunc) *ProcessGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *ProcessGroupBy) Aggregate(fns ...AggregateFunc) *ProcessGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *ProcessGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *ProcessGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ProcessQuery, *ProcessGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*ProcessQuery, *ProcessGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *ProcessGroupBy) sqlScan(ctx context.Context, root *ProcessQuery, v any) error { +func (_g *ProcessGroupBy) sqlScan(ctx context.Context, root *ProcessQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -657,27 +657,27 @@ type ProcessSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *ProcessSelect) Aggregate(fns ...AggregateFunc) *ProcessSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *ProcessSelect) Aggregate(fns ...AggregateFunc) *ProcessSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *ProcessSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *ProcessSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ProcessQuery, *ProcessSelect](ctx, ps.ProcessQuery, ps, ps.inters, v) + return scanWithInterceptors[*ProcessQuery, *ProcessSelect](ctx, _s.ProcessQuery, _s, _s.inters, v) } -func (ps *ProcessSelect) sqlScan(ctx context.Context, root *ProcessQuery, v any) error { +func (_s *ProcessSelect) sqlScan(ctx context.Context, root *ProcessQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -685,7 +685,7 @@ func (ps *ProcessSelect) sqlScan(ctx context.Context, root *ProcessQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/relationship_query.go b/entc/integration/edgeschema/ent/relationship_query.go index 8643c6987..4d93e9092 100644 --- a/entc/integration/edgeschema/ent/relationship_query.go +++ b/entc/integration/edgeschema/ent/relationship_query.go @@ -604,41 +604,41 @@ type RelationshipGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rgb *RelationshipGroupBy) Aggregate(fns ...AggregateFunc) *RelationshipGroupBy { - rgb.fns = append(rgb.fns, fns...) - return rgb +func (_g *RelationshipGroupBy) Aggregate(fns ...AggregateFunc) *RelationshipGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rgb *RelationshipGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rgb.build.ctx, ent.OpQueryGroupBy) - if err := rgb.build.prepareQuery(ctx); err != nil { +func (_g *RelationshipGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RelationshipQuery, *RelationshipGroupBy](ctx, rgb.build, rgb, rgb.build.inters, v) + return scanWithInterceptors[*RelationshipQuery, *RelationshipGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rgb *RelationshipGroupBy) sqlScan(ctx context.Context, root *RelationshipQuery, v any) error { +func (_g *RelationshipGroupBy) sqlScan(ctx context.Context, root *RelationshipQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rgb.fns)) - for _, fn := range rgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rgb.flds)+len(rgb.fns)) - for _, f := range *rgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -652,27 +652,27 @@ type RelationshipSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (rs *RelationshipSelect) Aggregate(fns ...AggregateFunc) *RelationshipSelect { - rs.fns = append(rs.fns, fns...) - return rs +func (_s *RelationshipSelect) Aggregate(fns ...AggregateFunc) *RelationshipSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (rs *RelationshipSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rs.ctx, ent.OpQuerySelect) - if err := rs.prepareQuery(ctx); err != nil { +func (_s *RelationshipSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RelationshipQuery, *RelationshipSelect](ctx, rs.RelationshipQuery, rs, rs.inters, v) + return scanWithInterceptors[*RelationshipQuery, *RelationshipSelect](ctx, _s.RelationshipQuery, _s, _s.inters, v) } -func (rs *RelationshipSelect) sqlScan(ctx context.Context, root *RelationshipQuery, v any) error { +func (_s *RelationshipSelect) sqlScan(ctx context.Context, root *RelationshipQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(rs.fns)) - for _, fn := range rs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*rs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -680,7 +680,7 @@ func (rs *RelationshipSelect) sqlScan(ctx context.Context, root *RelationshipQue } rows := &sql.Rows{} query, args := selector.Query() - if err := rs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/relationshipinfo_query.go b/entc/integration/edgeschema/ent/relationshipinfo_query.go index 1cfa7e667..7d39db7f1 100644 --- a/entc/integration/edgeschema/ent/relationshipinfo_query.go +++ b/entc/integration/edgeschema/ent/relationshipinfo_query.go @@ -447,41 +447,41 @@ type RelationshipInfoGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rigb *RelationshipInfoGroupBy) Aggregate(fns ...AggregateFunc) *RelationshipInfoGroupBy { - rigb.fns = append(rigb.fns, fns...) - return rigb +func (_g *RelationshipInfoGroupBy) Aggregate(fns ...AggregateFunc) *RelationshipInfoGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rigb *RelationshipInfoGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rigb.build.ctx, ent.OpQueryGroupBy) - if err := rigb.build.prepareQuery(ctx); err != nil { +func (_g *RelationshipInfoGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RelationshipInfoQuery, *RelationshipInfoGroupBy](ctx, rigb.build, rigb, rigb.build.inters, v) + return scanWithInterceptors[*RelationshipInfoQuery, *RelationshipInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rigb *RelationshipInfoGroupBy) sqlScan(ctx context.Context, root *RelationshipInfoQuery, v any) error { +func (_g *RelationshipInfoGroupBy) sqlScan(ctx context.Context, root *RelationshipInfoQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rigb.fns)) - for _, fn := range rigb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rigb.flds)+len(rigb.fns)) - for _, f := range *rigb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rigb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rigb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type RelationshipInfoSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ris *RelationshipInfoSelect) Aggregate(fns ...AggregateFunc) *RelationshipInfoSelect { - ris.fns = append(ris.fns, fns...) - return ris +func (_s *RelationshipInfoSelect) Aggregate(fns ...AggregateFunc) *RelationshipInfoSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ris *RelationshipInfoSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ris.ctx, ent.OpQuerySelect) - if err := ris.prepareQuery(ctx); err != nil { +func (_s *RelationshipInfoSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RelationshipInfoQuery, *RelationshipInfoSelect](ctx, ris.RelationshipInfoQuery, ris, ris.inters, v) + return scanWithInterceptors[*RelationshipInfoQuery, *RelationshipInfoSelect](ctx, _s.RelationshipInfoQuery, _s, _s.inters, v) } -func (ris *RelationshipInfoSelect) sqlScan(ctx context.Context, root *RelationshipInfoQuery, v any) error { +func (_s *RelationshipInfoSelect) sqlScan(ctx context.Context, root *RelationshipInfoQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ris.fns)) - for _, fn := range ris.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ris.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (ris *RelationshipInfoSelect) sqlScan(ctx context.Context, root *Relationsh } rows := &sql.Rows{} query, args := selector.Query() - if err := ris.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/role_query.go b/entc/integration/edgeschema/ent/role_query.go index dbf69fd69..ab687a521 100644 --- a/entc/integration/edgeschema/ent/role_query.go +++ b/entc/integration/edgeschema/ent/role_query.go @@ -631,41 +631,41 @@ type RoleGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rgb *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy { - rgb.fns = append(rgb.fns, fns...) - return rgb +func (_g *RoleGroupBy) Aggregate(fns ...AggregateFunc) *RoleGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rgb *RoleGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rgb.build.ctx, ent.OpQueryGroupBy) - if err := rgb.build.prepareQuery(ctx); err != nil { +func (_g *RoleGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RoleQuery, *RoleGroupBy](ctx, rgb.build, rgb, rgb.build.inters, v) + return scanWithInterceptors[*RoleQuery, *RoleGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rgb *RoleGroupBy) sqlScan(ctx context.Context, root *RoleQuery, v any) error { +func (_g *RoleGroupBy) sqlScan(ctx context.Context, root *RoleQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rgb.fns)) - for _, fn := range rgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rgb.flds)+len(rgb.fns)) - for _, f := range *rgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -679,27 +679,27 @@ type RoleSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (rs *RoleSelect) Aggregate(fns ...AggregateFunc) *RoleSelect { - rs.fns = append(rs.fns, fns...) - return rs +func (_s *RoleSelect) Aggregate(fns ...AggregateFunc) *RoleSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (rs *RoleSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rs.ctx, ent.OpQuerySelect) - if err := rs.prepareQuery(ctx); err != nil { +func (_s *RoleSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RoleQuery, *RoleSelect](ctx, rs.RoleQuery, rs, rs.inters, v) + return scanWithInterceptors[*RoleQuery, *RoleSelect](ctx, _s.RoleQuery, _s, _s.inters, v) } -func (rs *RoleSelect) sqlScan(ctx context.Context, root *RoleQuery, v any) error { +func (_s *RoleSelect) sqlScan(ctx context.Context, root *RoleQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(rs.fns)) - for _, fn := range rs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*rs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -707,7 +707,7 @@ func (rs *RoleSelect) sqlScan(ctx context.Context, root *RoleQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := rs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/roleuser_query.go b/entc/integration/edgeschema/ent/roleuser_query.go index cec73d90b..a544dd798 100644 --- a/entc/integration/edgeschema/ent/roleuser_query.go +++ b/entc/integration/edgeschema/ent/roleuser_query.go @@ -523,41 +523,41 @@ type RoleUserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (rugb *RoleUserGroupBy) Aggregate(fns ...AggregateFunc) *RoleUserGroupBy { - rugb.fns = append(rugb.fns, fns...) - return rugb +func (_g *RoleUserGroupBy) Aggregate(fns ...AggregateFunc) *RoleUserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (rugb *RoleUserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rugb.build.ctx, ent.OpQueryGroupBy) - if err := rugb.build.prepareQuery(ctx); err != nil { +func (_g *RoleUserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RoleUserQuery, *RoleUserGroupBy](ctx, rugb.build, rugb, rugb.build.inters, v) + return scanWithInterceptors[*RoleUserQuery, *RoleUserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (rugb *RoleUserGroupBy) sqlScan(ctx context.Context, root *RoleUserQuery, v any) error { +func (_g *RoleUserGroupBy) sqlScan(ctx context.Context, root *RoleUserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(rugb.fns)) - for _, fn := range rugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*rugb.flds)+len(rugb.fns)) - for _, f := range *rugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*rugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := rugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -571,27 +571,27 @@ type RoleUserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (rus *RoleUserSelect) Aggregate(fns ...AggregateFunc) *RoleUserSelect { - rus.fns = append(rus.fns, fns...) - return rus +func (_s *RoleUserSelect) Aggregate(fns ...AggregateFunc) *RoleUserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (rus *RoleUserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rus.ctx, ent.OpQuerySelect) - if err := rus.prepareQuery(ctx); err != nil { +func (_s *RoleUserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*RoleUserQuery, *RoleUserSelect](ctx, rus.RoleUserQuery, rus, rus.inters, v) + return scanWithInterceptors[*RoleUserQuery, *RoleUserSelect](ctx, _s.RoleUserQuery, _s, _s.inters, v) } -func (rus *RoleUserSelect) sqlScan(ctx context.Context, root *RoleUserQuery, v any) error { +func (_s *RoleUserSelect) sqlScan(ctx context.Context, root *RoleUserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(rus.fns)) - for _, fn := range rus.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*rus.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -599,7 +599,7 @@ func (rus *RoleUserSelect) sqlScan(ctx context.Context, root *RoleUserQuery, v a } rows := &sql.Rows{} query, args := selector.Query() - if err := rus.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/tag_query.go b/entc/integration/edgeschema/ent/tag_query.go index 0cb55744b..c9f768407 100644 --- a/entc/integration/edgeschema/ent/tag_query.go +++ b/entc/integration/edgeschema/ent/tag_query.go @@ -810,41 +810,41 @@ type TagGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TagGroupBy) Aggregate(fns ...AggregateFunc) *TagGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TagGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TagGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TagQuery, *TagGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TagQuery, *TagGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TagGroupBy) sqlScan(ctx context.Context, root *TagQuery, v any) error { +func (_g *TagGroupBy) sqlScan(ctx context.Context, root *TagQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -858,27 +858,27 @@ type TagSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TagSelect) Aggregate(fns ...AggregateFunc) *TagSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TagSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TagSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TagQuery, *TagSelect](ctx, ts.TagQuery, ts, ts.inters, v) + return scanWithInterceptors[*TagQuery, *TagSelect](ctx, _s.TagQuery, _s, _s.inters, v) } -func (ts *TagSelect) sqlScan(ctx context.Context, root *TagQuery, v any) error { +func (_s *TagSelect) sqlScan(ctx context.Context, root *TagQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -886,7 +886,7 @@ func (ts *TagSelect) sqlScan(ctx context.Context, root *TagQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/tweet_query.go b/entc/integration/edgeschema/ent/tweet_query.go index 9c81591ac..df23955db 100644 --- a/entc/integration/edgeschema/ent/tweet_query.go +++ b/entc/integration/edgeschema/ent/tweet_query.go @@ -988,41 +988,41 @@ type TweetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TweetGroupBy) Aggregate(fns ...AggregateFunc) *TweetGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TweetGroupBy) Aggregate(fns ...AggregateFunc) *TweetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TweetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TweetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetQuery, *TweetGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TweetQuery, *TweetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TweetGroupBy) sqlScan(ctx context.Context, root *TweetQuery, v any) error { +func (_g *TweetGroupBy) sqlScan(ctx context.Context, root *TweetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1036,27 +1036,27 @@ type TweetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TweetSelect) Aggregate(fns ...AggregateFunc) *TweetSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TweetSelect) Aggregate(fns ...AggregateFunc) *TweetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TweetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TweetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetQuery, *TweetSelect](ctx, ts.TweetQuery, ts, ts.inters, v) + return scanWithInterceptors[*TweetQuery, *TweetSelect](ctx, _s.TweetQuery, _s, _s.inters, v) } -func (ts *TweetSelect) sqlScan(ctx context.Context, root *TweetQuery, v any) error { +func (_s *TweetSelect) sqlScan(ctx context.Context, root *TweetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1064,7 +1064,7 @@ func (ts *TweetSelect) sqlScan(ctx context.Context, root *TweetQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/tweetlike_query.go b/entc/integration/edgeschema/ent/tweetlike_query.go index 446c65585..2316b7c10 100644 --- a/entc/integration/edgeschema/ent/tweetlike_query.go +++ b/entc/integration/edgeschema/ent/tweetlike_query.go @@ -530,41 +530,41 @@ type TweetLikeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tlgb *TweetLikeGroupBy) Aggregate(fns ...AggregateFunc) *TweetLikeGroupBy { - tlgb.fns = append(tlgb.fns, fns...) - return tlgb +func (_g *TweetLikeGroupBy) Aggregate(fns ...AggregateFunc) *TweetLikeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tlgb *TweetLikeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tlgb.build.ctx, ent.OpQueryGroupBy) - if err := tlgb.build.prepareQuery(ctx); err != nil { +func (_g *TweetLikeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetLikeQuery, *TweetLikeGroupBy](ctx, tlgb.build, tlgb, tlgb.build.inters, v) + return scanWithInterceptors[*TweetLikeQuery, *TweetLikeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tlgb *TweetLikeGroupBy) sqlScan(ctx context.Context, root *TweetLikeQuery, v any) error { +func (_g *TweetLikeGroupBy) sqlScan(ctx context.Context, root *TweetLikeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tlgb.fns)) - for _, fn := range tlgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tlgb.flds)+len(tlgb.fns)) - for _, f := range *tlgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tlgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tlgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -578,27 +578,27 @@ type TweetLikeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (tls *TweetLikeSelect) Aggregate(fns ...AggregateFunc) *TweetLikeSelect { - tls.fns = append(tls.fns, fns...) - return tls +func (_s *TweetLikeSelect) Aggregate(fns ...AggregateFunc) *TweetLikeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (tls *TweetLikeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tls.ctx, ent.OpQuerySelect) - if err := tls.prepareQuery(ctx); err != nil { +func (_s *TweetLikeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetLikeQuery, *TweetLikeSelect](ctx, tls.TweetLikeQuery, tls, tls.inters, v) + return scanWithInterceptors[*TweetLikeQuery, *TweetLikeSelect](ctx, _s.TweetLikeQuery, _s, _s.inters, v) } -func (tls *TweetLikeSelect) sqlScan(ctx context.Context, root *TweetLikeQuery, v any) error { +func (_s *TweetLikeSelect) sqlScan(ctx context.Context, root *TweetLikeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(tls.fns)) - for _, fn := range tls.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*tls.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -606,7 +606,7 @@ func (tls *TweetLikeSelect) sqlScan(ctx context.Context, root *TweetLikeQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := tls.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/tweettag_query.go b/entc/integration/edgeschema/ent/tweettag_query.go index c57208351..1d6acef97 100644 --- a/entc/integration/edgeschema/ent/tweettag_query.go +++ b/entc/integration/edgeschema/ent/tweettag_query.go @@ -602,41 +602,41 @@ type TweetTagGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ttgb *TweetTagGroupBy) Aggregate(fns ...AggregateFunc) *TweetTagGroupBy { - ttgb.fns = append(ttgb.fns, fns...) - return ttgb +func (_g *TweetTagGroupBy) Aggregate(fns ...AggregateFunc) *TweetTagGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ttgb *TweetTagGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ttgb.build.ctx, ent.OpQueryGroupBy) - if err := ttgb.build.prepareQuery(ctx); err != nil { +func (_g *TweetTagGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetTagQuery, *TweetTagGroupBy](ctx, ttgb.build, ttgb, ttgb.build.inters, v) + return scanWithInterceptors[*TweetTagQuery, *TweetTagGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ttgb *TweetTagGroupBy) sqlScan(ctx context.Context, root *TweetTagQuery, v any) error { +func (_g *TweetTagGroupBy) sqlScan(ctx context.Context, root *TweetTagQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ttgb.fns)) - for _, fn := range ttgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ttgb.flds)+len(ttgb.fns)) - for _, f := range *ttgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ttgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ttgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -650,27 +650,27 @@ type TweetTagSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (tts *TweetTagSelect) Aggregate(fns ...AggregateFunc) *TweetTagSelect { - tts.fns = append(tts.fns, fns...) - return tts +func (_s *TweetTagSelect) Aggregate(fns ...AggregateFunc) *TweetTagSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (tts *TweetTagSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tts.ctx, ent.OpQuerySelect) - if err := tts.prepareQuery(ctx); err != nil { +func (_s *TweetTagSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TweetTagQuery, *TweetTagSelect](ctx, tts.TweetTagQuery, tts, tts.inters, v) + return scanWithInterceptors[*TweetTagQuery, *TweetTagSelect](ctx, _s.TweetTagQuery, _s, _s.inters, v) } -func (tts *TweetTagSelect) sqlScan(ctx context.Context, root *TweetTagQuery, v any) error { +func (_s *TweetTagSelect) sqlScan(ctx context.Context, root *TweetTagQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(tts.fns)) - for _, fn := range tts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*tts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -678,7 +678,7 @@ func (tts *TweetTagSelect) sqlScan(ctx context.Context, root *TweetTagQuery, v a } rows := &sql.Rows{} query, args := selector.Query() - if err := tts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/user_query.go b/entc/integration/edgeschema/ent/user_query.go index 7360b626a..433fb1513 100644 --- a/entc/integration/edgeschema/ent/user_query.go +++ b/entc/integration/edgeschema/ent/user_query.go @@ -1530,41 +1530,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1578,27 +1578,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1606,7 +1606,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/usergroup_query.go b/entc/integration/edgeschema/ent/usergroup_query.go index 57a569898..2ad0eba27 100644 --- a/entc/integration/edgeschema/ent/usergroup_query.go +++ b/entc/integration/edgeschema/ent/usergroup_query.go @@ -601,41 +601,41 @@ type UserGroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (uggb *UserGroupGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupGroupBy { - uggb.fns = append(uggb.fns, fns...) - return uggb +func (_g *UserGroupGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (uggb *UserGroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, uggb.build.ctx, ent.OpQueryGroupBy) - if err := uggb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserGroupQuery, *UserGroupGroupBy](ctx, uggb.build, uggb, uggb.build.inters, v) + return scanWithInterceptors[*UserGroupQuery, *UserGroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (uggb *UserGroupGroupBy) sqlScan(ctx context.Context, root *UserGroupQuery, v any) error { +func (_g *UserGroupGroupBy) sqlScan(ctx context.Context, root *UserGroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(uggb.fns)) - for _, fn := range uggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*uggb.flds)+len(uggb.fns)) - for _, f := range *uggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*uggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := uggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type UserGroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ugs *UserGroupSelect) Aggregate(fns ...AggregateFunc) *UserGroupSelect { - ugs.fns = append(ugs.fns, fns...) - return ugs +func (_s *UserGroupSelect) Aggregate(fns ...AggregateFunc) *UserGroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ugs *UserGroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugs.ctx, ent.OpQuerySelect) - if err := ugs.prepareQuery(ctx); err != nil { +func (_s *UserGroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserGroupQuery, *UserGroupSelect](ctx, ugs.UserGroupQuery, ugs, ugs.inters, v) + return scanWithInterceptors[*UserGroupQuery, *UserGroupSelect](ctx, _s.UserGroupQuery, _s, _s.inters, v) } -func (ugs *UserGroupSelect) sqlScan(ctx context.Context, root *UserGroupQuery, v any) error { +func (_s *UserGroupSelect) sqlScan(ctx context.Context, root *UserGroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ugs.fns)) - for _, fn := range ugs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ugs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (ugs *UserGroupSelect) sqlScan(ctx context.Context, root *UserGroupQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := ugs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/edgeschema/ent/usertweet_query.go b/entc/integration/edgeschema/ent/usertweet_query.go index 388f2646b..60e8d5309 100644 --- a/entc/integration/edgeschema/ent/usertweet_query.go +++ b/entc/integration/edgeschema/ent/usertweet_query.go @@ -601,41 +601,41 @@ type UserTweetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (utgb *UserTweetGroupBy) Aggregate(fns ...AggregateFunc) *UserTweetGroupBy { - utgb.fns = append(utgb.fns, fns...) - return utgb +func (_g *UserTweetGroupBy) Aggregate(fns ...AggregateFunc) *UserTweetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (utgb *UserTweetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, utgb.build.ctx, ent.OpQueryGroupBy) - if err := utgb.build.prepareQuery(ctx); err != nil { +func (_g *UserTweetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserTweetQuery, *UserTweetGroupBy](ctx, utgb.build, utgb, utgb.build.inters, v) + return scanWithInterceptors[*UserTweetQuery, *UserTweetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (utgb *UserTweetGroupBy) sqlScan(ctx context.Context, root *UserTweetQuery, v any) error { +func (_g *UserTweetGroupBy) sqlScan(ctx context.Context, root *UserTweetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(utgb.fns)) - for _, fn := range utgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*utgb.flds)+len(utgb.fns)) - for _, f := range *utgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*utgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := utgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type UserTweetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (uts *UserTweetSelect) Aggregate(fns ...AggregateFunc) *UserTweetSelect { - uts.fns = append(uts.fns, fns...) - return uts +func (_s *UserTweetSelect) Aggregate(fns ...AggregateFunc) *UserTweetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (uts *UserTweetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, uts.ctx, ent.OpQuerySelect) - if err := uts.prepareQuery(ctx); err != nil { +func (_s *UserTweetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserTweetQuery, *UserTweetSelect](ctx, uts.UserTweetQuery, uts, uts.inters, v) + return scanWithInterceptors[*UserTweetQuery, *UserTweetSelect](ctx, _s.UserTweetQuery, _s, _s.inters, v) } -func (uts *UserTweetSelect) sqlScan(ctx context.Context, root *UserTweetQuery, v any) error { +func (_s *UserTweetSelect) sqlScan(ctx context.Context, root *UserTweetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(uts.fns)) - for _, fn := range uts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*uts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (uts *UserTweetSelect) sqlScan(ctx context.Context, root *UserTweetQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := uts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/ent/api_query.go b/entc/integration/ent/api_query.go index 2e9a40043..78aa8e9aa 100644 --- a/entc/integration/ent/api_query.go +++ b/entc/integration/ent/api_query.go @@ -469,41 +469,41 @@ type APIGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (agb *APIGroupBy) Aggregate(fns ...AggregateFunc) *APIGroupBy { - agb.fns = append(agb.fns, fns...) - return agb +func (_g *APIGroupBy) Aggregate(fns ...AggregateFunc) *APIGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (agb *APIGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy) - if err := agb.build.prepareQuery(ctx); err != nil { +func (_g *APIGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*APIQuery, *APIGroupBy](ctx, agb.build, agb, agb.build.inters, v) + return scanWithInterceptors[*APIQuery, *APIGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (agb *APIGroupBy) sqlScan(ctx context.Context, root *APIQuery, v any) error { +func (_g *APIGroupBy) sqlScan(ctx context.Context, root *APIQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(agb.fns)) - for _, fn := range agb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*agb.flds)+len(agb.fns)) - for _, f := range *agb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*agb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := agb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -517,27 +517,27 @@ type APISelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (as *APISelect) Aggregate(fns ...AggregateFunc) *APISelect { - as.fns = append(as.fns, fns...) - return as +func (_s *APISelect) Aggregate(fns ...AggregateFunc) *APISelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (as *APISelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect) - if err := as.prepareQuery(ctx); err != nil { +func (_s *APISelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*APIQuery, *APISelect](ctx, as.APIQuery, as, as.inters, v) + return scanWithInterceptors[*APIQuery, *APISelect](ctx, _s.APIQuery, _s, _s.inters, v) } -func (as *APISelect) sqlScan(ctx context.Context, root *APIQuery, v any) error { +func (_s *APISelect) sqlScan(ctx context.Context, root *APIQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(as.fns)) - for _, fn := range as.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*as.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -545,7 +545,7 @@ func (as *APISelect) sqlScan(ctx context.Context, root *APIQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := as.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -553,7 +553,7 @@ func (as *APISelect) sqlScan(ctx context.Context, root *APIQuery, v any) error { } // Modify adds a query modifier for attaching custom logic to queries. -func (as *APISelect) Modify(modifiers ...func(s *sql.Selector)) *APISelect { - as.modifiers = append(as.modifiers, modifiers...) - return as +func (_s *APISelect) Modify(modifiers ...func(s *sql.Selector)) *APISelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/builder_query.go b/entc/integration/ent/builder_query.go index 1824a9898..e79762381 100644 --- a/entc/integration/ent/builder_query.go +++ b/entc/integration/ent/builder_query.go @@ -469,41 +469,41 @@ type BuilderGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (bgb *BuilderGroupBy) Aggregate(fns ...AggregateFunc) *BuilderGroupBy { - bgb.fns = append(bgb.fns, fns...) - return bgb +func (_g *BuilderGroupBy) Aggregate(fns ...AggregateFunc) *BuilderGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (bgb *BuilderGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) - if err := bgb.build.prepareQuery(ctx); err != nil { +func (_g *BuilderGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BuilderQuery, *BuilderGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) + return scanWithInterceptors[*BuilderQuery, *BuilderGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (bgb *BuilderGroupBy) sqlScan(ctx context.Context, root *BuilderQuery, v any) error { +func (_g *BuilderGroupBy) sqlScan(ctx context.Context, root *BuilderQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(bgb.fns)) - for _, fn := range bgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns)) - for _, f := range *bgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*bgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -517,27 +517,27 @@ type BuilderSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bs *BuilderSelect) Aggregate(fns ...AggregateFunc) *BuilderSelect { - bs.fns = append(bs.fns, fns...) - return bs +func (_s *BuilderSelect) Aggregate(fns ...AggregateFunc) *BuilderSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bs *BuilderSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) - if err := bs.prepareQuery(ctx); err != nil { +func (_s *BuilderSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BuilderQuery, *BuilderSelect](ctx, bs.BuilderQuery, bs, bs.inters, v) + return scanWithInterceptors[*BuilderQuery, *BuilderSelect](ctx, _s.BuilderQuery, _s, _s.inters, v) } -func (bs *BuilderSelect) sqlScan(ctx context.Context, root *BuilderQuery, v any) error { +func (_s *BuilderSelect) sqlScan(ctx context.Context, root *BuilderQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(bs.fns)) - for _, fn := range bs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*bs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -545,7 +545,7 @@ func (bs *BuilderSelect) sqlScan(ctx context.Context, root *BuilderQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := bs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -553,7 +553,7 @@ func (bs *BuilderSelect) sqlScan(ctx context.Context, root *BuilderQuery, v any) } // Modify adds a query modifier for attaching custom logic to queries. -func (bs *BuilderSelect) Modify(modifiers ...func(s *sql.Selector)) *BuilderSelect { - bs.modifiers = append(bs.modifiers, modifiers...) - return bs +func (_s *BuilderSelect) Modify(modifiers ...func(s *sql.Selector)) *BuilderSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/card_query.go b/entc/integration/ent/card_query.go index 94945be1a..9b8f319b1 100644 --- a/entc/integration/ent/card_query.go +++ b/entc/integration/ent/card_query.go @@ -711,41 +711,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -759,27 +759,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -787,7 +787,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -795,7 +795,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (cs *CardSelect) Modify(modifiers ...func(s *sql.Selector)) *CardSelect { - cs.modifiers = append(cs.modifiers, modifiers...) - return cs +func (_s *CardSelect) Modify(modifiers ...func(s *sql.Selector)) *CardSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/comment_query.go b/entc/integration/ent/comment_query.go index 70be839f1..a8e5165de 100644 --- a/entc/integration/ent/comment_query.go +++ b/entc/integration/ent/comment_query.go @@ -491,41 +491,41 @@ type CommentGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CommentGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CommentGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CommentGroupBy) sqlScan(ctx context.Context, root *CommentQuery, v any) error { +func (_g *CommentGroupBy) sqlScan(ctx context.Context, root *CommentQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -539,27 +539,27 @@ type CommentSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CommentSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CommentSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, cs.CommentQuery, cs, cs.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, _s.CommentQuery, _s, _s.inters, v) } -func (cs *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) error { +func (_s *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -567,7 +567,7 @@ func (cs *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,7 +575,7 @@ func (cs *CommentSelect) sqlScan(ctx context.Context, root *CommentQuery, v any) } // Modify adds a query modifier for attaching custom logic to queries. -func (cs *CommentSelect) Modify(modifiers ...func(s *sql.Selector)) *CommentSelect { - cs.modifiers = append(cs.modifiers, modifiers...) - return cs +func (_s *CommentSelect) Modify(modifiers ...func(s *sql.Selector)) *CommentSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/exvaluescan_query.go b/entc/integration/ent/exvaluescan_query.go index 137c19b3b..76d343604 100644 --- a/entc/integration/ent/exvaluescan_query.go +++ b/entc/integration/ent/exvaluescan_query.go @@ -491,41 +491,41 @@ type ExValueScanGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (evsgb *ExValueScanGroupBy) Aggregate(fns ...AggregateFunc) *ExValueScanGroupBy { - evsgb.fns = append(evsgb.fns, fns...) - return evsgb +func (_g *ExValueScanGroupBy) Aggregate(fns ...AggregateFunc) *ExValueScanGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (evsgb *ExValueScanGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, evsgb.build.ctx, ent.OpQueryGroupBy) - if err := evsgb.build.prepareQuery(ctx); err != nil { +func (_g *ExValueScanGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ExValueScanQuery, *ExValueScanGroupBy](ctx, evsgb.build, evsgb, evsgb.build.inters, v) + return scanWithInterceptors[*ExValueScanQuery, *ExValueScanGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (evsgb *ExValueScanGroupBy) sqlScan(ctx context.Context, root *ExValueScanQuery, v any) error { +func (_g *ExValueScanGroupBy) sqlScan(ctx context.Context, root *ExValueScanQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(evsgb.fns)) - for _, fn := range evsgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*evsgb.flds)+len(evsgb.fns)) - for _, f := range *evsgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*evsgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := evsgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -539,27 +539,27 @@ type ExValueScanSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (evss *ExValueScanSelect) Aggregate(fns ...AggregateFunc) *ExValueScanSelect { - evss.fns = append(evss.fns, fns...) - return evss +func (_s *ExValueScanSelect) Aggregate(fns ...AggregateFunc) *ExValueScanSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (evss *ExValueScanSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, evss.ctx, ent.OpQuerySelect) - if err := evss.prepareQuery(ctx); err != nil { +func (_s *ExValueScanSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ExValueScanQuery, *ExValueScanSelect](ctx, evss.ExValueScanQuery, evss, evss.inters, v) + return scanWithInterceptors[*ExValueScanQuery, *ExValueScanSelect](ctx, _s.ExValueScanQuery, _s, _s.inters, v) } -func (evss *ExValueScanSelect) sqlScan(ctx context.Context, root *ExValueScanQuery, v any) error { +func (_s *ExValueScanSelect) sqlScan(ctx context.Context, root *ExValueScanQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(evss.fns)) - for _, fn := range evss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*evss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -567,7 +567,7 @@ func (evss *ExValueScanSelect) sqlScan(ctx context.Context, root *ExValueScanQue } rows := &sql.Rows{} query, args := selector.Query() - if err := evss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,7 +575,7 @@ func (evss *ExValueScanSelect) sqlScan(ctx context.Context, root *ExValueScanQue } // Modify adds a query modifier for attaching custom logic to queries. -func (evss *ExValueScanSelect) Modify(modifiers ...func(s *sql.Selector)) *ExValueScanSelect { - evss.modifiers = append(evss.modifiers, modifiers...) - return evss +func (_s *ExValueScanSelect) Modify(modifiers ...func(s *sql.Selector)) *ExValueScanSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/fieldtype_query.go b/entc/integration/ent/fieldtype_query.go index 82b269fc9..639514fac 100644 --- a/entc/integration/ent/fieldtype_query.go +++ b/entc/integration/ent/fieldtype_query.go @@ -496,41 +496,41 @@ type FieldTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ftgb *FieldTypeGroupBy) Aggregate(fns ...AggregateFunc) *FieldTypeGroupBy { - ftgb.fns = append(ftgb.fns, fns...) - return ftgb +func (_g *FieldTypeGroupBy) Aggregate(fns ...AggregateFunc) *FieldTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ftgb *FieldTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ftgb.build.ctx, ent.OpQueryGroupBy) - if err := ftgb.build.prepareQuery(ctx); err != nil { +func (_g *FieldTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FieldTypeQuery, *FieldTypeGroupBy](ctx, ftgb.build, ftgb, ftgb.build.inters, v) + return scanWithInterceptors[*FieldTypeQuery, *FieldTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ftgb *FieldTypeGroupBy) sqlScan(ctx context.Context, root *FieldTypeQuery, v any) error { +func (_g *FieldTypeGroupBy) sqlScan(ctx context.Context, root *FieldTypeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ftgb.fns)) - for _, fn := range ftgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ftgb.flds)+len(ftgb.fns)) - for _, f := range *ftgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ftgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ftgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -544,27 +544,27 @@ type FieldTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fts *FieldTypeSelect) Aggregate(fns ...AggregateFunc) *FieldTypeSelect { - fts.fns = append(fts.fns, fns...) - return fts +func (_s *FieldTypeSelect) Aggregate(fns ...AggregateFunc) *FieldTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fts *FieldTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fts.ctx, ent.OpQuerySelect) - if err := fts.prepareQuery(ctx); err != nil { +func (_s *FieldTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FieldTypeQuery, *FieldTypeSelect](ctx, fts.FieldTypeQuery, fts, fts.inters, v) + return scanWithInterceptors[*FieldTypeQuery, *FieldTypeSelect](ctx, _s.FieldTypeQuery, _s, _s.inters, v) } -func (fts *FieldTypeSelect) sqlScan(ctx context.Context, root *FieldTypeQuery, v any) error { +func (_s *FieldTypeSelect) sqlScan(ctx context.Context, root *FieldTypeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fts.fns)) - for _, fn := range fts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -572,7 +572,7 @@ func (fts *FieldTypeSelect) sqlScan(ctx context.Context, root *FieldTypeQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := fts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -580,7 +580,7 @@ func (fts *FieldTypeSelect) sqlScan(ctx context.Context, root *FieldTypeQuery, v } // Modify adds a query modifier for attaching custom logic to queries. -func (fts *FieldTypeSelect) Modify(modifiers ...func(s *sql.Selector)) *FieldTypeSelect { - fts.modifiers = append(fts.modifiers, modifiers...) - return fts +func (_s *FieldTypeSelect) Modify(modifiers ...func(s *sql.Selector)) *FieldTypeSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/file_query.go b/entc/integration/ent/file_query.go index 578a02583..e5769c49b 100644 --- a/entc/integration/ent/file_query.go +++ b/entc/integration/ent/file_query.go @@ -751,41 +751,41 @@ type FileGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FileGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_g *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -799,27 +799,27 @@ type FileSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FileSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileSelect](ctx, fs.FileQuery, fs, fs.inters, v) + return scanWithInterceptors[*FileQuery, *FileSelect](ctx, _s.FileQuery, _s, _s.inters, v) } -func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_s *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -827,7 +827,7 @@ func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -835,7 +835,7 @@ func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (fs *FileSelect) Modify(modifiers ...func(s *sql.Selector)) *FileSelect { - fs.modifiers = append(fs.modifiers, modifiers...) - return fs +func (_s *FileSelect) Modify(modifiers ...func(s *sql.Selector)) *FileSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/filetype_query.go b/entc/integration/ent/filetype_query.go index 8e70ec5ae..f03514db3 100644 --- a/entc/integration/ent/filetype_query.go +++ b/entc/integration/ent/filetype_query.go @@ -603,41 +603,41 @@ type FileTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ftgb *FileTypeGroupBy) Aggregate(fns ...AggregateFunc) *FileTypeGroupBy { - ftgb.fns = append(ftgb.fns, fns...) - return ftgb +func (_g *FileTypeGroupBy) Aggregate(fns ...AggregateFunc) *FileTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ftgb *FileTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ftgb.build.ctx, ent.OpQueryGroupBy) - if err := ftgb.build.prepareQuery(ctx); err != nil { +func (_g *FileTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileTypeQuery, *FileTypeGroupBy](ctx, ftgb.build, ftgb, ftgb.build.inters, v) + return scanWithInterceptors[*FileTypeQuery, *FileTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ftgb *FileTypeGroupBy) sqlScan(ctx context.Context, root *FileTypeQuery, v any) error { +func (_g *FileTypeGroupBy) sqlScan(ctx context.Context, root *FileTypeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ftgb.fns)) - for _, fn := range ftgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ftgb.flds)+len(ftgb.fns)) - for _, f := range *ftgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ftgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ftgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -651,27 +651,27 @@ type FileTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fts *FileTypeSelect) Aggregate(fns ...AggregateFunc) *FileTypeSelect { - fts.fns = append(fts.fns, fns...) - return fts +func (_s *FileTypeSelect) Aggregate(fns ...AggregateFunc) *FileTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fts *FileTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fts.ctx, ent.OpQuerySelect) - if err := fts.prepareQuery(ctx); err != nil { +func (_s *FileTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileTypeQuery, *FileTypeSelect](ctx, fts.FileTypeQuery, fts, fts.inters, v) + return scanWithInterceptors[*FileTypeQuery, *FileTypeSelect](ctx, _s.FileTypeQuery, _s, _s.inters, v) } -func (fts *FileTypeSelect) sqlScan(ctx context.Context, root *FileTypeQuery, v any) error { +func (_s *FileTypeSelect) sqlScan(ctx context.Context, root *FileTypeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fts.fns)) - for _, fn := range fts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -679,7 +679,7 @@ func (fts *FileTypeSelect) sqlScan(ctx context.Context, root *FileTypeQuery, v a } rows := &sql.Rows{} query, args := selector.Query() - if err := fts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,7 +687,7 @@ func (fts *FileTypeSelect) sqlScan(ctx context.Context, root *FileTypeQuery, v a } // Modify adds a query modifier for attaching custom logic to queries. -func (fts *FileTypeSelect) Modify(modifiers ...func(s *sql.Selector)) *FileTypeSelect { - fts.modifiers = append(fts.modifiers, modifiers...) - return fts +func (_s *FileTypeSelect) Modify(modifiers ...func(s *sql.Selector)) *FileTypeSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/goods_query.go b/entc/integration/ent/goods_query.go index 31a78c1ad..87a19f788 100644 --- a/entc/integration/ent/goods_query.go +++ b/entc/integration/ent/goods_query.go @@ -469,41 +469,41 @@ type GoodsGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GoodsGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GoodsGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GoodsQuery, *GoodsGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GoodsQuery, *GoodsGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GoodsGroupBy) sqlScan(ctx context.Context, root *GoodsQuery, v any) error { +func (_g *GoodsGroupBy) sqlScan(ctx context.Context, root *GoodsQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -517,27 +517,27 @@ type GoodsSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GoodsSelect) Aggregate(fns ...AggregateFunc) *GoodsSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GoodsSelect) Aggregate(fns ...AggregateFunc) *GoodsSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GoodsSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GoodsSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GoodsQuery, *GoodsSelect](ctx, gs.GoodsQuery, gs, gs.inters, v) + return scanWithInterceptors[*GoodsQuery, *GoodsSelect](ctx, _s.GoodsQuery, _s, _s.inters, v) } -func (gs *GoodsSelect) sqlScan(ctx context.Context, root *GoodsQuery, v any) error { +func (_s *GoodsSelect) sqlScan(ctx context.Context, root *GoodsQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -545,7 +545,7 @@ func (gs *GoodsSelect) sqlScan(ctx context.Context, root *GoodsQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -553,7 +553,7 @@ func (gs *GoodsSelect) sqlScan(ctx context.Context, root *GoodsQuery, v any) err } // Modify adds a query modifier for attaching custom logic to queries. -func (gs *GoodsSelect) Modify(modifiers ...func(s *sql.Selector)) *GoodsSelect { - gs.modifiers = append(gs.modifiers, modifiers...) - return gs +func (_s *GoodsSelect) Modify(modifiers ...func(s *sql.Selector)) *GoodsSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/group_query.go b/entc/integration/ent/group_query.go index ef0def7ec..295755d48 100644 --- a/entc/integration/ent/group_query.go +++ b/entc/integration/ent/group_query.go @@ -899,41 +899,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -947,27 +947,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -975,7 +975,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -983,7 +983,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } // Modify adds a query modifier for attaching custom logic to queries. -func (gs *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { - gs.modifiers = append(gs.modifiers, modifiers...) - return gs +func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/groupinfo_query.go b/entc/integration/ent/groupinfo_query.go index dca3c1219..67c4fc0ff 100644 --- a/entc/integration/ent/groupinfo_query.go +++ b/entc/integration/ent/groupinfo_query.go @@ -603,41 +603,41 @@ type GroupInfoGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (gigb *GroupInfoGroupBy) Aggregate(fns ...AggregateFunc) *GroupInfoGroupBy { - gigb.fns = append(gigb.fns, fns...) - return gigb +func (_g *GroupInfoGroupBy) Aggregate(fns ...AggregateFunc) *GroupInfoGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (gigb *GroupInfoGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gigb.build.ctx, ent.OpQueryGroupBy) - if err := gigb.build.prepareQuery(ctx); err != nil { +func (_g *GroupInfoGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupInfoQuery, *GroupInfoGroupBy](ctx, gigb.build, gigb, gigb.build.inters, v) + return scanWithInterceptors[*GroupInfoQuery, *GroupInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (gigb *GroupInfoGroupBy) sqlScan(ctx context.Context, root *GroupInfoQuery, v any) error { +func (_g *GroupInfoGroupBy) sqlScan(ctx context.Context, root *GroupInfoQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(gigb.fns)) - for _, fn := range gigb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*gigb.flds)+len(gigb.fns)) - for _, f := range *gigb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*gigb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := gigb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -651,27 +651,27 @@ type GroupInfoSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gis *GroupInfoSelect) Aggregate(fns ...AggregateFunc) *GroupInfoSelect { - gis.fns = append(gis.fns, fns...) - return gis +func (_s *GroupInfoSelect) Aggregate(fns ...AggregateFunc) *GroupInfoSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gis *GroupInfoSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gis.ctx, ent.OpQuerySelect) - if err := gis.prepareQuery(ctx); err != nil { +func (_s *GroupInfoSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupInfoQuery, *GroupInfoSelect](ctx, gis.GroupInfoQuery, gis, gis.inters, v) + return scanWithInterceptors[*GroupInfoQuery, *GroupInfoSelect](ctx, _s.GroupInfoQuery, _s, _s.inters, v) } -func (gis *GroupInfoSelect) sqlScan(ctx context.Context, root *GroupInfoQuery, v any) error { +func (_s *GroupInfoSelect) sqlScan(ctx context.Context, root *GroupInfoQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gis.fns)) - for _, fn := range gis.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gis.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -679,7 +679,7 @@ func (gis *GroupInfoSelect) sqlScan(ctx context.Context, root *GroupInfoQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := gis.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,7 +687,7 @@ func (gis *GroupInfoSelect) sqlScan(ctx context.Context, root *GroupInfoQuery, v } // Modify adds a query modifier for attaching custom logic to queries. -func (gis *GroupInfoSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupInfoSelect { - gis.modifiers = append(gis.modifiers, modifiers...) - return gis +func (_s *GroupInfoSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupInfoSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/item_query.go b/entc/integration/ent/item_query.go index 8147844f2..03672184f 100644 --- a/entc/integration/ent/item_query.go +++ b/entc/integration/ent/item_query.go @@ -491,41 +491,41 @@ type ItemGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy { - igb.fns = append(igb.fns, fns...) - return igb +func (_g *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (igb *ItemGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, igb.build.ctx, ent.OpQueryGroupBy) - if err := igb.build.prepareQuery(ctx); err != nil { +func (_g *ItemGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, igb.build, igb, igb.build.inters, v) + return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (igb *ItemGroupBy) sqlScan(ctx context.Context, root *ItemQuery, v any) error { +func (_g *ItemGroupBy) sqlScan(ctx context.Context, root *ItemQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(igb.fns)) - for _, fn := range igb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*igb.flds)+len(igb.fns)) - for _, f := range *igb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*igb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := igb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -539,27 +539,27 @@ type ItemSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (is *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect { - is.fns = append(is.fns, fns...) - return is +func (_s *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (is *ItemSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, is.ctx, ent.OpQuerySelect) - if err := is.prepareQuery(ctx); err != nil { +func (_s *ItemSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, is.ItemQuery, is, is.inters, v) + return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, _s.ItemQuery, _s, _s.inters, v) } -func (is *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error { +func (_s *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(is.fns)) - for _, fn := range is.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*is.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -567,7 +567,7 @@ func (is *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := is.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,7 +575,7 @@ func (is *ItemSelect) sqlScan(ctx context.Context, root *ItemQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (is *ItemSelect) Modify(modifiers ...func(s *sql.Selector)) *ItemSelect { - is.modifiers = append(is.modifiers, modifiers...) - return is +func (_s *ItemSelect) Modify(modifiers ...func(s *sql.Selector)) *ItemSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/license_query.go b/entc/integration/ent/license_query.go index 7898f59d6..60c538a43 100644 --- a/entc/integration/ent/license_query.go +++ b/entc/integration/ent/license_query.go @@ -491,41 +491,41 @@ type LicenseGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (lgb *LicenseGroupBy) Aggregate(fns ...AggregateFunc) *LicenseGroupBy { - lgb.fns = append(lgb.fns, fns...) - return lgb +func (_g *LicenseGroupBy) Aggregate(fns ...AggregateFunc) *LicenseGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (lgb *LicenseGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy) - if err := lgb.build.prepareQuery(ctx); err != nil { +func (_g *LicenseGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LicenseQuery, *LicenseGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v) + return scanWithInterceptors[*LicenseQuery, *LicenseGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (lgb *LicenseGroupBy) sqlScan(ctx context.Context, root *LicenseQuery, v any) error { +func (_g *LicenseGroupBy) sqlScan(ctx context.Context, root *LicenseQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(lgb.fns)) - for _, fn := range lgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*lgb.flds)+len(lgb.fns)) - for _, f := range *lgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*lgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := lgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -539,27 +539,27 @@ type LicenseSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ls *LicenseSelect) Aggregate(fns ...AggregateFunc) *LicenseSelect { - ls.fns = append(ls.fns, fns...) - return ls +func (_s *LicenseSelect) Aggregate(fns ...AggregateFunc) *LicenseSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ls *LicenseSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect) - if err := ls.prepareQuery(ctx); err != nil { +func (_s *LicenseSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LicenseQuery, *LicenseSelect](ctx, ls.LicenseQuery, ls, ls.inters, v) + return scanWithInterceptors[*LicenseQuery, *LicenseSelect](ctx, _s.LicenseQuery, _s, _s.inters, v) } -func (ls *LicenseSelect) sqlScan(ctx context.Context, root *LicenseQuery, v any) error { +func (_s *LicenseSelect) sqlScan(ctx context.Context, root *LicenseQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ls.fns)) - for _, fn := range ls.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ls.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -567,7 +567,7 @@ func (ls *LicenseSelect) sqlScan(ctx context.Context, root *LicenseQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ls.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,7 +575,7 @@ func (ls *LicenseSelect) sqlScan(ctx context.Context, root *LicenseQuery, v any) } // Modify adds a query modifier for attaching custom logic to queries. -func (ls *LicenseSelect) Modify(modifiers ...func(s *sql.Selector)) *LicenseSelect { - ls.modifiers = append(ls.modifiers, modifiers...) - return ls +func (_s *LicenseSelect) Modify(modifiers ...func(s *sql.Selector)) *LicenseSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/node_query.go b/entc/integration/ent/node_query.go index d3d93ba78..19b6f8922 100644 --- a/entc/integration/ent/node_query.go +++ b/entc/integration/ent/node_query.go @@ -658,41 +658,41 @@ type NodeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_g *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ngb.fns)) - for _, fn := range ngb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns)) - for _, f := range *ngb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ngb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -706,27 +706,27 @@ type NodeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NodeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, ns.NodeQuery, ns, ns.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, _s.NodeQuery, _s, _s.inters, v) } -func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_s *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ns.fns)) - for _, fn := range ns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -734,7 +734,7 @@ func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -742,7 +742,7 @@ func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (ns *NodeSelect) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect { - ns.modifiers = append(ns.modifiers, modifiers...) - return ns +func (_s *NodeSelect) Modify(modifiers ...func(s *sql.Selector)) *NodeSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/pc_query.go b/entc/integration/ent/pc_query.go index 1299a9817..0e1d7e0d8 100644 --- a/entc/integration/ent/pc_query.go +++ b/entc/integration/ent/pc_query.go @@ -469,41 +469,41 @@ type PCGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PCGroupBy) Aggregate(fns ...AggregateFunc) *PCGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PCGroupBy) Aggregate(fns ...AggregateFunc) *PCGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PCGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PCGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PCQuery, *PCGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PCQuery, *PCGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PCGroupBy) sqlScan(ctx context.Context, root *PCQuery, v any) error { +func (_g *PCGroupBy) sqlScan(ctx context.Context, root *PCQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -517,27 +517,27 @@ type PCSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PCSelect) Aggregate(fns ...AggregateFunc) *PCSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PCSelect) Aggregate(fns ...AggregateFunc) *PCSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PCSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PCSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PCQuery, *PCSelect](ctx, ps.PCQuery, ps, ps.inters, v) + return scanWithInterceptors[*PCQuery, *PCSelect](ctx, _s.PCQuery, _s, _s.inters, v) } -func (ps *PCSelect) sqlScan(ctx context.Context, root *PCQuery, v any) error { +func (_s *PCSelect) sqlScan(ctx context.Context, root *PCQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -545,7 +545,7 @@ func (ps *PCSelect) sqlScan(ctx context.Context, root *PCQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -553,7 +553,7 @@ func (ps *PCSelect) sqlScan(ctx context.Context, root *PCQuery, v any) error { } // Modify adds a query modifier for attaching custom logic to queries. -func (ps *PCSelect) Modify(modifiers ...func(s *sql.Selector)) *PCSelect { - ps.modifiers = append(ps.modifiers, modifiers...) - return ps +func (_s *PCSelect) Modify(modifiers ...func(s *sql.Selector)) *PCSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/pet_query.go b/entc/integration/ent/pet_query.go index 5527eecf3..05f3de79a 100644 --- a/entc/integration/ent/pet_query.go +++ b/entc/integration/ent/pet_query.go @@ -657,41 +657,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -705,27 +705,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -733,7 +733,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -741,7 +741,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } // Modify adds a query modifier for attaching custom logic to queries. -func (ps *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { - ps.modifiers = append(ps.modifiers, modifiers...) - return ps +func (_s *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/spec_query.go b/entc/integration/ent/spec_query.go index ff462c6c7..6940136f9 100644 --- a/entc/integration/ent/spec_query.go +++ b/entc/integration/ent/spec_query.go @@ -601,41 +601,41 @@ type SpecGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SpecGroupBy) Aggregate(fns ...AggregateFunc) *SpecGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb +func (_g *SpecGroupBy) Aggregate(fns ...AggregateFunc) *SpecGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sgb *SpecGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) - if err := sgb.build.prepareQuery(ctx); err != nil { +func (_g *SpecGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SpecQuery, *SpecGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v) + return scanWithInterceptors[*SpecQuery, *SpecGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sgb *SpecGroupBy) sqlScan(ctx context.Context, root *SpecQuery, v any) error { +func (_g *SpecGroupBy) sqlScan(ctx context.Context, root *SpecQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*sgb.flds)+len(sgb.fns)) - for _, f := range *sgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*sgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := sgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type SpecSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ss *SpecSelect) Aggregate(fns ...AggregateFunc) *SpecSelect { - ss.fns = append(ss.fns, fns...) - return ss +func (_s *SpecSelect) Aggregate(fns ...AggregateFunc) *SpecSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ss *SpecSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) - if err := ss.prepareQuery(ctx); err != nil { +func (_s *SpecSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SpecQuery, *SpecSelect](ctx, ss.SpecQuery, ss, ss.inters, v) + return scanWithInterceptors[*SpecQuery, *SpecSelect](ctx, _s.SpecQuery, _s, _s.inters, v) } -func (ss *SpecSelect) sqlScan(ctx context.Context, root *SpecQuery, v any) error { +func (_s *SpecSelect) sqlScan(ctx context.Context, root *SpecQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ss.fns)) - for _, fn := range ss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (ss *SpecSelect) sqlScan(ctx context.Context, root *SpecQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -685,7 +685,7 @@ func (ss *SpecSelect) sqlScan(ctx context.Context, root *SpecQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (ss *SpecSelect) Modify(modifiers ...func(s *sql.Selector)) *SpecSelect { - ss.modifiers = append(ss.modifiers, modifiers...) - return ss +func (_s *SpecSelect) Modify(modifiers ...func(s *sql.Selector)) *SpecSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/task_query.go b/entc/integration/ent/task_query.go index 173578f3e..389a3b75e 100644 --- a/entc/integration/ent/task_query.go +++ b/entc/integration/ent/task_query.go @@ -491,41 +491,41 @@ type TaskGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TaskGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TaskGroupBy) sqlScan(ctx context.Context, root *TaskQuery, v any) error { +func (_g *TaskGroupBy) sqlScan(ctx context.Context, root *TaskQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -539,27 +539,27 @@ type TaskSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TaskSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TaskSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, ts.TaskQuery, ts, ts.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, _s.TaskQuery, _s, _s.inters, v) } -func (ts *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error { +func (_s *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -567,7 +567,7 @@ func (ts *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,7 +575,7 @@ func (ts *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (ts *TaskSelect) Modify(modifiers ...func(s *sql.Selector)) *TaskSelect { - ts.modifiers = append(ts.modifiers, modifiers...) - return ts +func (_s *TaskSelect) Modify(modifiers ...func(s *sql.Selector)) *TaskSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/ent/user_query.go b/entc/integration/ent/user_query.go index bc4ab9c4d..7781c3fa1 100644 --- a/entc/integration/ent/user_query.go +++ b/entc/integration/ent/user_query.go @@ -1628,41 +1628,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1676,27 +1676,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1704,7 +1704,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1712,7 +1712,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (us *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { - us.modifiers = append(us.modifiers, modifiers...) - return us +func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/gremlin/ent/api_query.go b/entc/integration/gremlin/ent/api_query.go index ee76ecffb..ccb837be5 100644 --- a/entc/integration/gremlin/ent/api_query.go +++ b/entc/integration/gremlin/ent/api_query.go @@ -378,45 +378,45 @@ type APIGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (agb *APIGroupBy) Aggregate(fns ...AggregateFunc) *APIGroupBy { - agb.fns = append(agb.fns, fns...) - return agb +func (_g *APIGroupBy) Aggregate(fns ...AggregateFunc) *APIGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (agb *APIGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, agb.build.ctx, ent.OpQueryGroupBy) - if err := agb.build.prepareQuery(ctx); err != nil { +func (_g *APIGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*APIQuery, *APIGroupBy](ctx, agb.build, agb, agb.build.inters, v) + return scanWithInterceptors[*APIQuery, *APIGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (agb *APIGroupBy) gremlinScan(ctx context.Context, root *APIQuery, v any) error { +func (_g *APIGroupBy) gremlinScan(ctx context.Context, root *APIQuery, v any) error { var ( trs []any names []any ) - for _, fn := range agb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *agb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*agb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := agb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*agb.flds)+len(agb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -433,40 +433,40 @@ type APISelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (as *APISelect) Aggregate(fns ...AggregateFunc) *APISelect { - as.fns = append(as.fns, fns...) - return as +func (_s *APISelect) Aggregate(fns ...AggregateFunc) *APISelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (as *APISelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, as.ctx, ent.OpQuerySelect) - if err := as.prepareQuery(ctx); err != nil { +func (_s *APISelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*APIQuery, *APISelect](ctx, as.APIQuery, as, as.inters, v) + return scanWithInterceptors[*APIQuery, *APISelect](ctx, _s.APIQuery, _s, _s.inters, v) } -func (as *APISelect) gremlinScan(ctx context.Context, root *APIQuery, v any) error { +func (_s *APISelect) gremlinScan(ctx context.Context, root *APIQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := as.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != api.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(as.ctx.Fields)) - for i, f := range as.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := as.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/builder_query.go b/entc/integration/gremlin/ent/builder_query.go index 5e89f9bef..c2c4d710d 100644 --- a/entc/integration/gremlin/ent/builder_query.go +++ b/entc/integration/gremlin/ent/builder_query.go @@ -378,45 +378,45 @@ type BuilderGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (bgb *BuilderGroupBy) Aggregate(fns ...AggregateFunc) *BuilderGroupBy { - bgb.fns = append(bgb.fns, fns...) - return bgb +func (_g *BuilderGroupBy) Aggregate(fns ...AggregateFunc) *BuilderGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (bgb *BuilderGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) - if err := bgb.build.prepareQuery(ctx); err != nil { +func (_g *BuilderGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BuilderQuery, *BuilderGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) + return scanWithInterceptors[*BuilderQuery, *BuilderGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (bgb *BuilderGroupBy) gremlinScan(ctx context.Context, root *BuilderQuery, v any) error { +func (_g *BuilderGroupBy) gremlinScan(ctx context.Context, root *BuilderQuery, v any) error { var ( trs []any names []any ) - for _, fn := range bgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *bgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*bgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := bgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*bgb.flds)+len(bgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -433,40 +433,40 @@ type BuilderSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bs *BuilderSelect) Aggregate(fns ...AggregateFunc) *BuilderSelect { - bs.fns = append(bs.fns, fns...) - return bs +func (_s *BuilderSelect) Aggregate(fns ...AggregateFunc) *BuilderSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bs *BuilderSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) - if err := bs.prepareQuery(ctx); err != nil { +func (_s *BuilderSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BuilderQuery, *BuilderSelect](ctx, bs.BuilderQuery, bs, bs.inters, v) + return scanWithInterceptors[*BuilderQuery, *BuilderSelect](ctx, _s.BuilderQuery, _s, _s.inters, v) } -func (bs *BuilderSelect) gremlinScan(ctx context.Context, root *BuilderQuery, v any) error { +func (_s *BuilderSelect) gremlinScan(ctx context.Context, root *BuilderQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := bs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != builder.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(bs.ctx.Fields)) - for i, f := range bs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := bs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/card_query.go b/entc/integration/gremlin/ent/card_query.go index 4865ba627..003dea178 100644 --- a/entc/integration/gremlin/ent/card_query.go +++ b/entc/integration/gremlin/ent/card_query.go @@ -456,45 +456,45 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) gremlinScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) gremlinScan(ctx context.Context, root *CardQuery, v any) error { var ( trs []any names []any ) - for _, fn := range cgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *cgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*cgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := cgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*cgb.flds)+len(cgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -511,40 +511,40 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) gremlinScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) gremlinScan(ctx context.Context, root *CardQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := cs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != card.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(cs.ctx.Fields)) - for i, f := range cs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := cs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/comment_query.go b/entc/integration/gremlin/ent/comment_query.go index eefb68d89..6e9c96491 100644 --- a/entc/integration/gremlin/ent/comment_query.go +++ b/entc/integration/gremlin/ent/comment_query.go @@ -400,45 +400,45 @@ type CommentGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CommentGroupBy) Aggregate(fns ...AggregateFunc) *CommentGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CommentGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CommentGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CommentGroupBy) gremlinScan(ctx context.Context, root *CommentQuery, v any) error { +func (_g *CommentGroupBy) gremlinScan(ctx context.Context, root *CommentQuery, v any) error { var ( trs []any names []any ) - for _, fn := range cgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *cgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*cgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := cgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*cgb.flds)+len(cgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type CommentSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CommentSelect) Aggregate(fns ...AggregateFunc) *CommentSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CommentSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CommentSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, cs.CommentQuery, cs, cs.inters, v) + return scanWithInterceptors[*CommentQuery, *CommentSelect](ctx, _s.CommentQuery, _s, _s.inters, v) } -func (cs *CommentSelect) gremlinScan(ctx context.Context, root *CommentQuery, v any) error { +func (_s *CommentSelect) gremlinScan(ctx context.Context, root *CommentQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := cs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != comment.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(cs.ctx.Fields)) - for i, f := range cs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := cs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/exvaluescan_query.go b/entc/integration/gremlin/ent/exvaluescan_query.go index a0f3c7fd8..1e0bd4d55 100644 --- a/entc/integration/gremlin/ent/exvaluescan_query.go +++ b/entc/integration/gremlin/ent/exvaluescan_query.go @@ -400,45 +400,45 @@ type ExValueScanGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (evsgb *ExValueScanGroupBy) Aggregate(fns ...AggregateFunc) *ExValueScanGroupBy { - evsgb.fns = append(evsgb.fns, fns...) - return evsgb +func (_g *ExValueScanGroupBy) Aggregate(fns ...AggregateFunc) *ExValueScanGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (evsgb *ExValueScanGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, evsgb.build.ctx, ent.OpQueryGroupBy) - if err := evsgb.build.prepareQuery(ctx); err != nil { +func (_g *ExValueScanGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ExValueScanQuery, *ExValueScanGroupBy](ctx, evsgb.build, evsgb, evsgb.build.inters, v) + return scanWithInterceptors[*ExValueScanQuery, *ExValueScanGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (evsgb *ExValueScanGroupBy) gremlinScan(ctx context.Context, root *ExValueScanQuery, v any) error { +func (_g *ExValueScanGroupBy) gremlinScan(ctx context.Context, root *ExValueScanQuery, v any) error { var ( trs []any names []any ) - for _, fn := range evsgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *evsgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*evsgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := evsgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*evsgb.flds)+len(evsgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type ExValueScanSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (evss *ExValueScanSelect) Aggregate(fns ...AggregateFunc) *ExValueScanSelect { - evss.fns = append(evss.fns, fns...) - return evss +func (_s *ExValueScanSelect) Aggregate(fns ...AggregateFunc) *ExValueScanSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (evss *ExValueScanSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, evss.ctx, ent.OpQuerySelect) - if err := evss.prepareQuery(ctx); err != nil { +func (_s *ExValueScanSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ExValueScanQuery, *ExValueScanSelect](ctx, evss.ExValueScanQuery, evss, evss.inters, v) + return scanWithInterceptors[*ExValueScanQuery, *ExValueScanSelect](ctx, _s.ExValueScanQuery, _s, _s.inters, v) } -func (evss *ExValueScanSelect) gremlinScan(ctx context.Context, root *ExValueScanQuery, v any) error { +func (_s *ExValueScanSelect) gremlinScan(ctx context.Context, root *ExValueScanQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := evss.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != exvaluescan.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(evss.ctx.Fields)) - for i, f := range evss.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := evss.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/fieldtype_query.go b/entc/integration/gremlin/ent/fieldtype_query.go index 6cf08605d..c5dd4bf3d 100644 --- a/entc/integration/gremlin/ent/fieldtype_query.go +++ b/entc/integration/gremlin/ent/fieldtype_query.go @@ -400,45 +400,45 @@ type FieldTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ftgb *FieldTypeGroupBy) Aggregate(fns ...AggregateFunc) *FieldTypeGroupBy { - ftgb.fns = append(ftgb.fns, fns...) - return ftgb +func (_g *FieldTypeGroupBy) Aggregate(fns ...AggregateFunc) *FieldTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ftgb *FieldTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ftgb.build.ctx, ent.OpQueryGroupBy) - if err := ftgb.build.prepareQuery(ctx); err != nil { +func (_g *FieldTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FieldTypeQuery, *FieldTypeGroupBy](ctx, ftgb.build, ftgb, ftgb.build.inters, v) + return scanWithInterceptors[*FieldTypeQuery, *FieldTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ftgb *FieldTypeGroupBy) gremlinScan(ctx context.Context, root *FieldTypeQuery, v any) error { +func (_g *FieldTypeGroupBy) gremlinScan(ctx context.Context, root *FieldTypeQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ftgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ftgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ftgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ftgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ftgb.flds)+len(ftgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type FieldTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fts *FieldTypeSelect) Aggregate(fns ...AggregateFunc) *FieldTypeSelect { - fts.fns = append(fts.fns, fns...) - return fts +func (_s *FieldTypeSelect) Aggregate(fns ...AggregateFunc) *FieldTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fts *FieldTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fts.ctx, ent.OpQuerySelect) - if err := fts.prepareQuery(ctx); err != nil { +func (_s *FieldTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FieldTypeQuery, *FieldTypeSelect](ctx, fts.FieldTypeQuery, fts, fts.inters, v) + return scanWithInterceptors[*FieldTypeQuery, *FieldTypeSelect](ctx, _s.FieldTypeQuery, _s, _s.inters, v) } -func (fts *FieldTypeSelect) gremlinScan(ctx context.Context, root *FieldTypeQuery, v any) error { +func (_s *FieldTypeSelect) gremlinScan(ctx context.Context, root *FieldTypeQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := fts.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != fieldtype.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(fts.ctx.Fields)) - for i, f := range fts.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := fts.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/file_query.go b/entc/integration/gremlin/ent/file_query.go index 5bb1ebc44..b19460c13 100644 --- a/entc/integration/gremlin/ent/file_query.go +++ b/entc/integration/gremlin/ent/file_query.go @@ -483,45 +483,45 @@ type FileGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FileGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FileGroupBy) gremlinScan(ctx context.Context, root *FileQuery, v any) error { +func (_g *FileGroupBy) gremlinScan(ctx context.Context, root *FileQuery, v any) error { var ( trs []any names []any ) - for _, fn := range fgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *fgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*fgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := fgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*fgb.flds)+len(fgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -538,40 +538,40 @@ type FileSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FileSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileSelect](ctx, fs.FileQuery, fs, fs.inters, v) + return scanWithInterceptors[*FileQuery, *FileSelect](ctx, _s.FileQuery, _s, _s.inters, v) } -func (fs *FileSelect) gremlinScan(ctx context.Context, root *FileQuery, v any) error { +func (_s *FileSelect) gremlinScan(ctx context.Context, root *FileQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := fs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != file.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(fs.ctx.Fields)) - for i, f := range fs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := fs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/filetype_query.go b/entc/integration/gremlin/ent/filetype_query.go index 28088a36d..732e757fd 100644 --- a/entc/integration/gremlin/ent/filetype_query.go +++ b/entc/integration/gremlin/ent/filetype_query.go @@ -427,45 +427,45 @@ type FileTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ftgb *FileTypeGroupBy) Aggregate(fns ...AggregateFunc) *FileTypeGroupBy { - ftgb.fns = append(ftgb.fns, fns...) - return ftgb +func (_g *FileTypeGroupBy) Aggregate(fns ...AggregateFunc) *FileTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ftgb *FileTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ftgb.build.ctx, ent.OpQueryGroupBy) - if err := ftgb.build.prepareQuery(ctx); err != nil { +func (_g *FileTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileTypeQuery, *FileTypeGroupBy](ctx, ftgb.build, ftgb, ftgb.build.inters, v) + return scanWithInterceptors[*FileTypeQuery, *FileTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ftgb *FileTypeGroupBy) gremlinScan(ctx context.Context, root *FileTypeQuery, v any) error { +func (_g *FileTypeGroupBy) gremlinScan(ctx context.Context, root *FileTypeQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ftgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ftgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ftgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ftgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ftgb.flds)+len(ftgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -482,40 +482,40 @@ type FileTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fts *FileTypeSelect) Aggregate(fns ...AggregateFunc) *FileTypeSelect { - fts.fns = append(fts.fns, fns...) - return fts +func (_s *FileTypeSelect) Aggregate(fns ...AggregateFunc) *FileTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fts *FileTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fts.ctx, ent.OpQuerySelect) - if err := fts.prepareQuery(ctx); err != nil { +func (_s *FileTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileTypeQuery, *FileTypeSelect](ctx, fts.FileTypeQuery, fts, fts.inters, v) + return scanWithInterceptors[*FileTypeQuery, *FileTypeSelect](ctx, _s.FileTypeQuery, _s, _s.inters, v) } -func (fts *FileTypeSelect) gremlinScan(ctx context.Context, root *FileTypeQuery, v any) error { +func (_s *FileTypeSelect) gremlinScan(ctx context.Context, root *FileTypeQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := fts.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != filetype.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(fts.ctx.Fields)) - for i, f := range fts.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := fts.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/goods_query.go b/entc/integration/gremlin/ent/goods_query.go index 080f2620f..f2dcbb343 100644 --- a/entc/integration/gremlin/ent/goods_query.go +++ b/entc/integration/gremlin/ent/goods_query.go @@ -378,45 +378,45 @@ type GoodsGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GoodsGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GoodsGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GoodsQuery, *GoodsGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GoodsQuery, *GoodsGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GoodsGroupBy) gremlinScan(ctx context.Context, root *GoodsQuery, v any) error { +func (_g *GoodsGroupBy) gremlinScan(ctx context.Context, root *GoodsQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ggb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ggb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ggb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ggb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ggb.flds)+len(ggb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -433,40 +433,40 @@ type GoodsSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GoodsSelect) Aggregate(fns ...AggregateFunc) *GoodsSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GoodsSelect) Aggregate(fns ...AggregateFunc) *GoodsSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GoodsSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GoodsSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GoodsQuery, *GoodsSelect](ctx, gs.GoodsQuery, gs, gs.inters, v) + return scanWithInterceptors[*GoodsQuery, *GoodsSelect](ctx, _s.GoodsQuery, _s, _s.inters, v) } -func (gs *GoodsSelect) gremlinScan(ctx context.Context, root *GoodsQuery, v any) error { +func (_s *GoodsSelect) gremlinScan(ctx context.Context, root *GoodsQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := gs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != goods.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(gs.ctx.Fields)) - for i, f := range gs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := gs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/group_query.go b/entc/integration/gremlin/ent/group_query.go index c7860d452..23b7feeda 100644 --- a/entc/integration/gremlin/ent/group_query.go +++ b/entc/integration/gremlin/ent/group_query.go @@ -509,45 +509,45 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) gremlinScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) gremlinScan(ctx context.Context, root *GroupQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ggb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ggb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ggb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ggb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ggb.flds)+len(ggb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -564,40 +564,40 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) gremlinScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) gremlinScan(ctx context.Context, root *GroupQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := gs.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != group.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(gs.ctx.Fields)) - for i, f := range gs.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := gs.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/groupinfo_query.go b/entc/integration/gremlin/ent/groupinfo_query.go index 315ebc5ad..09f71bbf1 100644 --- a/entc/integration/gremlin/ent/groupinfo_query.go +++ b/entc/integration/gremlin/ent/groupinfo_query.go @@ -428,45 +428,45 @@ type GroupInfoGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (gigb *GroupInfoGroupBy) Aggregate(fns ...AggregateFunc) *GroupInfoGroupBy { - gigb.fns = append(gigb.fns, fns...) - return gigb +func (_g *GroupInfoGroupBy) Aggregate(fns ...AggregateFunc) *GroupInfoGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (gigb *GroupInfoGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gigb.build.ctx, ent.OpQueryGroupBy) - if err := gigb.build.prepareQuery(ctx); err != nil { +func (_g *GroupInfoGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupInfoQuery, *GroupInfoGroupBy](ctx, gigb.build, gigb, gigb.build.inters, v) + return scanWithInterceptors[*GroupInfoQuery, *GroupInfoGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (gigb *GroupInfoGroupBy) gremlinScan(ctx context.Context, root *GroupInfoQuery, v any) error { +func (_g *GroupInfoGroupBy) gremlinScan(ctx context.Context, root *GroupInfoQuery, v any) error { var ( trs []any names []any ) - for _, fn := range gigb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *gigb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*gigb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := gigb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*gigb.flds)+len(gigb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -483,40 +483,40 @@ type GroupInfoSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gis *GroupInfoSelect) Aggregate(fns ...AggregateFunc) *GroupInfoSelect { - gis.fns = append(gis.fns, fns...) - return gis +func (_s *GroupInfoSelect) Aggregate(fns ...AggregateFunc) *GroupInfoSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gis *GroupInfoSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gis.ctx, ent.OpQuerySelect) - if err := gis.prepareQuery(ctx); err != nil { +func (_s *GroupInfoSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupInfoQuery, *GroupInfoSelect](ctx, gis.GroupInfoQuery, gis, gis.inters, v) + return scanWithInterceptors[*GroupInfoQuery, *GroupInfoSelect](ctx, _s.GroupInfoQuery, _s, _s.inters, v) } -func (gis *GroupInfoSelect) gremlinScan(ctx context.Context, root *GroupInfoQuery, v any) error { +func (_s *GroupInfoSelect) gremlinScan(ctx context.Context, root *GroupInfoQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := gis.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != groupinfo.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(gis.ctx.Fields)) - for i, f := range gis.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := gis.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/item_query.go b/entc/integration/gremlin/ent/item_query.go index 9edd6e773..f05a1e355 100644 --- a/entc/integration/gremlin/ent/item_query.go +++ b/entc/integration/gremlin/ent/item_query.go @@ -400,45 +400,45 @@ type ItemGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (igb *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy { - igb.fns = append(igb.fns, fns...) - return igb +func (_g *ItemGroupBy) Aggregate(fns ...AggregateFunc) *ItemGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (igb *ItemGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, igb.build.ctx, ent.OpQueryGroupBy) - if err := igb.build.prepareQuery(ctx); err != nil { +func (_g *ItemGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, igb.build, igb, igb.build.inters, v) + return scanWithInterceptors[*ItemQuery, *ItemGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (igb *ItemGroupBy) gremlinScan(ctx context.Context, root *ItemQuery, v any) error { +func (_g *ItemGroupBy) gremlinScan(ctx context.Context, root *ItemQuery, v any) error { var ( trs []any names []any ) - for _, fn := range igb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *igb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*igb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := igb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*igb.flds)+len(igb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type ItemSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (is *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect { - is.fns = append(is.fns, fns...) - return is +func (_s *ItemSelect) Aggregate(fns ...AggregateFunc) *ItemSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (is *ItemSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, is.ctx, ent.OpQuerySelect) - if err := is.prepareQuery(ctx); err != nil { +func (_s *ItemSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, is.ItemQuery, is, is.inters, v) + return scanWithInterceptors[*ItemQuery, *ItemSelect](ctx, _s.ItemQuery, _s, _s.inters, v) } -func (is *ItemSelect) gremlinScan(ctx context.Context, root *ItemQuery, v any) error { +func (_s *ItemSelect) gremlinScan(ctx context.Context, root *ItemQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := is.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != item.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(is.ctx.Fields)) - for i, f := range is.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := is.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/license_query.go b/entc/integration/gremlin/ent/license_query.go index 573f496e3..21261fe2f 100644 --- a/entc/integration/gremlin/ent/license_query.go +++ b/entc/integration/gremlin/ent/license_query.go @@ -400,45 +400,45 @@ type LicenseGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (lgb *LicenseGroupBy) Aggregate(fns ...AggregateFunc) *LicenseGroupBy { - lgb.fns = append(lgb.fns, fns...) - return lgb +func (_g *LicenseGroupBy) Aggregate(fns ...AggregateFunc) *LicenseGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (lgb *LicenseGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, lgb.build.ctx, ent.OpQueryGroupBy) - if err := lgb.build.prepareQuery(ctx); err != nil { +func (_g *LicenseGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LicenseQuery, *LicenseGroupBy](ctx, lgb.build, lgb, lgb.build.inters, v) + return scanWithInterceptors[*LicenseQuery, *LicenseGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (lgb *LicenseGroupBy) gremlinScan(ctx context.Context, root *LicenseQuery, v any) error { +func (_g *LicenseGroupBy) gremlinScan(ctx context.Context, root *LicenseQuery, v any) error { var ( trs []any names []any ) - for _, fn := range lgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *lgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*lgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := lgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*lgb.flds)+len(lgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type LicenseSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ls *LicenseSelect) Aggregate(fns ...AggregateFunc) *LicenseSelect { - ls.fns = append(ls.fns, fns...) - return ls +func (_s *LicenseSelect) Aggregate(fns ...AggregateFunc) *LicenseSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ls *LicenseSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ls.ctx, ent.OpQuerySelect) - if err := ls.prepareQuery(ctx); err != nil { +func (_s *LicenseSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*LicenseQuery, *LicenseSelect](ctx, ls.LicenseQuery, ls, ls.inters, v) + return scanWithInterceptors[*LicenseQuery, *LicenseSelect](ctx, _s.LicenseQuery, _s, _s.inters, v) } -func (ls *LicenseSelect) gremlinScan(ctx context.Context, root *LicenseQuery, v any) error { +func (_s *LicenseSelect) gremlinScan(ctx context.Context, root *LicenseQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ls.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != license.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ls.ctx.Fields)) - for i, f := range ls.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ls.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/node_query.go b/entc/integration/gremlin/ent/node_query.go index 02fa1b379..b21b8b6af 100644 --- a/entc/integration/gremlin/ent/node_query.go +++ b/entc/integration/gremlin/ent/node_query.go @@ -454,45 +454,45 @@ type NodeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NodeGroupBy) gremlinScan(ctx context.Context, root *NodeQuery, v any) error { +func (_g *NodeGroupBy) gremlinScan(ctx context.Context, root *NodeQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ngb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ngb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ngb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ngb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ngb.flds)+len(ngb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -509,40 +509,40 @@ type NodeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NodeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, ns.NodeQuery, ns, ns.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, _s.NodeQuery, _s, _s.inters, v) } -func (ns *NodeSelect) gremlinScan(ctx context.Context, root *NodeQuery, v any) error { +func (_s *NodeSelect) gremlinScan(ctx context.Context, root *NodeQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ns.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != node.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ns.ctx.Fields)) - for i, f := range ns.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ns.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/pc_query.go b/entc/integration/gremlin/ent/pc_query.go index 7d7584f35..b19d53516 100644 --- a/entc/integration/gremlin/ent/pc_query.go +++ b/entc/integration/gremlin/ent/pc_query.go @@ -378,45 +378,45 @@ type PCGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PCGroupBy) Aggregate(fns ...AggregateFunc) *PCGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PCGroupBy) Aggregate(fns ...AggregateFunc) *PCGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PCGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PCGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PCQuery, *PCGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PCQuery, *PCGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PCGroupBy) gremlinScan(ctx context.Context, root *PCQuery, v any) error { +func (_g *PCGroupBy) gremlinScan(ctx context.Context, root *PCQuery, v any) error { var ( trs []any names []any ) - for _, fn := range pgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *pgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*pgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := pgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*pgb.flds)+len(pgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -433,40 +433,40 @@ type PCSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PCSelect) Aggregate(fns ...AggregateFunc) *PCSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PCSelect) Aggregate(fns ...AggregateFunc) *PCSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PCSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PCSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PCQuery, *PCSelect](ctx, ps.PCQuery, ps, ps.inters, v) + return scanWithInterceptors[*PCQuery, *PCSelect](ctx, _s.PCQuery, _s, _s.inters, v) } -func (ps *PCSelect) gremlinScan(ctx context.Context, root *PCQuery, v any) error { +func (_s *PCSelect) gremlinScan(ctx context.Context, root *PCQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ps.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != pc.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ps.ctx.Fields)) - for i, f := range ps.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ps.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/pet_query.go b/entc/integration/gremlin/ent/pet_query.go index 983845fbb..135a2151b 100644 --- a/entc/integration/gremlin/ent/pet_query.go +++ b/entc/integration/gremlin/ent/pet_query.go @@ -455,45 +455,45 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) gremlinScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) gremlinScan(ctx context.Context, root *PetQuery, v any) error { var ( trs []any names []any ) - for _, fn := range pgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *pgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*pgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := pgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*pgb.flds)+len(pgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -510,40 +510,40 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) gremlinScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) gremlinScan(ctx context.Context, root *PetQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ps.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != pet.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ps.ctx.Fields)) - for i, f := range ps.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ps.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/spec_query.go b/entc/integration/gremlin/ent/spec_query.go index 6d5792903..b9a3338f2 100644 --- a/entc/integration/gremlin/ent/spec_query.go +++ b/entc/integration/gremlin/ent/spec_query.go @@ -405,45 +405,45 @@ type SpecGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SpecGroupBy) Aggregate(fns ...AggregateFunc) *SpecGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb +func (_g *SpecGroupBy) Aggregate(fns ...AggregateFunc) *SpecGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sgb *SpecGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) - if err := sgb.build.prepareQuery(ctx); err != nil { +func (_g *SpecGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SpecQuery, *SpecGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v) + return scanWithInterceptors[*SpecQuery, *SpecGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sgb *SpecGroupBy) gremlinScan(ctx context.Context, root *SpecQuery, v any) error { +func (_g *SpecGroupBy) gremlinScan(ctx context.Context, root *SpecQuery, v any) error { var ( trs []any names []any ) - for _, fn := range sgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *sgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*sgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := sgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*sgb.flds)+len(sgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -460,40 +460,40 @@ type SpecSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ss *SpecSelect) Aggregate(fns ...AggregateFunc) *SpecSelect { - ss.fns = append(ss.fns, fns...) - return ss +func (_s *SpecSelect) Aggregate(fns ...AggregateFunc) *SpecSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ss *SpecSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) - if err := ss.prepareQuery(ctx); err != nil { +func (_s *SpecSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SpecQuery, *SpecSelect](ctx, ss.SpecQuery, ss, ss.inters, v) + return scanWithInterceptors[*SpecQuery, *SpecSelect](ctx, _s.SpecQuery, _s, _s.inters, v) } -func (ss *SpecSelect) gremlinScan(ctx context.Context, root *SpecQuery, v any) error { +func (_s *SpecSelect) gremlinScan(ctx context.Context, root *SpecQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ss.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != spec.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ss.ctx.Fields)) - for i, f := range ss.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ss.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/task_query.go b/entc/integration/gremlin/ent/task_query.go index 03c0eca1b..f30e52793 100644 --- a/entc/integration/gremlin/ent/task_query.go +++ b/entc/integration/gremlin/ent/task_query.go @@ -400,45 +400,45 @@ type TaskGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TaskGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TaskGroupBy) gremlinScan(ctx context.Context, root *TaskQuery, v any) error { +func (_g *TaskGroupBy) gremlinScan(ctx context.Context, root *TaskQuery, v any) error { var ( trs []any names []any ) - for _, fn := range tgb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *tgb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*tgb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := tgb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*tgb.flds)+len(tgb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -455,40 +455,40 @@ type TaskSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TaskSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TaskSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, ts.TaskQuery, ts, ts.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, _s.TaskQuery, _s, _s.inters, v) } -func (ts *TaskSelect) gremlinScan(ctx context.Context, root *TaskQuery, v any) error { +func (_s *TaskSelect) gremlinScan(ctx context.Context, root *TaskQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := ts.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != enttask.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(ts.ctx.Fields)) - for i, f := range ts.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := ts.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/gremlin/ent/user_query.go b/entc/integration/gremlin/ent/user_query.go index 5f1d977e1..2420b95bc 100644 --- a/entc/integration/gremlin/ent/user_query.go +++ b/entc/integration/gremlin/ent/user_query.go @@ -697,45 +697,45 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) gremlinScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) gremlinScan(ctx context.Context, root *UserQuery, v any) error { var ( trs []any names []any ) - for _, fn := range ugb.fns { + for _, fn := range _g.fns { name, tr := fn("p", "") trs = append(trs, tr) names = append(names, name) } - for _, f := range *ugb.flds { + for _, f := range *_g.flds { names = append(names, f) trs = append(trs, __.As("p").Unfold().Values(f).As(f)) } query, bindings := root.gremlinQuery(ctx).Group(). - By(__.Values(*ugb.flds...).Fold()). + By(__.Values(*_g.flds...).Fold()). By(__.Fold().Match(trs...).Select(names...)). Select(dsl.Values). Next(). Query() res := &gremlin.Response{} - if err := ugb.build.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _g.build.driver.Exec(ctx, query, bindings, res); err != nil { return err } - if len(*ugb.flds)+len(ugb.fns) == 1 { + if len(*_g.flds)+len(_g.fns) == 1 { return res.ReadVal(v) } vm, err := res.ReadValueMap() @@ -752,40 +752,40 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) gremlinScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) gremlinScan(ctx context.Context, root *UserQuery, v any) error { var ( res = &gremlin.Response{} traversal = root.gremlinQuery(ctx) ) - if fields := us.ctx.Fields; len(fields) == 1 { + if fields := _s.ctx.Fields; len(fields) == 1 { if fields[0] != user.FieldID { traversal = traversal.Values(fields...) } else { traversal = traversal.ID() } } else { - fields := make([]any, len(us.ctx.Fields)) - for i, f := range us.ctx.Fields { + fields := make([]any, len(_s.ctx.Fields)) + for i, f := range _s.ctx.Fields { fields[i] = f } traversal = traversal.ValueMap(fields...) } query, bindings := traversal.Query() - if err := us.driver.Exec(ctx, query, bindings, res); err != nil { + if err := _s.driver.Exec(ctx, query, bindings, res); err != nil { return err } if len(root.ctx.Fields) == 1 { diff --git a/entc/integration/hooks/ent/card_query.go b/entc/integration/hooks/ent/card_query.go index 899e3c397..86902082f 100644 --- a/entc/integration/hooks/ent/card_query.go +++ b/entc/integration/hooks/ent/card_query.go @@ -534,41 +534,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/hooks/ent/pet_query.go b/entc/integration/hooks/ent/pet_query.go index 875de3921..b18a5f6a5 100644 --- a/entc/integration/hooks/ent/pet_query.go +++ b/entc/integration/hooks/ent/pet_query.go @@ -534,41 +534,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/hooks/ent/user_query.go b/entc/integration/hooks/ent/user_query.go index 1f4453339..b33396a78 100644 --- a/entc/integration/hooks/ent/user_query.go +++ b/entc/integration/hooks/ent/user_query.go @@ -788,41 +788,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -836,27 +836,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -864,7 +864,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/idtype/ent/user_query.go b/entc/integration/idtype/ent/user_query.go index 784a67095..f7b143231 100644 --- a/entc/integration/idtype/ent/user_query.go +++ b/entc/integration/idtype/ent/user_query.go @@ -742,41 +742,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -790,27 +790,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -818,7 +818,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/json/ent/user_query.go b/entc/integration/json/ent/user_query.go index 8a37d3e82..e33f43538 100644 --- a/entc/integration/json/ent/user_query.go +++ b/entc/integration/json/ent/user_query.go @@ -464,41 +464,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -512,27 +512,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -540,7 +540,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -548,7 +548,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (us *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { - us.modifiers = append(us.modifiers, modifiers...) - return us +func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/migrate/entv1/car_query.go b/entc/integration/migrate/entv1/car_query.go index 9bb395237..9f0d5c559 100644 --- a/entc/integration/migrate/entv1/car_query.go +++ b/entc/integration/migrate/entv1/car_query.go @@ -512,41 +512,41 @@ type CarGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CarGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_g *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -560,27 +560,27 @@ type CarSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CarSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CarSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarSelect](ctx, cs.CarQuery, cs, cs.inters, v) + return scanWithInterceptors[*CarQuery, *CarSelect](ctx, _s.CarQuery, _s, _s.inters, v) } -func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_s *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -588,7 +588,7 @@ func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv1/conversion_query.go b/entc/integration/migrate/entv1/conversion_query.go index c12718df7..1ac8ebcf8 100644 --- a/entc/integration/migrate/entv1/conversion_query.go +++ b/entc/integration/migrate/entv1/conversion_query.go @@ -447,41 +447,41 @@ type ConversionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *ConversionGroupBy) Aggregate(fns ...AggregateFunc) *ConversionGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *ConversionGroupBy) Aggregate(fns ...AggregateFunc) *ConversionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *ConversionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *ConversionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConversionQuery, *ConversionGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*ConversionQuery, *ConversionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *ConversionGroupBy) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { +func (_g *ConversionGroupBy) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type ConversionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *ConversionSelect) Aggregate(fns ...AggregateFunc) *ConversionSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *ConversionSelect) Aggregate(fns ...AggregateFunc) *ConversionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *ConversionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *ConversionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConversionQuery, *ConversionSelect](ctx, cs.ConversionQuery, cs, cs.inters, v) + return scanWithInterceptors[*ConversionQuery, *ConversionSelect](ctx, _s.ConversionQuery, _s, _s.inters, v) } -func (cs *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { +func (_s *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (cs *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv1/customtype_query.go b/entc/integration/migrate/entv1/customtype_query.go index 4c836199f..f66d760a2 100644 --- a/entc/integration/migrate/entv1/customtype_query.go +++ b/entc/integration/migrate/entv1/customtype_query.go @@ -447,41 +447,41 @@ type CustomTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ctgb *CustomTypeGroupBy) Aggregate(fns ...AggregateFunc) *CustomTypeGroupBy { - ctgb.fns = append(ctgb.fns, fns...) - return ctgb +func (_g *CustomTypeGroupBy) Aggregate(fns ...AggregateFunc) *CustomTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ctgb *CustomTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ctgb.build.ctx, ent.OpQueryGroupBy) - if err := ctgb.build.prepareQuery(ctx); err != nil { +func (_g *CustomTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CustomTypeQuery, *CustomTypeGroupBy](ctx, ctgb.build, ctgb, ctgb.build.inters, v) + return scanWithInterceptors[*CustomTypeQuery, *CustomTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ctgb *CustomTypeGroupBy) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { +func (_g *CustomTypeGroupBy) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ctgb.fns)) - for _, fn := range ctgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ctgb.flds)+len(ctgb.fns)) - for _, f := range *ctgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ctgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ctgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type CustomTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cts *CustomTypeSelect) Aggregate(fns ...AggregateFunc) *CustomTypeSelect { - cts.fns = append(cts.fns, fns...) - return cts +func (_s *CustomTypeSelect) Aggregate(fns ...AggregateFunc) *CustomTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cts *CustomTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cts.ctx, ent.OpQuerySelect) - if err := cts.prepareQuery(ctx); err != nil { +func (_s *CustomTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CustomTypeQuery, *CustomTypeSelect](ctx, cts.CustomTypeQuery, cts, cts.inters, v) + return scanWithInterceptors[*CustomTypeQuery, *CustomTypeSelect](ctx, _s.CustomTypeQuery, _s, _s.inters, v) } -func (cts *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { +func (_s *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cts.fns)) - for _, fn := range cts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (cts *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := cts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv1/user_query.go b/entc/integration/migrate/entv1/user_query.go index d72416355..f9e1881de 100644 --- a/entc/integration/migrate/entv1/user_query.go +++ b/entc/integration/migrate/entv1/user_query.go @@ -753,41 +753,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -801,27 +801,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -829,7 +829,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/blog_query.go b/entc/integration/migrate/entv2/blog_query.go index 59b625b41..8e900f7a4 100644 --- a/entc/integration/migrate/entv2/blog_query.go +++ b/entc/integration/migrate/entv2/blog_query.go @@ -527,41 +527,41 @@ type BlogGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (bgb *BlogGroupBy) Aggregate(fns ...AggregateFunc) *BlogGroupBy { - bgb.fns = append(bgb.fns, fns...) - return bgb +func (_g *BlogGroupBy) Aggregate(fns ...AggregateFunc) *BlogGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (bgb *BlogGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bgb.build.ctx, ent.OpQueryGroupBy) - if err := bgb.build.prepareQuery(ctx); err != nil { +func (_g *BlogGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlogQuery, *BlogGroupBy](ctx, bgb.build, bgb, bgb.build.inters, v) + return scanWithInterceptors[*BlogQuery, *BlogGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (bgb *BlogGroupBy) sqlScan(ctx context.Context, root *BlogQuery, v any) error { +func (_g *BlogGroupBy) sqlScan(ctx context.Context, root *BlogQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(bgb.fns)) - for _, fn := range bgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*bgb.flds)+len(bgb.fns)) - for _, f := range *bgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*bgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := bgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,27 +575,27 @@ type BlogSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (bs *BlogSelect) Aggregate(fns ...AggregateFunc) *BlogSelect { - bs.fns = append(bs.fns, fns...) - return bs +func (_s *BlogSelect) Aggregate(fns ...AggregateFunc) *BlogSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (bs *BlogSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, bs.ctx, ent.OpQuerySelect) - if err := bs.prepareQuery(ctx); err != nil { +func (_s *BlogSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*BlogQuery, *BlogSelect](ctx, bs.BlogQuery, bs, bs.inters, v) + return scanWithInterceptors[*BlogQuery, *BlogSelect](ctx, _s.BlogQuery, _s, _s.inters, v) } -func (bs *BlogSelect) sqlScan(ctx context.Context, root *BlogQuery, v any) error { +func (_s *BlogSelect) sqlScan(ctx context.Context, root *BlogQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(bs.fns)) - for _, fn := range bs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*bs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -603,7 +603,7 @@ func (bs *BlogSelect) sqlScan(ctx context.Context, root *BlogQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := bs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/car_query.go b/entc/integration/migrate/entv2/car_query.go index 08f81afa1..5a572df30 100644 --- a/entc/integration/migrate/entv2/car_query.go +++ b/entc/integration/migrate/entv2/car_query.go @@ -534,41 +534,41 @@ type CarGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CarGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_g *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type CarSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CarSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CarSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarSelect](ctx, cs.CarQuery, cs, cs.inters, v) + return scanWithInterceptors[*CarQuery, *CarSelect](ctx, _s.CarQuery, _s, _s.inters, v) } -func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_s *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/conversion_query.go b/entc/integration/migrate/entv2/conversion_query.go index e7beaf817..781f9c9a0 100644 --- a/entc/integration/migrate/entv2/conversion_query.go +++ b/entc/integration/migrate/entv2/conversion_query.go @@ -447,41 +447,41 @@ type ConversionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *ConversionGroupBy) Aggregate(fns ...AggregateFunc) *ConversionGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *ConversionGroupBy) Aggregate(fns ...AggregateFunc) *ConversionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *ConversionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *ConversionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConversionQuery, *ConversionGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*ConversionQuery, *ConversionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *ConversionGroupBy) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { +func (_g *ConversionGroupBy) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type ConversionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *ConversionSelect) Aggregate(fns ...AggregateFunc) *ConversionSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *ConversionSelect) Aggregate(fns ...AggregateFunc) *ConversionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *ConversionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *ConversionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ConversionQuery, *ConversionSelect](ctx, cs.ConversionQuery, cs, cs.inters, v) + return scanWithInterceptors[*ConversionQuery, *ConversionSelect](ctx, _s.ConversionQuery, _s, _s.inters, v) } -func (cs *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { +func (_s *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (cs *ConversionSelect) sqlScan(ctx context.Context, root *ConversionQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/customtype_query.go b/entc/integration/migrate/entv2/customtype_query.go index 66baf875a..7b042df00 100644 --- a/entc/integration/migrate/entv2/customtype_query.go +++ b/entc/integration/migrate/entv2/customtype_query.go @@ -447,41 +447,41 @@ type CustomTypeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ctgb *CustomTypeGroupBy) Aggregate(fns ...AggregateFunc) *CustomTypeGroupBy { - ctgb.fns = append(ctgb.fns, fns...) - return ctgb +func (_g *CustomTypeGroupBy) Aggregate(fns ...AggregateFunc) *CustomTypeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ctgb *CustomTypeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ctgb.build.ctx, ent.OpQueryGroupBy) - if err := ctgb.build.prepareQuery(ctx); err != nil { +func (_g *CustomTypeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CustomTypeQuery, *CustomTypeGroupBy](ctx, ctgb.build, ctgb, ctgb.build.inters, v) + return scanWithInterceptors[*CustomTypeQuery, *CustomTypeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ctgb *CustomTypeGroupBy) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { +func (_g *CustomTypeGroupBy) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ctgb.fns)) - for _, fn := range ctgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ctgb.flds)+len(ctgb.fns)) - for _, f := range *ctgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ctgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ctgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type CustomTypeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cts *CustomTypeSelect) Aggregate(fns ...AggregateFunc) *CustomTypeSelect { - cts.fns = append(cts.fns, fns...) - return cts +func (_s *CustomTypeSelect) Aggregate(fns ...AggregateFunc) *CustomTypeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cts *CustomTypeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cts.ctx, ent.OpQuerySelect) - if err := cts.prepareQuery(ctx); err != nil { +func (_s *CustomTypeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CustomTypeQuery, *CustomTypeSelect](ctx, cts.CustomTypeQuery, cts, cts.inters, v) + return scanWithInterceptors[*CustomTypeQuery, *CustomTypeSelect](ctx, _s.CustomTypeQuery, _s, _s.inters, v) } -func (cts *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { +func (_s *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cts.fns)) - for _, fn := range cts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (cts *CustomTypeSelect) sqlScan(ctx context.Context, root *CustomTypeQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := cts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/group_query.go b/entc/integration/migrate/entv2/group_query.go index 6277ba6cf..9dac6fbdd 100644 --- a/entc/integration/migrate/entv2/group_query.go +++ b/entc/integration/migrate/entv2/group_query.go @@ -425,41 +425,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -473,27 +473,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -501,7 +501,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/media_query.go b/entc/integration/migrate/entv2/media_query.go index 77b5613c7..1b4eff33c 100644 --- a/entc/integration/migrate/entv2/media_query.go +++ b/entc/integration/migrate/entv2/media_query.go @@ -447,41 +447,41 @@ type MediaGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (mgb *MediaGroupBy) Aggregate(fns ...AggregateFunc) *MediaGroupBy { - mgb.fns = append(mgb.fns, fns...) - return mgb +func (_g *MediaGroupBy) Aggregate(fns ...AggregateFunc) *MediaGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (mgb *MediaGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, mgb.build.ctx, ent.OpQueryGroupBy) - if err := mgb.build.prepareQuery(ctx); err != nil { +func (_g *MediaGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MediaQuery, *MediaGroupBy](ctx, mgb.build, mgb, mgb.build.inters, v) + return scanWithInterceptors[*MediaQuery, *MediaGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (mgb *MediaGroupBy) sqlScan(ctx context.Context, root *MediaQuery, v any) error { +func (_g *MediaGroupBy) sqlScan(ctx context.Context, root *MediaQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(mgb.fns)) - for _, fn := range mgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*mgb.flds)+len(mgb.fns)) - for _, f := range *mgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*mgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := mgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type MediaSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ms *MediaSelect) Aggregate(fns ...AggregateFunc) *MediaSelect { - ms.fns = append(ms.fns, fns...) - return ms +func (_s *MediaSelect) Aggregate(fns ...AggregateFunc) *MediaSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ms *MediaSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ms.ctx, ent.OpQuerySelect) - if err := ms.prepareQuery(ctx); err != nil { +func (_s *MediaSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*MediaQuery, *MediaSelect](ctx, ms.MediaQuery, ms, ms.inters, v) + return scanWithInterceptors[*MediaQuery, *MediaSelect](ctx, _s.MediaQuery, _s, _s.inters, v) } -func (ms *MediaSelect) sqlScan(ctx context.Context, root *MediaQuery, v any) error { +func (_s *MediaSelect) sqlScan(ctx context.Context, root *MediaQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ms.fns)) - for _, fn := range ms.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ms.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (ms *MediaSelect) sqlScan(ctx context.Context, root *MediaQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := ms.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/pet_query.go b/entc/integration/migrate/entv2/pet_query.go index ee3b95774..f10a565ab 100644 --- a/entc/integration/migrate/entv2/pet_query.go +++ b/entc/integration/migrate/entv2/pet_query.go @@ -534,41 +534,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/user_query.go b/entc/integration/migrate/entv2/user_query.go index c14a5b277..234c93b30 100644 --- a/entc/integration/migrate/entv2/user_query.go +++ b/entc/integration/migrate/entv2/user_query.go @@ -707,41 +707,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -755,27 +755,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -783,7 +783,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/entv2/zoo_query.go b/entc/integration/migrate/entv2/zoo_query.go index 49f839257..80ea74cc1 100644 --- a/entc/integration/migrate/entv2/zoo_query.go +++ b/entc/integration/migrate/entv2/zoo_query.go @@ -425,41 +425,41 @@ type ZooGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (zgb *ZooGroupBy) Aggregate(fns ...AggregateFunc) *ZooGroupBy { - zgb.fns = append(zgb.fns, fns...) - return zgb +func (_g *ZooGroupBy) Aggregate(fns ...AggregateFunc) *ZooGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (zgb *ZooGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, zgb.build.ctx, ent.OpQueryGroupBy) - if err := zgb.build.prepareQuery(ctx); err != nil { +func (_g *ZooGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ZooQuery, *ZooGroupBy](ctx, zgb.build, zgb, zgb.build.inters, v) + return scanWithInterceptors[*ZooQuery, *ZooGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (zgb *ZooGroupBy) sqlScan(ctx context.Context, root *ZooQuery, v any) error { +func (_g *ZooGroupBy) sqlScan(ctx context.Context, root *ZooQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(zgb.fns)) - for _, fn := range zgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*zgb.flds)+len(zgb.fns)) - for _, f := range *zgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*zgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := zgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -473,27 +473,27 @@ type ZooSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (zs *ZooSelect) Aggregate(fns ...AggregateFunc) *ZooSelect { - zs.fns = append(zs.fns, fns...) - return zs +func (_s *ZooSelect) Aggregate(fns ...AggregateFunc) *ZooSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (zs *ZooSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, zs.ctx, ent.OpQuerySelect) - if err := zs.prepareQuery(ctx); err != nil { +func (_s *ZooSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ZooQuery, *ZooSelect](ctx, zs.ZooQuery, zs, zs.inters, v) + return scanWithInterceptors[*ZooQuery, *ZooSelect](ctx, _s.ZooQuery, _s, _s.inters, v) } -func (zs *ZooSelect) sqlScan(ctx context.Context, root *ZooQuery, v any) error { +func (_s *ZooSelect) sqlScan(ctx context.Context, root *ZooQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(zs.fns)) - for _, fn := range zs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*zs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -501,7 +501,7 @@ func (zs *ZooSelect) sqlScan(ctx context.Context, root *ZooQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := zs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/versioned/group_query.go b/entc/integration/migrate/versioned/group_query.go index 10ca6cb56..7fd6eded7 100644 --- a/entc/integration/migrate/versioned/group_query.go +++ b/entc/integration/migrate/versioned/group_query.go @@ -447,41 +447,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/migrate/versioned/user_query.go b/entc/integration/migrate/versioned/user_query.go index 5a03f2a9b..027c9651d 100644 --- a/entc/integration/migrate/versioned/user_query.go +++ b/entc/integration/migrate/versioned/user_query.go @@ -447,41 +447,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/multischema/ent/cleanuser_query.go b/entc/integration/multischema/ent/cleanuser_query.go index f21c18961..b9fcf493b 100644 --- a/entc/integration/multischema/ent/cleanuser_query.go +++ b/entc/integration/multischema/ent/cleanuser_query.go @@ -396,41 +396,41 @@ type CleanUserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cugb *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { - cugb.fns = append(cugb.fns, fns...) - return cugb +func (_g *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cugb *CleanUserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cugb.build.ctx, ent.OpQueryGroupBy) - if err := cugb.build.prepareQuery(ctx); err != nil { +func (_g *CleanUserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, cugb.build, cugb, cugb.build.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cugb *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_g *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cugb.fns)) - for _, fn := range cugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cugb.flds)+len(cugb.fns)) - for _, f := range *cugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -444,27 +444,27 @@ type CleanUserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cus *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { - cus.fns = append(cus.fns, fns...) - return cus +func (_s *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cus *CleanUserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cus.ctx, ent.OpQuerySelect) - if err := cus.prepareQuery(ctx); err != nil { +func (_s *CleanUserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, cus.CleanUserQuery, cus, cus.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, _s.CleanUserQuery, _s, _s.inters, v) } -func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_s *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cus.fns)) - for _, fn := range cus.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cus.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -472,7 +472,7 @@ func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := cus.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -480,7 +480,7 @@ func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v } // Modify adds a query modifier for attaching custom logic to queries. -func (cus *CleanUserSelect) Modify(modifiers ...func(s *sql.Selector)) *CleanUserSelect { - cus.modifiers = append(cus.modifiers, modifiers...) - return cus +func (_s *CleanUserSelect) Modify(modifiers ...func(s *sql.Selector)) *CleanUserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/ent/friendship_query.go b/entc/integration/multischema/ent/friendship_query.go index ac57ac7ad..6197610dd 100644 --- a/entc/integration/multischema/ent/friendship_query.go +++ b/entc/integration/multischema/ent/friendship_query.go @@ -631,41 +631,41 @@ type FriendshipGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FriendshipGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FriendshipGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_g *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -679,27 +679,27 @@ type FriendshipSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FriendshipSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FriendshipSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, fs.FriendshipQuery, fs, fs.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, _s.FriendshipQuery, _s, _s.inters, v) } -func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_s *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -707,7 +707,7 @@ func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -715,7 +715,7 @@ func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, } // Modify adds a query modifier for attaching custom logic to queries. -func (fs *FriendshipSelect) Modify(modifiers ...func(s *sql.Selector)) *FriendshipSelect { - fs.modifiers = append(fs.modifiers, modifiers...) - return fs +func (_s *FriendshipSelect) Modify(modifiers ...func(s *sql.Selector)) *FriendshipSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/ent/group_query.go b/entc/integration/multischema/ent/group_query.go index 4cad62c32..6e6de4700 100644 --- a/entc/integration/multischema/ent/group_query.go +++ b/entc/integration/multischema/ent/group_query.go @@ -586,41 +586,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -634,27 +634,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -662,7 +662,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -670,7 +670,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } // Modify adds a query modifier for attaching custom logic to queries. -func (gs *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { - gs.modifiers = append(gs.modifiers, modifiers...) - return gs +func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/ent/parent_query.go b/entc/integration/multischema/ent/parent_query.go index 5a9feb2fb..3fd58bc40 100644 --- a/entc/integration/multischema/ent/parent_query.go +++ b/entc/integration/multischema/ent/parent_query.go @@ -631,41 +631,41 @@ type ParentGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *ParentGroupBy) Aggregate(fns ...AggregateFunc) *ParentGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *ParentGroupBy) Aggregate(fns ...AggregateFunc) *ParentGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *ParentGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *ParentGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ParentQuery, *ParentGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*ParentQuery, *ParentGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *ParentGroupBy) sqlScan(ctx context.Context, root *ParentQuery, v any) error { +func (_g *ParentGroupBy) sqlScan(ctx context.Context, root *ParentQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -679,27 +679,27 @@ type ParentSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *ParentSelect) Aggregate(fns ...AggregateFunc) *ParentSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *ParentSelect) Aggregate(fns ...AggregateFunc) *ParentSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *ParentSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *ParentSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*ParentQuery, *ParentSelect](ctx, ps.ParentQuery, ps, ps.inters, v) + return scanWithInterceptors[*ParentQuery, *ParentSelect](ctx, _s.ParentQuery, _s, _s.inters, v) } -func (ps *ParentSelect) sqlScan(ctx context.Context, root *ParentQuery, v any) error { +func (_s *ParentSelect) sqlScan(ctx context.Context, root *ParentQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -707,7 +707,7 @@ func (ps *ParentSelect) sqlScan(ctx context.Context, root *ParentQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -715,7 +715,7 @@ func (ps *ParentSelect) sqlScan(ctx context.Context, root *ParentQuery, v any) e } // Modify adds a query modifier for attaching custom logic to queries. -func (ps *ParentSelect) Modify(modifiers ...func(s *sql.Selector)) *ParentSelect { - ps.modifiers = append(ps.modifiers, modifiers...) - return ps +func (_s *ParentSelect) Modify(modifiers ...func(s *sql.Selector)) *ParentSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/ent/pet_query.go b/entc/integration/multischema/ent/pet_query.go index d3a81394b..670711e5d 100644 --- a/entc/integration/multischema/ent/pet_query.go +++ b/entc/integration/multischema/ent/pet_query.go @@ -554,41 +554,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -602,27 +602,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -630,7 +630,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -638,7 +638,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } // Modify adds a query modifier for attaching custom logic to queries. -func (ps *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { - ps.modifiers = append(ps.modifiers, modifiers...) - return ps +func (_s *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/ent/user_query.go b/entc/integration/multischema/ent/user_query.go index 3b8d8dee5..0d300df9f 100644 --- a/entc/integration/multischema/ent/user_query.go +++ b/entc/integration/multischema/ent/user_query.go @@ -1141,41 +1141,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1189,27 +1189,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1217,7 +1217,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1225,7 +1225,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (us *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { - us.modifiers = append(us.modifiers, modifiers...) - return us +func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/versioned/friendship_query.go b/entc/integration/multischema/versioned/friendship_query.go index 91ae85eb3..c70033758 100644 --- a/entc/integration/multischema/versioned/friendship_query.go +++ b/entc/integration/multischema/versioned/friendship_query.go @@ -631,41 +631,41 @@ type FriendshipGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FriendshipGroupBy) Aggregate(fns ...AggregateFunc) *FriendshipGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FriendshipGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FriendshipGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_g *FriendshipGroupBy) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -679,27 +679,27 @@ type FriendshipSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FriendshipSelect) Aggregate(fns ...AggregateFunc) *FriendshipSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FriendshipSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FriendshipSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, fs.FriendshipQuery, fs, fs.inters, v) + return scanWithInterceptors[*FriendshipQuery, *FriendshipSelect](ctx, _s.FriendshipQuery, _s, _s.inters, v) } -func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { +func (_s *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -707,7 +707,7 @@ func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -715,7 +715,7 @@ func (fs *FriendshipSelect) sqlScan(ctx context.Context, root *FriendshipQuery, } // Modify adds a query modifier for attaching custom logic to queries. -func (fs *FriendshipSelect) Modify(modifiers ...func(s *sql.Selector)) *FriendshipSelect { - fs.modifiers = append(fs.modifiers, modifiers...) - return fs +func (_s *FriendshipSelect) Modify(modifiers ...func(s *sql.Selector)) *FriendshipSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/versioned/group_query.go b/entc/integration/multischema/versioned/group_query.go index 314ede275..555cdf9b4 100644 --- a/entc/integration/multischema/versioned/group_query.go +++ b/entc/integration/multischema/versioned/group_query.go @@ -586,41 +586,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -634,27 +634,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -662,7 +662,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -670,7 +670,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } // Modify adds a query modifier for attaching custom logic to queries. -func (gs *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { - gs.modifiers = append(gs.modifiers, modifiers...) - return gs +func (_s *GroupSelect) Modify(modifiers ...func(s *sql.Selector)) *GroupSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/versioned/pet_query.go b/entc/integration/multischema/versioned/pet_query.go index 8536a4e28..9eccf4d5c 100644 --- a/entc/integration/multischema/versioned/pet_query.go +++ b/entc/integration/multischema/versioned/pet_query.go @@ -554,41 +554,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -602,27 +602,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -630,7 +630,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -638,7 +638,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } // Modify adds a query modifier for attaching custom logic to queries. -func (ps *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { - ps.modifiers = append(ps.modifiers, modifiers...) - return ps +func (_s *PetSelect) Modify(modifiers ...func(s *sql.Selector)) *PetSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/multischema/versioned/user_query.go b/entc/integration/multischema/versioned/user_query.go index b5a7661cd..619365e76 100644 --- a/entc/integration/multischema/versioned/user_query.go +++ b/entc/integration/multischema/versioned/user_query.go @@ -1064,41 +1064,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1112,27 +1112,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -1140,7 +1140,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -1148,7 +1148,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } // Modify adds a query modifier for attaching custom logic to queries. -func (us *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { - us.modifiers = append(us.modifiers, modifiers...) - return us +func (_s *UserSelect) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { + _s.modifiers = append(_s.modifiers, modifiers...) + return _s } diff --git a/entc/integration/privacy/ent/task_query.go b/entc/integration/privacy/ent/task_query.go index 3b69e6bf9..7c02ba504 100644 --- a/entc/integration/privacy/ent/task_query.go +++ b/entc/integration/privacy/ent/task_query.go @@ -647,41 +647,41 @@ type TaskGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TaskGroupBy) Aggregate(fns ...AggregateFunc) *TaskGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TaskGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TaskGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TaskGroupBy) sqlScan(ctx context.Context, root *TaskQuery, v any) error { +func (_g *TaskGroupBy) sqlScan(ctx context.Context, root *TaskQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -695,27 +695,27 @@ type TaskSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TaskSelect) Aggregate(fns ...AggregateFunc) *TaskSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TaskSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TaskSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, ts.TaskQuery, ts, ts.inters, v) + return scanWithInterceptors[*TaskQuery, *TaskSelect](ctx, _s.TaskQuery, _s, _s.inters, v) } -func (ts *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error { +func (_s *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -723,7 +723,7 @@ func (ts *TaskSelect) sqlScan(ctx context.Context, root *TaskQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/privacy/ent/team_query.go b/entc/integration/privacy/ent/team_query.go index 2117b499f..35a5a8b4c 100644 --- a/entc/integration/privacy/ent/team_query.go +++ b/entc/integration/privacy/ent/team_query.go @@ -669,41 +669,41 @@ type TeamGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TeamGroupBy) Aggregate(fns ...AggregateFunc) *TeamGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TeamGroupBy) Aggregate(fns ...AggregateFunc) *TeamGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TeamGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TeamGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TeamQuery, *TeamGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TeamQuery, *TeamGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TeamGroupBy) sqlScan(ctx context.Context, root *TeamQuery, v any) error { +func (_g *TeamGroupBy) sqlScan(ctx context.Context, root *TeamQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -717,27 +717,27 @@ type TeamSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TeamSelect) Aggregate(fns ...AggregateFunc) *TeamSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TeamSelect) Aggregate(fns ...AggregateFunc) *TeamSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TeamSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TeamSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TeamQuery, *TeamSelect](ctx, ts.TeamQuery, ts, ts.inters, v) + return scanWithInterceptors[*TeamQuery, *TeamSelect](ctx, _s.TeamQuery, _s, _s.inters, v) } -func (ts *TeamSelect) sqlScan(ctx context.Context, root *TeamQuery, v any) error { +func (_s *TeamSelect) sqlScan(ctx context.Context, root *TeamQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -745,7 +745,7 @@ func (ts *TeamSelect) sqlScan(ctx context.Context, root *TeamQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/privacy/ent/user_query.go b/entc/integration/privacy/ent/user_query.go index 31510fa59..18d7fe53b 100644 --- a/entc/integration/privacy/ent/user_query.go +++ b/entc/integration/privacy/ent/user_query.go @@ -639,41 +639,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,27 +687,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -715,7 +715,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/template/ent/group_query.go b/entc/integration/template/ent/group_query.go index 7b7192253..39690f72e 100644 --- a/entc/integration/template/ent/group_query.go +++ b/entc/integration/template/ent/group_query.go @@ -464,41 +464,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -512,27 +512,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -540,7 +540,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/template/ent/pet_query.go b/entc/integration/template/ent/pet_query.go index f62cdd80a..9b6580e40 100644 --- a/entc/integration/template/ent/pet_query.go +++ b/entc/integration/template/ent/pet_query.go @@ -551,41 +551,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -599,27 +599,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -627,7 +627,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/entc/integration/template/ent/user_query.go b/entc/integration/template/ent/user_query.go index e5f4b1429..e8dec9d25 100644 --- a/entc/integration/template/ent/user_query.go +++ b/entc/integration/template/ent/user_query.go @@ -648,41 +648,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -696,27 +696,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -724,7 +724,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/compositetypes/ent/user_query.go b/examples/compositetypes/ent/user_query.go index eb6c5884a..d0b914849 100644 --- a/examples/compositetypes/ent/user_query.go +++ b/examples/compositetypes/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/domaintypes/ent/user_query.go b/examples/domaintypes/ent/user_query.go index b8f11f9cd..c316d38d6 100644 --- a/examples/domaintypes/ent/user_query.go +++ b/examples/domaintypes/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/edgeindex/ent/city_query.go b/examples/edgeindex/ent/city_query.go index 7f8ce62d0..54dfca093 100644 --- a/examples/edgeindex/ent/city_query.go +++ b/examples/edgeindex/ent/city_query.go @@ -527,41 +527,41 @@ type CityGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CityGroupBy) Aggregate(fns ...AggregateFunc) *CityGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CityGroupBy) Aggregate(fns ...AggregateFunc) *CityGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CityGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CityGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CityQuery, *CityGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CityQuery, *CityGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CityGroupBy) sqlScan(ctx context.Context, root *CityQuery, v any) error { +func (_g *CityGroupBy) sqlScan(ctx context.Context, root *CityQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,27 +575,27 @@ type CitySelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CitySelect) Aggregate(fns ...AggregateFunc) *CitySelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CitySelect) Aggregate(fns ...AggregateFunc) *CitySelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CitySelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CitySelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CityQuery, *CitySelect](ctx, cs.CityQuery, cs, cs.inters, v) + return scanWithInterceptors[*CityQuery, *CitySelect](ctx, _s.CityQuery, _s, _s.inters, v) } -func (cs *CitySelect) sqlScan(ctx context.Context, root *CityQuery, v any) error { +func (_s *CitySelect) sqlScan(ctx context.Context, root *CityQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -603,7 +603,7 @@ func (cs *CitySelect) sqlScan(ctx context.Context, root *CityQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/edgeindex/ent/street_query.go b/examples/edgeindex/ent/street_query.go index ac1ed8cba..4af3b1229 100644 --- a/examples/edgeindex/ent/street_query.go +++ b/examples/edgeindex/ent/street_query.go @@ -534,41 +534,41 @@ type StreetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sgb *StreetGroupBy) Aggregate(fns ...AggregateFunc) *StreetGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb +func (_g *StreetGroupBy) Aggregate(fns ...AggregateFunc) *StreetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sgb *StreetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) - if err := sgb.build.prepareQuery(ctx); err != nil { +func (_g *StreetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*StreetQuery, *StreetGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v) + return scanWithInterceptors[*StreetQuery, *StreetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sgb *StreetGroupBy) sqlScan(ctx context.Context, root *StreetQuery, v any) error { +func (_g *StreetGroupBy) sqlScan(ctx context.Context, root *StreetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*sgb.flds)+len(sgb.fns)) - for _, f := range *sgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*sgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := sgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type StreetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ss *StreetSelect) Aggregate(fns ...AggregateFunc) *StreetSelect { - ss.fns = append(ss.fns, fns...) - return ss +func (_s *StreetSelect) Aggregate(fns ...AggregateFunc) *StreetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ss *StreetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) - if err := ss.prepareQuery(ctx); err != nil { +func (_s *StreetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*StreetQuery, *StreetSelect](ctx, ss.StreetQuery, ss, ss.inters, v) + return scanWithInterceptors[*StreetQuery, *StreetSelect](ctx, _s.StreetQuery, _s, _s.inters, v) } -func (ss *StreetSelect) sqlScan(ctx context.Context, root *StreetQuery, v any) error { +func (_s *StreetSelect) sqlScan(ctx context.Context, root *StreetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ss.fns)) - for _, fn := range ss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (ss *StreetSelect) sqlScan(ctx context.Context, root *StreetQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/encryptfield/ent/user_query.go b/examples/encryptfield/ent/user_query.go index d791ea08a..0eec12e93 100644 --- a/examples/encryptfield/ent/user_query.go +++ b/examples/encryptfield/ent/user_query.go @@ -447,41 +447,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/entcpkg/ent/user_query.go b/examples/entcpkg/ent/user_query.go index e6fad87e9..968d5b058 100644 --- a/examples/entcpkg/ent/user_query.go +++ b/examples/entcpkg/ent/user_query.go @@ -447,41 +447,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/enumtypes/ent/user_query.go b/examples/enumtypes/ent/user_query.go index efcc5ec09..3becffbe4 100644 --- a/examples/enumtypes/ent/user_query.go +++ b/examples/enumtypes/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/extensions/ent/user_query.go b/examples/extensions/ent/user_query.go index c4a634505..fabb4f5ae 100644 --- a/examples/extensions/ent/user_query.go +++ b/examples/extensions/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/fs/ent/file_query.go b/examples/fs/ent/file_query.go index 2b45cb59d..00c088559 100644 --- a/examples/fs/ent/file_query.go +++ b/examples/fs/ent/file_query.go @@ -599,41 +599,41 @@ type FileGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (fgb *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { - fgb.fns = append(fgb.fns, fns...) - return fgb +func (_g *FileGroupBy) Aggregate(fns ...AggregateFunc) *FileGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (fgb *FileGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fgb.build.ctx, ent.OpQueryGroupBy) - if err := fgb.build.prepareQuery(ctx); err != nil { +func (_g *FileGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, fgb.build, fgb, fgb.build.inters, v) + return scanWithInterceptors[*FileQuery, *FileGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (fgb *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_g *FileGroupBy) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(fgb.fns)) - for _, fn := range fgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*fgb.flds)+len(fgb.fns)) - for _, f := range *fgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*fgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := fgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -647,27 +647,27 @@ type FileSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (fs *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { - fs.fns = append(fs.fns, fns...) - return fs +func (_s *FileSelect) Aggregate(fns ...AggregateFunc) *FileSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (fs *FileSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, fs.ctx, ent.OpQuerySelect) - if err := fs.prepareQuery(ctx); err != nil { +func (_s *FileSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*FileQuery, *FileSelect](ctx, fs.FileQuery, fs, fs.inters, v) + return scanWithInterceptors[*FileQuery, *FileSelect](ctx, _s.FileQuery, _s, _s.inters, v) } -func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { +func (_s *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(fs.fns)) - for _, fn := range fs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*fs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -675,7 +675,7 @@ func (fs *FileSelect) sqlScan(ctx context.Context, root *FileQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := fs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/functionalidx/ent/user_query.go b/examples/functionalidx/ent/user_query.go index ce58b407e..7dc04f99c 100644 --- a/examples/functionalidx/ent/user_query.go +++ b/examples/functionalidx/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/jsonencode/ent/card_query.go b/examples/jsonencode/ent/card_query.go index a7217ffb1..d3a055c77 100644 --- a/examples/jsonencode/ent/card_query.go +++ b/examples/jsonencode/ent/card_query.go @@ -447,41 +447,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/jsonencode/ent/pet_query.go b/examples/jsonencode/ent/pet_query.go index ef4d91812..938aea7e8 100644 --- a/examples/jsonencode/ent/pet_query.go +++ b/examples/jsonencode/ent/pet_query.go @@ -526,41 +526,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/jsonencode/ent/user_query.go b/examples/jsonencode/ent/user_query.go index 058234668..3a013ef3b 100644 --- a/examples/jsonencode/ent/user_query.go +++ b/examples/jsonencode/ent/user_query.go @@ -526,41 +526,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/m2m2types/ent/group_query.go b/examples/m2m2types/ent/group_query.go index afffe2dde..621c45f59 100644 --- a/examples/m2m2types/ent/group_query.go +++ b/examples/m2m2types/ent/group_query.go @@ -557,41 +557,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -605,27 +605,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -633,7 +633,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/m2m2types/ent/user_query.go b/examples/m2m2types/ent/user_query.go index 857e4227c..0c9dc6cd9 100644 --- a/examples/m2m2types/ent/user_query.go +++ b/examples/m2m2types/ent/user_query.go @@ -557,41 +557,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -605,27 +605,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -633,7 +633,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/m2mbidi/ent/user_query.go b/examples/m2mbidi/ent/user_query.go index 39c851749..d7cd13787 100644 --- a/examples/m2mbidi/ent/user_query.go +++ b/examples/m2mbidi/ent/user_query.go @@ -556,41 +556,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -604,27 +604,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -632,7 +632,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/m2mrecur/ent/user_query.go b/examples/m2mrecur/ent/user_query.go index 499c58054..a04d5851d 100644 --- a/examples/m2mrecur/ent/user_query.go +++ b/examples/m2mrecur/ent/user_query.go @@ -660,41 +660,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -708,27 +708,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -736,7 +736,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/card_query.go b/examples/migration/ent/card_query.go index 1461cba70..773c93ab6 100644 --- a/examples/migration/ent/card_query.go +++ b/examples/migration/ent/card_query.go @@ -601,41 +601,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/payment_query.go b/examples/migration/ent/payment_query.go index eece333cd..0c1d2bc39 100644 --- a/examples/migration/ent/payment_query.go +++ b/examples/migration/ent/payment_query.go @@ -526,41 +526,41 @@ type PaymentGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PaymentGroupBy) Aggregate(fns ...AggregateFunc) *PaymentGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PaymentGroupBy) Aggregate(fns ...AggregateFunc) *PaymentGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PaymentGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PaymentGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PaymentQuery, *PaymentGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PaymentQuery, *PaymentGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PaymentGroupBy) sqlScan(ctx context.Context, root *PaymentQuery, v any) error { +func (_g *PaymentGroupBy) sqlScan(ctx context.Context, root *PaymentQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type PaymentSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PaymentSelect) Aggregate(fns ...AggregateFunc) *PaymentSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PaymentSelect) Aggregate(fns ...AggregateFunc) *PaymentSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PaymentSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PaymentSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PaymentQuery, *PaymentSelect](ctx, ps.PaymentQuery, ps, ps.inters, v) + return scanWithInterceptors[*PaymentQuery, *PaymentSelect](ctx, _s.PaymentQuery, _s, _s.inters, v) } -func (ps *PaymentSelect) sqlScan(ctx context.Context, root *PaymentQuery, v any) error { +func (_s *PaymentSelect) sqlScan(ctx context.Context, root *PaymentQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (ps *PaymentSelect) sqlScan(ctx context.Context, root *PaymentQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/pet_query.go b/examples/migration/ent/pet_query.go index aaa3ece7b..11d10a70b 100644 --- a/examples/migration/ent/pet_query.go +++ b/examples/migration/ent/pet_query.go @@ -601,41 +601,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -649,27 +649,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -677,7 +677,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/session_query.go b/examples/migration/ent/session_query.go index 3c673498c..417d159c3 100644 --- a/examples/migration/ent/session_query.go +++ b/examples/migration/ent/session_query.go @@ -527,41 +527,41 @@ type SessionGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sgb *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy { - sgb.fns = append(sgb.fns, fns...) - return sgb +func (_g *SessionGroupBy) Aggregate(fns ...AggregateFunc) *SessionGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sgb *SessionGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sgb.build.ctx, ent.OpQueryGroupBy) - if err := sgb.build.prepareQuery(ctx); err != nil { +func (_g *SessionGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionQuery, *SessionGroupBy](ctx, sgb.build, sgb, sgb.build.inters, v) + return scanWithInterceptors[*SessionQuery, *SessionGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sgb *SessionGroupBy) sqlScan(ctx context.Context, root *SessionQuery, v any) error { +func (_g *SessionGroupBy) sqlScan(ctx context.Context, root *SessionQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(sgb.fns)) - for _, fn := range sgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*sgb.flds)+len(sgb.fns)) - for _, f := range *sgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*sgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := sgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,27 +575,27 @@ type SessionSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ss *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect { - ss.fns = append(ss.fns, fns...) - return ss +func (_s *SessionSelect) Aggregate(fns ...AggregateFunc) *SessionSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ss *SessionSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ss.ctx, ent.OpQuerySelect) - if err := ss.prepareQuery(ctx); err != nil { +func (_s *SessionSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionQuery, *SessionSelect](ctx, ss.SessionQuery, ss, ss.inters, v) + return scanWithInterceptors[*SessionQuery, *SessionSelect](ctx, _s.SessionQuery, _s, _s.inters, v) } -func (ss *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) error { +func (_s *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ss.fns)) - for _, fn := range ss.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ss.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -603,7 +603,7 @@ func (ss *SessionSelect) sqlScan(ctx context.Context, root *SessionQuery, v any) } rows := &sql.Rows{} query, args := selector.Query() - if err := ss.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/sessiondevice_query.go b/examples/migration/ent/sessiondevice_query.go index 212c26203..34d750c18 100644 --- a/examples/migration/ent/sessiondevice_query.go +++ b/examples/migration/ent/sessiondevice_query.go @@ -527,41 +527,41 @@ type SessionDeviceGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (sdgb *SessionDeviceGroupBy) Aggregate(fns ...AggregateFunc) *SessionDeviceGroupBy { - sdgb.fns = append(sdgb.fns, fns...) - return sdgb +func (_g *SessionDeviceGroupBy) Aggregate(fns ...AggregateFunc) *SessionDeviceGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (sdgb *SessionDeviceGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sdgb.build.ctx, ent.OpQueryGroupBy) - if err := sdgb.build.prepareQuery(ctx); err != nil { +func (_g *SessionDeviceGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionDeviceQuery, *SessionDeviceGroupBy](ctx, sdgb.build, sdgb, sdgb.build.inters, v) + return scanWithInterceptors[*SessionDeviceQuery, *SessionDeviceGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (sdgb *SessionDeviceGroupBy) sqlScan(ctx context.Context, root *SessionDeviceQuery, v any) error { +func (_g *SessionDeviceGroupBy) sqlScan(ctx context.Context, root *SessionDeviceQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(sdgb.fns)) - for _, fn := range sdgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*sdgb.flds)+len(sdgb.fns)) - for _, f := range *sdgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*sdgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := sdgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,27 +575,27 @@ type SessionDeviceSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (sds *SessionDeviceSelect) Aggregate(fns ...AggregateFunc) *SessionDeviceSelect { - sds.fns = append(sds.fns, fns...) - return sds +func (_s *SessionDeviceSelect) Aggregate(fns ...AggregateFunc) *SessionDeviceSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (sds *SessionDeviceSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, sds.ctx, ent.OpQuerySelect) - if err := sds.prepareQuery(ctx); err != nil { +func (_s *SessionDeviceSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*SessionDeviceQuery, *SessionDeviceSelect](ctx, sds.SessionDeviceQuery, sds, sds.inters, v) + return scanWithInterceptors[*SessionDeviceQuery, *SessionDeviceSelect](ctx, _s.SessionDeviceQuery, _s, _s.inters, v) } -func (sds *SessionDeviceSelect) sqlScan(ctx context.Context, root *SessionDeviceQuery, v any) error { +func (_s *SessionDeviceSelect) sqlScan(ctx context.Context, root *SessionDeviceQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(sds.fns)) - for _, fn := range sds.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*sds.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -603,7 +603,7 @@ func (sds *SessionDeviceSelect) sqlScan(ctx context.Context, root *SessionDevice } rows := &sql.Rows{} query, args := selector.Query() - if err := sds.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/migration/ent/user_query.go b/examples/migration/ent/user_query.go index 370feadf3..ed25236f3 100644 --- a/examples/migration/ent/user_query.go +++ b/examples/migration/ent/user_query.go @@ -526,41 +526,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -574,27 +574,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -602,7 +602,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2m2types/ent/pet_query.go b/examples/o2m2types/ent/pet_query.go index bec8e6d4c..6034e85ff 100644 --- a/examples/o2m2types/ent/pet_query.go +++ b/examples/o2m2types/ent/pet_query.go @@ -534,41 +534,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2m2types/ent/user_query.go b/examples/o2m2types/ent/user_query.go index 7a8fa275e..868432098 100644 --- a/examples/o2m2types/ent/user_query.go +++ b/examples/o2m2types/ent/user_query.go @@ -527,41 +527,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -575,27 +575,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -603,7 +603,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2mrecur/ent/node_query.go b/examples/o2mrecur/ent/node_query.go index 3901956cf..10b5c6b2e 100644 --- a/examples/o2mrecur/ent/node_query.go +++ b/examples/o2mrecur/ent/node_query.go @@ -599,41 +599,41 @@ type NodeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_g *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ngb.fns)) - for _, fn := range ngb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns)) - for _, f := range *ngb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ngb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -647,27 +647,27 @@ type NodeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NodeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, ns.NodeQuery, ns, ns.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, _s.NodeQuery, _s, _s.inters, v) } -func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_s *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ns.fns)) - for _, fn := range ns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -675,7 +675,7 @@ func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2o2types/ent/card_query.go b/examples/o2o2types/ent/card_query.go index 313ff571c..67cebd4ff 100644 --- a/examples/o2o2types/ent/card_query.go +++ b/examples/o2o2types/ent/card_query.go @@ -534,41 +534,41 @@ type CardGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CardGroupBy) Aggregate(fns ...AggregateFunc) *CardGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CardGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CardGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CardQuery, *CardGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_g *CardGroupBy) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type CardSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CardSelect) Aggregate(fns ...AggregateFunc) *CardSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CardSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CardSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CardQuery, *CardSelect](ctx, cs.CardQuery, cs, cs.inters, v) + return scanWithInterceptors[*CardQuery, *CardSelect](ctx, _s.CardQuery, _s, _s.inters, v) } -func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { +func (_s *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (cs *CardSelect) sqlScan(ctx context.Context, root *CardQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2o2types/ent/user_query.go b/examples/o2o2types/ent/user_query.go index 2abd93045..474f8a0c7 100644 --- a/examples/o2o2types/ent/user_query.go +++ b/examples/o2o2types/ent/user_query.go @@ -523,41 +523,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -571,27 +571,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -599,7 +599,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2obidi/ent/user_query.go b/examples/o2obidi/ent/user_query.go index 5b259bd22..c470ae508 100644 --- a/examples/o2obidi/ent/user_query.go +++ b/examples/o2obidi/ent/user_query.go @@ -533,41 +533,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -581,27 +581,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -609,7 +609,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/o2orecur/ent/node_query.go b/examples/o2orecur/ent/node_query.go index 92112c9c4..ef30da32a 100644 --- a/examples/o2orecur/ent/node_query.go +++ b/examples/o2orecur/ent/node_query.go @@ -595,41 +595,41 @@ type NodeGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ngb *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { - ngb.fns = append(ngb.fns, fns...) - return ngb +func (_g *NodeGroupBy) Aggregate(fns ...AggregateFunc) *NodeGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ngb *NodeGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ngb.build.ctx, ent.OpQueryGroupBy) - if err := ngb.build.prepareQuery(ctx); err != nil { +func (_g *NodeGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, ngb.build, ngb, ngb.build.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ngb *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_g *NodeGroupBy) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ngb.fns)) - for _, fn := range ngb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ngb.flds)+len(ngb.fns)) - for _, f := range *ngb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ngb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ngb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -643,27 +643,27 @@ type NodeSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ns *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { - ns.fns = append(ns.fns, fns...) - return ns +func (_s *NodeSelect) Aggregate(fns ...AggregateFunc) *NodeSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ns *NodeSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ns.ctx, ent.OpQuerySelect) - if err := ns.prepareQuery(ctx); err != nil { +func (_s *NodeSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, ns.NodeQuery, ns, ns.inters, v) + return scanWithInterceptors[*NodeQuery, *NodeSelect](ctx, _s.NodeQuery, _s, _s.inters, v) } -func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { +func (_s *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ns.fns)) - for _, fn := range ns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -671,7 +671,7 @@ func (ns *NodeSelect) sqlScan(ctx context.Context, root *NodeQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := ns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/privacyadmin/ent/user_query.go b/examples/privacyadmin/ent/user_query.go index f60751bab..3b64c28a8 100644 --- a/examples/privacyadmin/ent/user_query.go +++ b/examples/privacyadmin/ent/user_query.go @@ -454,41 +454,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -502,27 +502,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -530,7 +530,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/privacytenant/ent/group_query.go b/examples/privacytenant/ent/group_query.go index 6766d51dd..5750b56fc 100644 --- a/examples/privacytenant/ent/group_query.go +++ b/examples/privacytenant/ent/group_query.go @@ -639,41 +639,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,27 +687,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -715,7 +715,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/privacytenant/ent/tenant_query.go b/examples/privacytenant/ent/tenant_query.go index 6b1c6e16a..93afb1b34 100644 --- a/examples/privacytenant/ent/tenant_query.go +++ b/examples/privacytenant/ent/tenant_query.go @@ -454,41 +454,41 @@ type TenantGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TenantGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TenantGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TenantQuery, *TenantGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TenantQuery, *TenantGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TenantGroupBy) sqlScan(ctx context.Context, root *TenantQuery, v any) error { +func (_g *TenantGroupBy) sqlScan(ctx context.Context, root *TenantQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -502,27 +502,27 @@ type TenantSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TenantSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TenantSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TenantQuery, *TenantSelect](ctx, ts.TenantQuery, ts, ts.inters, v) + return scanWithInterceptors[*TenantQuery, *TenantSelect](ctx, _s.TenantQuery, _s, _s.inters, v) } -func (ts *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) error { +func (_s *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -530,7 +530,7 @@ func (ts *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/privacytenant/ent/user_query.go b/examples/privacytenant/ent/user_query.go index 463a0991d..a4793cd65 100644 --- a/examples/privacytenant/ent/user_query.go +++ b/examples/privacytenant/ent/user_query.go @@ -639,41 +639,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,27 +687,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -715,7 +715,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/rls/ent/tenant_query.go b/examples/rls/ent/tenant_query.go index c33f63b48..96d2105ae 100644 --- a/examples/rls/ent/tenant_query.go +++ b/examples/rls/ent/tenant_query.go @@ -443,41 +443,41 @@ type TenantGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (tgb *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy { - tgb.fns = append(tgb.fns, fns...) - return tgb +func (_g *TenantGroupBy) Aggregate(fns ...AggregateFunc) *TenantGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (tgb *TenantGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, tgb.build.ctx, ent.OpQueryGroupBy) - if err := tgb.build.prepareQuery(ctx); err != nil { +func (_g *TenantGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TenantQuery, *TenantGroupBy](ctx, tgb.build, tgb, tgb.build.inters, v) + return scanWithInterceptors[*TenantQuery, *TenantGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (tgb *TenantGroupBy) sqlScan(ctx context.Context, root *TenantQuery, v any) error { +func (_g *TenantGroupBy) sqlScan(ctx context.Context, root *TenantQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(tgb.fns)) - for _, fn := range tgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*tgb.flds)+len(tgb.fns)) - for _, f := range *tgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*tgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := tgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type TenantSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ts *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect { - ts.fns = append(ts.fns, fns...) - return ts +func (_s *TenantSelect) Aggregate(fns ...AggregateFunc) *TenantSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ts *TenantSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ts.ctx, ent.OpQuerySelect) - if err := ts.prepareQuery(ctx); err != nil { +func (_s *TenantSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*TenantQuery, *TenantSelect](ctx, ts.TenantQuery, ts, ts.inters, v) + return scanWithInterceptors[*TenantQuery, *TenantSelect](ctx, _s.TenantQuery, _s, _s.inters, v) } -func (ts *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) error { +func (_s *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ts.fns)) - for _, fn := range ts.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ts.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (ts *TenantSelect) sqlScan(ctx context.Context, root *TenantQuery, v any) e } rows := &sql.Rows{} query, args := selector.Query() - if err := ts.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/rls/ent/user_query.go b/examples/rls/ent/user_query.go index b42a22435..ef3b15ffd 100644 --- a/examples/rls/ent/user_query.go +++ b/examples/rls/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/start/ent/car_query.go b/examples/start/ent/car_query.go index 11d5c35d7..106732e4b 100644 --- a/examples/start/ent/car_query.go +++ b/examples/start/ent/car_query.go @@ -534,41 +534,41 @@ type CarGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cgb *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { - cgb.fns = append(cgb.fns, fns...) - return cgb +func (_g *CarGroupBy) Aggregate(fns ...AggregateFunc) *CarGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cgb *CarGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cgb.build.ctx, ent.OpQueryGroupBy) - if err := cgb.build.prepareQuery(ctx); err != nil { +func (_g *CarGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, cgb.build, cgb, cgb.build.inters, v) + return scanWithInterceptors[*CarQuery, *CarGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cgb *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_g *CarGroupBy) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cgb.fns)) - for _, fn := range cgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cgb.flds)+len(cgb.fns)) - for _, f := range *cgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -582,27 +582,27 @@ type CarSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cs *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { - cs.fns = append(cs.fns, fns...) - return cs +func (_s *CarSelect) Aggregate(fns ...AggregateFunc) *CarSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cs *CarSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cs.ctx, ent.OpQuerySelect) - if err := cs.prepareQuery(ctx); err != nil { +func (_s *CarSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CarQuery, *CarSelect](ctx, cs.CarQuery, cs, cs.inters, v) + return scanWithInterceptors[*CarQuery, *CarSelect](ctx, _s.CarQuery, _s, _s.inters, v) } -func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { +func (_s *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cs.fns)) - for _, fn := range cs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -610,7 +610,7 @@ func (cs *CarSelect) sqlScan(ctx context.Context, root *CarQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := cs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/start/ent/group_query.go b/examples/start/ent/group_query.go index 65fe33c50..7a30b6d79 100644 --- a/examples/start/ent/group_query.go +++ b/examples/start/ent/group_query.go @@ -557,41 +557,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -605,27 +605,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -633,7 +633,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/start/ent/user_query.go b/examples/start/ent/user_query.go index 0459cd1cd..a5acb8679 100644 --- a/examples/start/ent/user_query.go +++ b/examples/start/ent/user_query.go @@ -632,41 +632,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -680,27 +680,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -708,7 +708,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/traversal/ent/group_query.go b/examples/traversal/ent/group_query.go index 5c00b0e07..96621ef94 100644 --- a/examples/traversal/ent/group_query.go +++ b/examples/traversal/ent/group_query.go @@ -639,41 +639,41 @@ type GroupGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ggb *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { - ggb.fns = append(ggb.fns, fns...) - return ggb +func (_g *GroupGroupBy) Aggregate(fns ...AggregateFunc) *GroupGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ggb *GroupGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ggb.build.ctx, ent.OpQueryGroupBy) - if err := ggb.build.prepareQuery(ctx); err != nil { +func (_g *GroupGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, ggb.build, ggb, ggb.build.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ggb *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_g *GroupGroupBy) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ggb.fns)) - for _, fn := range ggb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ggb.flds)+len(ggb.fns)) - for _, f := range *ggb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ggb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ggb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,27 +687,27 @@ type GroupSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (gs *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { - gs.fns = append(gs.fns, fns...) - return gs +func (_s *GroupSelect) Aggregate(fns ...AggregateFunc) *GroupSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (gs *GroupSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gs.ctx, ent.OpQuerySelect) - if err := gs.prepareQuery(ctx); err != nil { +func (_s *GroupSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, gs.GroupQuery, gs, gs.inters, v) + return scanWithInterceptors[*GroupQuery, *GroupSelect](ctx, _s.GroupQuery, _s, _s.inters, v) } -func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { +func (_s *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(gs.fns)) - for _, fn := range gs.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*gs.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -715,7 +715,7 @@ func (gs *GroupSelect) sqlScan(ctx context.Context, root *GroupQuery, v any) err } rows := &sql.Rows{} query, args := selector.Query() - if err := gs.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/traversal/ent/pet_query.go b/examples/traversal/ent/pet_query.go index ddcb4fd77..c115281c9 100644 --- a/examples/traversal/ent/pet_query.go +++ b/examples/traversal/ent/pet_query.go @@ -639,41 +639,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -687,27 +687,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -715,7 +715,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/traversal/ent/user_query.go b/examples/traversal/ent/user_query.go index 1cda32c65..fa8b38a9d 100644 --- a/examples/traversal/ent/user_query.go +++ b/examples/traversal/ent/user_query.go @@ -810,41 +810,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -858,27 +858,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -886,7 +886,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/triggers/ent/user_query.go b/examples/triggers/ent/user_query.go index 0b7d163a3..43756e879 100644 --- a/examples/triggers/ent/user_query.go +++ b/examples/triggers/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/triggers/ent/userauditlog_query.go b/examples/triggers/ent/userauditlog_query.go index 084b4bad6..f19c1baff 100644 --- a/examples/triggers/ent/userauditlog_query.go +++ b/examples/triggers/ent/userauditlog_query.go @@ -443,41 +443,41 @@ type UserAuditLogGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ualgb *UserAuditLogGroupBy) Aggregate(fns ...AggregateFunc) *UserAuditLogGroupBy { - ualgb.fns = append(ualgb.fns, fns...) - return ualgb +func (_g *UserAuditLogGroupBy) Aggregate(fns ...AggregateFunc) *UserAuditLogGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ualgb *UserAuditLogGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ualgb.build.ctx, ent.OpQueryGroupBy) - if err := ualgb.build.prepareQuery(ctx); err != nil { +func (_g *UserAuditLogGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserAuditLogQuery, *UserAuditLogGroupBy](ctx, ualgb.build, ualgb, ualgb.build.inters, v) + return scanWithInterceptors[*UserAuditLogQuery, *UserAuditLogGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ualgb *UserAuditLogGroupBy) sqlScan(ctx context.Context, root *UserAuditLogQuery, v any) error { +func (_g *UserAuditLogGroupBy) sqlScan(ctx context.Context, root *UserAuditLogQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ualgb.fns)) - for _, fn := range ualgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ualgb.flds)+len(ualgb.fns)) - for _, f := range *ualgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ualgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ualgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserAuditLogSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (uals *UserAuditLogSelect) Aggregate(fns ...AggregateFunc) *UserAuditLogSelect { - uals.fns = append(uals.fns, fns...) - return uals +func (_s *UserAuditLogSelect) Aggregate(fns ...AggregateFunc) *UserAuditLogSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (uals *UserAuditLogSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, uals.ctx, ent.OpQuerySelect) - if err := uals.prepareQuery(ctx); err != nil { +func (_s *UserAuditLogSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserAuditLogQuery, *UserAuditLogSelect](ctx, uals.UserAuditLogQuery, uals, uals.inters, v) + return scanWithInterceptors[*UserAuditLogQuery, *UserAuditLogSelect](ctx, _s.UserAuditLogQuery, _s, _s.inters, v) } -func (uals *UserAuditLogSelect) sqlScan(ctx context.Context, root *UserAuditLogQuery, v any) error { +func (_s *UserAuditLogSelect) sqlScan(ctx context.Context, root *UserAuditLogQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(uals.fns)) - for _, fn := range uals.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*uals.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (uals *UserAuditLogSelect) sqlScan(ctx context.Context, root *UserAuditLogQ } rows := &sql.Rows{} query, args := selector.Query() - if err := uals.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/version/ent/user_query.go b/examples/version/ent/user_query.go index a818a01ce..a51b89dbf 100644 --- a/examples/version/ent/user_query.go +++ b/examples/version/ent/user_query.go @@ -447,41 +447,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -495,27 +495,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -523,7 +523,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewcomposite/ent/cleanuser_query.go b/examples/viewcomposite/ent/cleanuser_query.go index a9e794b35..959e71150 100644 --- a/examples/viewcomposite/ent/cleanuser_query.go +++ b/examples/viewcomposite/ent/cleanuser_query.go @@ -367,41 +367,41 @@ type CleanUserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cugb *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { - cugb.fns = append(cugb.fns, fns...) - return cugb +func (_g *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cugb *CleanUserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cugb.build.ctx, ent.OpQueryGroupBy) - if err := cugb.build.prepareQuery(ctx); err != nil { +func (_g *CleanUserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, cugb.build, cugb, cugb.build.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cugb *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_g *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cugb.fns)) - for _, fn := range cugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cugb.flds)+len(cugb.fns)) - for _, f := range *cugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -415,27 +415,27 @@ type CleanUserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cus *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { - cus.fns = append(cus.fns, fns...) - return cus +func (_s *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cus *CleanUserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cus.ctx, ent.OpQuerySelect) - if err := cus.prepareQuery(ctx); err != nil { +func (_s *CleanUserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, cus.CleanUserQuery, cus, cus.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, _s.CleanUserQuery, _s, _s.inters, v) } -func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_s *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cus.fns)) - for _, fn := range cus.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cus.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -443,7 +443,7 @@ func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := cus.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewcomposite/ent/pet_query.go b/examples/viewcomposite/ent/pet_query.go index e3fa4957b..52a037972 100644 --- a/examples/viewcomposite/ent/pet_query.go +++ b/examples/viewcomposite/ent/pet_query.go @@ -443,41 +443,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewcomposite/ent/petusername_query.go b/examples/viewcomposite/ent/petusername_query.go index 1fe304843..e951e4fdd 100644 --- a/examples/viewcomposite/ent/petusername_query.go +++ b/examples/viewcomposite/ent/petusername_query.go @@ -367,41 +367,41 @@ type PetUserNameGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pungb *PetUserNameGroupBy) Aggregate(fns ...AggregateFunc) *PetUserNameGroupBy { - pungb.fns = append(pungb.fns, fns...) - return pungb +func (_g *PetUserNameGroupBy) Aggregate(fns ...AggregateFunc) *PetUserNameGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pungb *PetUserNameGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pungb.build.ctx, ent.OpQueryGroupBy) - if err := pungb.build.prepareQuery(ctx); err != nil { +func (_g *PetUserNameGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetUserNameQuery, *PetUserNameGroupBy](ctx, pungb.build, pungb, pungb.build.inters, v) + return scanWithInterceptors[*PetUserNameQuery, *PetUserNameGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pungb *PetUserNameGroupBy) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { +func (_g *PetUserNameGroupBy) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pungb.fns)) - for _, fn := range pungb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pungb.flds)+len(pungb.fns)) - for _, f := range *pungb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pungb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pungb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -415,27 +415,27 @@ type PetUserNameSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (puns *PetUserNameSelect) Aggregate(fns ...AggregateFunc) *PetUserNameSelect { - puns.fns = append(puns.fns, fns...) - return puns +func (_s *PetUserNameSelect) Aggregate(fns ...AggregateFunc) *PetUserNameSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (puns *PetUserNameSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, puns.ctx, ent.OpQuerySelect) - if err := puns.prepareQuery(ctx); err != nil { +func (_s *PetUserNameSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetUserNameQuery, *PetUserNameSelect](ctx, puns.PetUserNameQuery, puns, puns.inters, v) + return scanWithInterceptors[*PetUserNameQuery, *PetUserNameSelect](ctx, _s.PetUserNameQuery, _s, _s.inters, v) } -func (puns *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { +func (_s *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(puns.fns)) - for _, fn := range puns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*puns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -443,7 +443,7 @@ func (puns *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQue } rows := &sql.Rows{} query, args := selector.Query() - if err := puns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewcomposite/ent/user_query.go b/examples/viewcomposite/ent/user_query.go index a9ca7363f..6c552e5ab 100644 --- a/examples/viewcomposite/ent/user_query.go +++ b/examples/viewcomposite/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewschema/ent/cleanuser_query.go b/examples/viewschema/ent/cleanuser_query.go index a7a8cb426..679b49336 100644 --- a/examples/viewschema/ent/cleanuser_query.go +++ b/examples/viewschema/ent/cleanuser_query.go @@ -367,41 +367,41 @@ type CleanUserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (cugb *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { - cugb.fns = append(cugb.fns, fns...) - return cugb +func (_g *CleanUserGroupBy) Aggregate(fns ...AggregateFunc) *CleanUserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (cugb *CleanUserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cugb.build.ctx, ent.OpQueryGroupBy) - if err := cugb.build.prepareQuery(ctx); err != nil { +func (_g *CleanUserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, cugb.build, cugb, cugb.build.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (cugb *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_g *CleanUserGroupBy) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(cugb.fns)) - for _, fn := range cugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*cugb.flds)+len(cugb.fns)) - for _, f := range *cugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*cugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := cugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -415,27 +415,27 @@ type CleanUserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (cus *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { - cus.fns = append(cus.fns, fns...) - return cus +func (_s *CleanUserSelect) Aggregate(fns ...AggregateFunc) *CleanUserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (cus *CleanUserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, cus.ctx, ent.OpQuerySelect) - if err := cus.prepareQuery(ctx); err != nil { +func (_s *CleanUserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, cus.CleanUserQuery, cus, cus.inters, v) + return scanWithInterceptors[*CleanUserQuery, *CleanUserSelect](ctx, _s.CleanUserQuery, _s, _s.inters, v) } -func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { +func (_s *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(cus.fns)) - for _, fn := range cus.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*cus.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -443,7 +443,7 @@ func (cus *CleanUserSelect) sqlScan(ctx context.Context, root *CleanUserQuery, v } rows := &sql.Rows{} query, args := selector.Query() - if err := cus.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewschema/ent/pet_query.go b/examples/viewschema/ent/pet_query.go index 6439190ea..772e493cc 100644 --- a/examples/viewschema/ent/pet_query.go +++ b/examples/viewschema/ent/pet_query.go @@ -443,41 +443,41 @@ type PetGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pgb *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { - pgb.fns = append(pgb.fns, fns...) - return pgb +func (_g *PetGroupBy) Aggregate(fns ...AggregateFunc) *PetGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pgb *PetGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pgb.build.ctx, ent.OpQueryGroupBy) - if err := pgb.build.prepareQuery(ctx); err != nil { +func (_g *PetGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, pgb.build, pgb, pgb.build.inters, v) + return scanWithInterceptors[*PetQuery, *PetGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pgb *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_g *PetGroupBy) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pgb.fns)) - for _, fn := range pgb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pgb.flds)+len(pgb.fns)) - for _, f := range *pgb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pgb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pgb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type PetSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (ps *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { - ps.fns = append(ps.fns, fns...) - return ps +func (_s *PetSelect) Aggregate(fns ...AggregateFunc) *PetSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (ps *PetSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ps.ctx, ent.OpQuerySelect) - if err := ps.prepareQuery(ctx); err != nil { +func (_s *PetSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetQuery, *PetSelect](ctx, ps.PetQuery, ps, ps.inters, v) + return scanWithInterceptors[*PetQuery, *PetSelect](ctx, _s.PetQuery, _s, _s.inters, v) } -func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { +func (_s *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(ps.fns)) - for _, fn := range ps.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*ps.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (ps *PetSelect) sqlScan(ctx context.Context, root *PetQuery, v any) error { } rows := &sql.Rows{} query, args := selector.Query() - if err := ps.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewschema/ent/petusername_query.go b/examples/viewschema/ent/petusername_query.go index ef8b3bc6b..530160afb 100644 --- a/examples/viewschema/ent/petusername_query.go +++ b/examples/viewschema/ent/petusername_query.go @@ -367,41 +367,41 @@ type PetUserNameGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (pungb *PetUserNameGroupBy) Aggregate(fns ...AggregateFunc) *PetUserNameGroupBy { - pungb.fns = append(pungb.fns, fns...) - return pungb +func (_g *PetUserNameGroupBy) Aggregate(fns ...AggregateFunc) *PetUserNameGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (pungb *PetUserNameGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, pungb.build.ctx, ent.OpQueryGroupBy) - if err := pungb.build.prepareQuery(ctx); err != nil { +func (_g *PetUserNameGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetUserNameQuery, *PetUserNameGroupBy](ctx, pungb.build, pungb, pungb.build.inters, v) + return scanWithInterceptors[*PetUserNameQuery, *PetUserNameGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (pungb *PetUserNameGroupBy) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { +func (_g *PetUserNameGroupBy) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(pungb.fns)) - for _, fn := range pungb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*pungb.flds)+len(pungb.fns)) - for _, f := range *pungb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*pungb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := pungb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -415,27 +415,27 @@ type PetUserNameSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (puns *PetUserNameSelect) Aggregate(fns ...AggregateFunc) *PetUserNameSelect { - puns.fns = append(puns.fns, fns...) - return puns +func (_s *PetUserNameSelect) Aggregate(fns ...AggregateFunc) *PetUserNameSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (puns *PetUserNameSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, puns.ctx, ent.OpQuerySelect) - if err := puns.prepareQuery(ctx); err != nil { +func (_s *PetUserNameSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*PetUserNameQuery, *PetUserNameSelect](ctx, puns.PetUserNameQuery, puns, puns.inters, v) + return scanWithInterceptors[*PetUserNameQuery, *PetUserNameSelect](ctx, _s.PetUserNameQuery, _s, _s.inters, v) } -func (puns *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { +func (_s *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(puns.fns)) - for _, fn := range puns.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*puns.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -443,7 +443,7 @@ func (puns *PetUserNameSelect) sqlScan(ctx context.Context, root *PetUserNameQue } rows := &sql.Rows{} query, args := selector.Query() - if err := puns.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() diff --git a/examples/viewschema/ent/user_query.go b/examples/viewschema/ent/user_query.go index 2eb8eea1e..5b02aa1b6 100644 --- a/examples/viewschema/ent/user_query.go +++ b/examples/viewschema/ent/user_query.go @@ -443,41 +443,41 @@ type UserGroupBy struct { } // Aggregate adds the given aggregation functions to the group-by query. -func (ugb *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { - ugb.fns = append(ugb.fns, fns...) - return ugb +func (_g *UserGroupBy) Aggregate(fns ...AggregateFunc) *UserGroupBy { + _g.fns = append(_g.fns, fns...) + return _g } // Scan applies the selector query and scans the result into the given value. -func (ugb *UserGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ugb.build.ctx, ent.OpQueryGroupBy) - if err := ugb.build.prepareQuery(ctx); err != nil { +func (_g *UserGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _g.build.ctx, ent.OpQueryGroupBy) + if err := _g.build.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, ugb.build, ugb, ugb.build.inters, v) + return scanWithInterceptors[*UserQuery, *UserGroupBy](ctx, _g.build, _g, _g.build.inters, v) } -func (ugb *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_g *UserGroupBy) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(ugb.fns)) - for _, fn := range ugb.fns { + aggregation := make([]string, 0, len(_g.fns)) + for _, fn := range _g.fns { aggregation = append(aggregation, fn(selector)) } if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*ugb.flds)+len(ugb.fns)) - for _, f := range *ugb.flds { + columns := make([]string, 0, len(*_g.flds)+len(_g.fns)) + for _, f := range *_g.flds { columns = append(columns, selector.C(f)) } columns = append(columns, aggregation...) selector.Select(columns...) } - selector.GroupBy(selector.Columns(*ugb.flds...)...) + selector.GroupBy(selector.Columns(*_g.flds...)...) if err := selector.Err(); err != nil { return err } rows := &sql.Rows{} query, args := selector.Query() - if err := ugb.build.driver.Query(ctx, query, args, rows); err != nil { + if err := _g.build.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close() @@ -491,27 +491,27 @@ type UserSelect struct { } // Aggregate adds the given aggregation functions to the selector query. -func (us *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { - us.fns = append(us.fns, fns...) - return us +func (_s *UserSelect) Aggregate(fns ...AggregateFunc) *UserSelect { + _s.fns = append(_s.fns, fns...) + return _s } // Scan applies the selector query and scans the result into the given value. -func (us *UserSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, us.ctx, ent.OpQuerySelect) - if err := us.prepareQuery(ctx); err != nil { +func (_s *UserSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, _s.ctx, ent.OpQuerySelect) + if err := _s.prepareQuery(ctx); err != nil { return err } - return scanWithInterceptors[*UserQuery, *UserSelect](ctx, us.UserQuery, us, us.inters, v) + return scanWithInterceptors[*UserQuery, *UserSelect](ctx, _s.UserQuery, _s, _s.inters, v) } -func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { +func (_s *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error { selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(us.fns)) - for _, fn := range us.fns { + aggregation := make([]string, 0, len(_s.fns)) + for _, fn := range _s.fns { aggregation = append(aggregation, fn(selector)) } - switch n := len(*us.selector.flds); { + switch n := len(*_s.selector.flds); { case n == 0 && len(aggregation) > 0: selector.Select(aggregation...) case n != 0 && len(aggregation) > 0: @@ -519,7 +519,7 @@ func (us *UserSelect) sqlScan(ctx context.Context, root *UserQuery, v any) error } rows := &sql.Rows{} query, args := selector.Query() - if err := us.driver.Query(ctx, query, args, rows); err != nil { + if err := _s.driver.Query(ctx, query, args, rows); err != nil { return err } defer rows.Close()