From d66350ae40830a57792cebf88c2976af2477af1a Mon Sep 17 00:00:00 2001 From: Ariel Mashraki <7413593+a8m@users.noreply.github.com> Date: Tue, 24 Jan 2023 15:10:20 +0200 Subject: [PATCH] entc/gen: add support for DeleteOne with predicates (#3271) Also, fixed a bug in DeleteOne.Exec where it was skipping NotFoundError --- doc/md/crud.mdx | 37 ++++++++++++++++--- entc/gen/template/builder/delete.tmpl | 10 ++++- .../cascadelete/ent/comment_delete.go | 10 ++++- .../cascadelete/ent/post_delete.go | 10 ++++- .../cascadelete/ent/user_delete.go | 10 ++++- entc/integration/config/ent/user_delete.go | 10 ++++- .../customid/ent/account_delete.go | 10 ++++- entc/integration/customid/ent/blob_delete.go | 10 ++++- .../customid/ent/bloblink_delete.go | 10 ++++- entc/integration/customid/ent/car_delete.go | 10 ++++- .../integration/customid/ent/device_delete.go | 10 ++++- entc/integration/customid/ent/doc_delete.go | 10 ++++- entc/integration/customid/ent/group_delete.go | 10 ++++- .../integration/customid/ent/intsid_delete.go | 10 ++++- entc/integration/customid/ent/link_delete.go | 10 ++++- .../customid/ent/mixinid_delete.go | 10 ++++- entc/integration/customid/ent/note_delete.go | 10 ++++- entc/integration/customid/ent/other_delete.go | 10 ++++- entc/integration/customid/ent/pet_delete.go | 10 ++++- .../customid/ent/revision_delete.go | 10 ++++- .../customid/ent/session_delete.go | 10 ++++- entc/integration/customid/ent/token_delete.go | 10 ++++- entc/integration/customid/ent/user_delete.go | 10 ++++- entc/integration/edgefield/ent/car_delete.go | 10 ++++- entc/integration/edgefield/ent/card_delete.go | 10 ++++- entc/integration/edgefield/ent/info_delete.go | 10 ++++- .../edgefield/ent/metadata_delete.go | 10 ++++- entc/integration/edgefield/ent/node_delete.go | 10 ++++- entc/integration/edgefield/ent/pet_delete.go | 10 ++++- entc/integration/edgefield/ent/post_delete.go | 10 ++++- .../edgefield/ent/rental_delete.go | 10 ++++- entc/integration/edgefield/ent/user_delete.go | 10 ++++- .../edgeschema/ent/friendship_delete.go | 10 ++++- .../edgeschema/ent/group_delete.go | 10 ++++- .../edgeschema/ent/grouptag_delete.go | 10 ++++- .../edgeschema/ent/relationship_delete.go | 10 ++++- .../edgeschema/ent/relationshipinfo_delete.go | 10 ++++- .../integration/edgeschema/ent/role_delete.go | 10 ++++- .../edgeschema/ent/roleuser_delete.go | 10 ++++- entc/integration/edgeschema/ent/tag_delete.go | 10 ++++- .../edgeschema/ent/tweet_delete.go | 10 ++++- .../edgeschema/ent/tweetlike_delete.go | 10 ++++- .../edgeschema/ent/tweettag_delete.go | 10 ++++- .../integration/edgeschema/ent/user_delete.go | 10 ++++- .../edgeschema/ent/usergroup_delete.go | 10 ++++- .../edgeschema/ent/usertweet_delete.go | 10 ++++- entc/integration/ent/api_delete.go | 10 ++++- entc/integration/ent/card_delete.go | 10 ++++- entc/integration/ent/comment_delete.go | 10 ++++- entc/integration/ent/fieldtype_delete.go | 10 ++++- entc/integration/ent/file_delete.go | 10 ++++- entc/integration/ent/filetype_delete.go | 10 ++++- entc/integration/ent/goods_delete.go | 10 ++++- entc/integration/ent/group_delete.go | 10 ++++- entc/integration/ent/groupinfo_delete.go | 10 ++++- entc/integration/ent/item_delete.go | 10 ++++- entc/integration/ent/license_delete.go | 10 ++++- entc/integration/ent/node_delete.go | 10 ++++- entc/integration/ent/pet_delete.go | 10 ++++- entc/integration/ent/spec_delete.go | 10 ++++- entc/integration/ent/task_delete.go | 10 ++++- entc/integration/ent/user_delete.go | 10 ++++- entc/integration/gremlin/ent/api_delete.go | 10 ++++- entc/integration/gremlin/ent/card_delete.go | 10 ++++- .../integration/gremlin/ent/comment_delete.go | 10 ++++- .../gremlin/ent/fieldtype_delete.go | 10 ++++- entc/integration/gremlin/ent/file_delete.go | 10 ++++- .../gremlin/ent/filetype_delete.go | 10 ++++- entc/integration/gremlin/ent/goods_delete.go | 10 ++++- entc/integration/gremlin/ent/group_delete.go | 10 ++++- .../gremlin/ent/groupinfo_delete.go | 10 ++++- entc/integration/gremlin/ent/item_delete.go | 10 ++++- .../integration/gremlin/ent/license_delete.go | 10 ++++- entc/integration/gremlin/ent/node_delete.go | 10 ++++- entc/integration/gremlin/ent/pet_delete.go | 10 ++++- entc/integration/gremlin/ent/spec_delete.go | 10 ++++- entc/integration/gremlin/ent/task_delete.go | 10 ++++- entc/integration/gremlin/ent/user_delete.go | 10 ++++- entc/integration/hooks/ent/card_delete.go | 10 ++++- entc/integration/hooks/ent/pet_delete.go | 10 ++++- entc/integration/hooks/ent/user_delete.go | 10 ++++- entc/integration/idtype/ent/user_delete.go | 10 ++++- entc/integration/integration_test.go | 21 ++++++++++- entc/integration/json/ent/user_delete.go | 10 ++++- entc/integration/migrate/entv1/car_delete.go | 10 ++++- .../migrate/entv1/conversion_delete.go | 10 ++++- .../migrate/entv1/customtype_delete.go | 10 ++++- entc/integration/migrate/entv1/user_delete.go | 10 ++++- entc/integration/migrate/entv2/blog_delete.go | 10 ++++- entc/integration/migrate/entv2/car_delete.go | 10 ++++- .../migrate/entv2/conversion_delete.go | 10 ++++- .../migrate/entv2/customtype_delete.go | 10 ++++- .../integration/migrate/entv2/group_delete.go | 10 ++++- .../integration/migrate/entv2/media_delete.go | 10 ++++- entc/integration/migrate/entv2/pet_delete.go | 10 ++++- entc/integration/migrate/entv2/user_delete.go | 10 ++++- entc/integration/migrate/entv2/zoo_delete.go | 10 ++++- .../migrate/versioned/group_delete.go | 10 ++++- .../migrate/versioned/user_delete.go | 10 ++++- .../multischema/ent/friendship_delete.go | 10 ++++- .../multischema/ent/group_delete.go | 10 ++++- .../integration/multischema/ent/pet_delete.go | 10 ++++- .../multischema/ent/user_delete.go | 10 ++++- entc/integration/privacy/ent/task_delete.go | 10 ++++- entc/integration/privacy/ent/team_delete.go | 10 ++++- entc/integration/privacy/ent/user_delete.go | 10 ++++- entc/integration/template/ent/group_delete.go | 10 ++++- entc/integration/template/ent/pet_delete.go | 10 ++++- entc/integration/template/ent/user_delete.go | 10 ++++- examples/edgeindex/ent/city_delete.go | 10 ++++- examples/edgeindex/ent/street_delete.go | 10 ++++- examples/encryptfield/ent/user_delete.go | 10 ++++- examples/entcpkg/ent/user_delete.go | 10 ++++- examples/fs/ent/file_delete.go | 10 ++++- examples/jsonencode/ent/card_delete.go | 10 ++++- examples/jsonencode/ent/pet_delete.go | 10 ++++- examples/jsonencode/ent/user_delete.go | 10 ++++- examples/m2m2types/ent/group_delete.go | 10 ++++- examples/m2m2types/ent/user_delete.go | 10 ++++- examples/m2mbidi/ent/user_delete.go | 10 ++++- examples/m2mrecur/ent/user_delete.go | 10 ++++- examples/migration/ent/card_delete.go | 10 ++++- examples/migration/ent/pet_delete.go | 10 ++++- examples/migration/ent/user_delete.go | 10 ++++- examples/o2m2types/ent/pet_delete.go | 10 ++++- examples/o2m2types/ent/user_delete.go | 10 ++++- examples/o2mrecur/ent/node_delete.go | 10 ++++- examples/o2o2types/ent/card_delete.go | 10 ++++- examples/o2o2types/ent/user_delete.go | 10 ++++- examples/o2obidi/ent/user_delete.go | 10 ++++- examples/o2orecur/ent/node_delete.go | 10 ++++- examples/privacyadmin/ent/user_delete.go | 10 ++++- examples/privacytenant/ent/group_delete.go | 10 ++++- examples/privacytenant/ent/tenant_delete.go | 10 ++++- examples/privacytenant/ent/user_delete.go | 10 ++++- examples/privacytenant/example_test.go | 7 +++- examples/start/ent/car_delete.go | 10 ++++- examples/start/ent/group_delete.go | 10 ++++- examples/start/ent/user_delete.go | 10 ++++- examples/traversal/ent/group_delete.go | 10 ++++- examples/traversal/ent/pet_delete.go | 10 ++++- examples/traversal/ent/user_delete.go | 10 ++++- examples/version/ent/user_delete.go | 10 ++++- 143 files changed, 1316 insertions(+), 149 deletions(-) diff --git a/doc/md/crud.mdx b/doc/md/crud.mdx index a1982c9d7..f58fd0c39 100644 --- a/doc/md/crud.mdx +++ b/doc/md/crud.mdx @@ -109,7 +109,6 @@ func main() { ``` - ```go @@ -452,7 +451,7 @@ pedro, err := client.Pet. ## Delete One -Delete an entity. +Delete an entity: ```go err := client.User. @@ -460,7 +459,7 @@ err := client.User. Exec(ctx) ``` -Delete by ID. +Delete by ID: ```go err := client.User. @@ -468,12 +467,38 @@ err := client.User. Exec(ctx) ``` -## Delete Many +#### Delete One With Condition -Delete using predicates. +In some projects, the "delete many" operation is not allowed and is blocked using hooks. However, there is still a need +to delete a single entity by its ID while ensuring it meets a specific condition. In this case, you can use the `Where` +option as follows: ```go -_, err := client.File. +err := client.Todo. + DeleteOneID(id). + Where( + // Allow deleting only expired todos. + todo.ExpireLT(time.Now()), + ). + Exec(ctx) +switch { +// If the entity does not meet a specific condition, +// the operation will return an "ent.NotFoundError". +case ent.IsNotFound(err): + fmt.Println("todo item was not found") +// Any other error. +case err != nil: + fmt.Println("deletion error:", err) +} +``` + + +## Delete Many + +Delete using predicates: + +```go +affected, err := client.File. Delete(). Where(file.UpdatedAtLT(date)). Exec(ctx) diff --git a/entc/gen/template/builder/delete.tmpl b/entc/gen/template/builder/delete.tmpl index 0972a4104..42edba80a 100644 --- a/entc/gen/template/builder/delete.tmpl +++ b/entc/gen/template/builder/delete.tmpl @@ -69,6 +69,12 @@ type {{ $onebuilder }} struct { {{ $receiver }} *{{ $builder }} } +// Where appends a list predicates to the {{ $builder }} builder. +func ({{ $oneReceiver }} *{{ $onebuilder }}) Where(ps ...predicate.{{ $.Name }}) *{{ $onebuilder }} { + {{ $oneReceiver }}.{{ $mutation }}.Where(ps...) + return {{ $oneReceiver }} +} + // Exec executes the deletion query. func ({{ $oneReceiver }} *{{ $onebuilder }}) Exec(ctx context.Context) error { n, err := {{ $oneReceiver }}.{{ $receiver }}.Exec(ctx) @@ -84,7 +90,9 @@ func ({{ $oneReceiver }} *{{ $onebuilder }}) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func ({{ $oneReceiver }} *{{ $onebuilder }}) ExecX(ctx context.Context) { - {{ $oneReceiver }}.{{ $receiver }}.ExecX(ctx) + if err := {{ $oneReceiver }}.Exec(ctx); err != nil { + panic(err) + } } {{ end }} diff --git a/entc/integration/cascadelete/ent/comment_delete.go b/entc/integration/cascadelete/ent/comment_delete.go index 7445f7c3e..bc54ea2f1 100644 --- a/entc/integration/cascadelete/ent/comment_delete.go +++ b/entc/integration/cascadelete/ent/comment_delete.go @@ -73,6 +73,12 @@ type CommentDeleteOne struct { cd *CommentDelete } +// Where appends a list predicates to the CommentDelete builder. +func (cdo *CommentDeleteOne) Where(ps ...predicate.Comment) *CommentDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CommentDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/cascadelete/ent/post_delete.go b/entc/integration/cascadelete/ent/post_delete.go index 55ca13fed..e887db706 100644 --- a/entc/integration/cascadelete/ent/post_delete.go +++ b/entc/integration/cascadelete/ent/post_delete.go @@ -73,6 +73,12 @@ type PostDeleteOne struct { pd *PostDelete } +// Where appends a list predicates to the PostDelete builder. +func (pdo *PostDeleteOne) Where(ps ...predicate.Post) *PostDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PostDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PostDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PostDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/cascadelete/ent/user_delete.go b/entc/integration/cascadelete/ent/user_delete.go index bb84605cb..7f86708a8 100644 --- a/entc/integration/cascadelete/ent/user_delete.go +++ b/entc/integration/cascadelete/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/config/ent/user_delete.go b/entc/integration/config/ent/user_delete.go index 15838680f..a2ad9e754 100644 --- a/entc/integration/config/ent/user_delete.go +++ b/entc/integration/config/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/account_delete.go b/entc/integration/customid/ent/account_delete.go index 85c77c193..0f3926007 100644 --- a/entc/integration/customid/ent/account_delete.go +++ b/entc/integration/customid/ent/account_delete.go @@ -73,6 +73,12 @@ type AccountDeleteOne struct { ad *AccountDelete } +// Where appends a list predicates to the AccountDelete builder. +func (ado *AccountDeleteOne) Where(ps ...predicate.Account) *AccountDeleteOne { + ado.ad.mutation.Where(ps...) + return ado +} + // Exec executes the deletion query. func (ado *AccountDeleteOne) Exec(ctx context.Context) error { n, err := ado.ad.Exec(ctx) @@ -88,5 +94,7 @@ func (ado *AccountDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ado *AccountDeleteOne) ExecX(ctx context.Context) { - ado.ad.ExecX(ctx) + if err := ado.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/blob_delete.go b/entc/integration/customid/ent/blob_delete.go index 19fb58ce1..b2e0a13f0 100644 --- a/entc/integration/customid/ent/blob_delete.go +++ b/entc/integration/customid/ent/blob_delete.go @@ -73,6 +73,12 @@ type BlobDeleteOne struct { bd *BlobDelete } +// Where appends a list predicates to the BlobDelete builder. +func (bdo *BlobDeleteOne) Where(ps ...predicate.Blob) *BlobDeleteOne { + bdo.bd.mutation.Where(ps...) + return bdo +} + // Exec executes the deletion query. func (bdo *BlobDeleteOne) Exec(ctx context.Context) error { n, err := bdo.bd.Exec(ctx) @@ -88,5 +94,7 @@ func (bdo *BlobDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (bdo *BlobDeleteOne) ExecX(ctx context.Context) { - bdo.bd.ExecX(ctx) + if err := bdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/bloblink_delete.go b/entc/integration/customid/ent/bloblink_delete.go index d3071d14e..0916d17ac 100644 --- a/entc/integration/customid/ent/bloblink_delete.go +++ b/entc/integration/customid/ent/bloblink_delete.go @@ -68,6 +68,12 @@ type BlobLinkDeleteOne struct { bld *BlobLinkDelete } +// Where appends a list predicates to the BlobLinkDelete builder. +func (bldo *BlobLinkDeleteOne) Where(ps ...predicate.BlobLink) *BlobLinkDeleteOne { + bldo.bld.mutation.Where(ps...) + return bldo +} + // Exec executes the deletion query. func (bldo *BlobLinkDeleteOne) Exec(ctx context.Context) error { n, err := bldo.bld.Exec(ctx) @@ -83,5 +89,7 @@ func (bldo *BlobLinkDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (bldo *BlobLinkDeleteOne) ExecX(ctx context.Context) { - bldo.bld.ExecX(ctx) + if err := bldo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/car_delete.go b/entc/integration/customid/ent/car_delete.go index 3f636f5c8..7e087ec27 100644 --- a/entc/integration/customid/ent/car_delete.go +++ b/entc/integration/customid/ent/car_delete.go @@ -73,6 +73,12 @@ type CarDeleteOne struct { cd *CarDelete } +// Where appends a list predicates to the CarDelete builder. +func (cdo *CarDeleteOne) Where(ps ...predicate.Car) *CarDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CarDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CarDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CarDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/device_delete.go b/entc/integration/customid/ent/device_delete.go index ca5507960..4230b65a9 100644 --- a/entc/integration/customid/ent/device_delete.go +++ b/entc/integration/customid/ent/device_delete.go @@ -73,6 +73,12 @@ type DeviceDeleteOne struct { dd *DeviceDelete } +// Where appends a list predicates to the DeviceDelete builder. +func (ddo *DeviceDeleteOne) Where(ps ...predicate.Device) *DeviceDeleteOne { + ddo.dd.mutation.Where(ps...) + return ddo +} + // Exec executes the deletion query. func (ddo *DeviceDeleteOne) Exec(ctx context.Context) error { n, err := ddo.dd.Exec(ctx) @@ -88,5 +94,7 @@ func (ddo *DeviceDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ddo *DeviceDeleteOne) ExecX(ctx context.Context) { - ddo.dd.ExecX(ctx) + if err := ddo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/doc_delete.go b/entc/integration/customid/ent/doc_delete.go index 347195ecc..0e7a2e0e3 100644 --- a/entc/integration/customid/ent/doc_delete.go +++ b/entc/integration/customid/ent/doc_delete.go @@ -73,6 +73,12 @@ type DocDeleteOne struct { dd *DocDelete } +// Where appends a list predicates to the DocDelete builder. +func (ddo *DocDeleteOne) Where(ps ...predicate.Doc) *DocDeleteOne { + ddo.dd.mutation.Where(ps...) + return ddo +} + // Exec executes the deletion query. func (ddo *DocDeleteOne) Exec(ctx context.Context) error { n, err := ddo.dd.Exec(ctx) @@ -88,5 +94,7 @@ func (ddo *DocDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ddo *DocDeleteOne) ExecX(ctx context.Context) { - ddo.dd.ExecX(ctx) + if err := ddo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/group_delete.go b/entc/integration/customid/ent/group_delete.go index be5018c5f..a5f7267ff 100644 --- a/entc/integration/customid/ent/group_delete.go +++ b/entc/integration/customid/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/intsid_delete.go b/entc/integration/customid/ent/intsid_delete.go index 9e94f8676..7d82ed720 100644 --- a/entc/integration/customid/ent/intsid_delete.go +++ b/entc/integration/customid/ent/intsid_delete.go @@ -73,6 +73,12 @@ type IntSIDDeleteOne struct { isd *IntSIDDelete } +// Where appends a list predicates to the IntSIDDelete builder. +func (isdo *IntSIDDeleteOne) Where(ps ...predicate.IntSID) *IntSIDDeleteOne { + isdo.isd.mutation.Where(ps...) + return isdo +} + // Exec executes the deletion query. func (isdo *IntSIDDeleteOne) Exec(ctx context.Context) error { n, err := isdo.isd.Exec(ctx) @@ -88,5 +94,7 @@ func (isdo *IntSIDDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (isdo *IntSIDDeleteOne) ExecX(ctx context.Context) { - isdo.isd.ExecX(ctx) + if err := isdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/link_delete.go b/entc/integration/customid/ent/link_delete.go index 0b31ab2db..ee7d13e10 100644 --- a/entc/integration/customid/ent/link_delete.go +++ b/entc/integration/customid/ent/link_delete.go @@ -73,6 +73,12 @@ type LinkDeleteOne struct { ld *LinkDelete } +// Where appends a list predicates to the LinkDelete builder. +func (ldo *LinkDeleteOne) Where(ps ...predicate.Link) *LinkDeleteOne { + ldo.ld.mutation.Where(ps...) + return ldo +} + // Exec executes the deletion query. func (ldo *LinkDeleteOne) Exec(ctx context.Context) error { n, err := ldo.ld.Exec(ctx) @@ -88,5 +94,7 @@ func (ldo *LinkDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ldo *LinkDeleteOne) ExecX(ctx context.Context) { - ldo.ld.ExecX(ctx) + if err := ldo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/mixinid_delete.go b/entc/integration/customid/ent/mixinid_delete.go index 7bfd5b4c2..1d1341b88 100644 --- a/entc/integration/customid/ent/mixinid_delete.go +++ b/entc/integration/customid/ent/mixinid_delete.go @@ -73,6 +73,12 @@ type MixinIDDeleteOne struct { mid *MixinIDDelete } +// Where appends a list predicates to the MixinIDDelete builder. +func (mido *MixinIDDeleteOne) Where(ps ...predicate.MixinID) *MixinIDDeleteOne { + mido.mid.mutation.Where(ps...) + return mido +} + // Exec executes the deletion query. func (mido *MixinIDDeleteOne) Exec(ctx context.Context) error { n, err := mido.mid.Exec(ctx) @@ -88,5 +94,7 @@ func (mido *MixinIDDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (mido *MixinIDDeleteOne) ExecX(ctx context.Context) { - mido.mid.ExecX(ctx) + if err := mido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/note_delete.go b/entc/integration/customid/ent/note_delete.go index 6822440d7..d77b846a8 100644 --- a/entc/integration/customid/ent/note_delete.go +++ b/entc/integration/customid/ent/note_delete.go @@ -73,6 +73,12 @@ type NoteDeleteOne struct { nd *NoteDelete } +// Where appends a list predicates to the NoteDelete builder. +func (ndo *NoteDeleteOne) Where(ps ...predicate.Note) *NoteDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NoteDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -88,5 +94,7 @@ func (ndo *NoteDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NoteDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/other_delete.go b/entc/integration/customid/ent/other_delete.go index da19a9f92..23e7b9dfd 100644 --- a/entc/integration/customid/ent/other_delete.go +++ b/entc/integration/customid/ent/other_delete.go @@ -73,6 +73,12 @@ type OtherDeleteOne struct { od *OtherDelete } +// Where appends a list predicates to the OtherDelete builder. +func (odo *OtherDeleteOne) Where(ps ...predicate.Other) *OtherDeleteOne { + odo.od.mutation.Where(ps...) + return odo +} + // Exec executes the deletion query. func (odo *OtherDeleteOne) Exec(ctx context.Context) error { n, err := odo.od.Exec(ctx) @@ -88,5 +94,7 @@ func (odo *OtherDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (odo *OtherDeleteOne) ExecX(ctx context.Context) { - odo.od.ExecX(ctx) + if err := odo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/pet_delete.go b/entc/integration/customid/ent/pet_delete.go index 9b724bfa2..5debc24fc 100644 --- a/entc/integration/customid/ent/pet_delete.go +++ b/entc/integration/customid/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/revision_delete.go b/entc/integration/customid/ent/revision_delete.go index f193ebdeb..354ae1cdd 100644 --- a/entc/integration/customid/ent/revision_delete.go +++ b/entc/integration/customid/ent/revision_delete.go @@ -73,6 +73,12 @@ type RevisionDeleteOne struct { rd *RevisionDelete } +// Where appends a list predicates to the RevisionDelete builder. +func (rdo *RevisionDeleteOne) Where(ps ...predicate.Revision) *RevisionDeleteOne { + rdo.rd.mutation.Where(ps...) + return rdo +} + // Exec executes the deletion query. func (rdo *RevisionDeleteOne) Exec(ctx context.Context) error { n, err := rdo.rd.Exec(ctx) @@ -88,5 +94,7 @@ func (rdo *RevisionDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rdo *RevisionDeleteOne) ExecX(ctx context.Context) { - rdo.rd.ExecX(ctx) + if err := rdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/session_delete.go b/entc/integration/customid/ent/session_delete.go index 9e7167507..edff42c5f 100644 --- a/entc/integration/customid/ent/session_delete.go +++ b/entc/integration/customid/ent/session_delete.go @@ -73,6 +73,12 @@ type SessionDeleteOne struct { sd *SessionDelete } +// Where appends a list predicates to the SessionDelete builder. +func (sdo *SessionDeleteOne) Where(ps ...predicate.Session) *SessionDeleteOne { + sdo.sd.mutation.Where(ps...) + return sdo +} + // Exec executes the deletion query. func (sdo *SessionDeleteOne) Exec(ctx context.Context) error { n, err := sdo.sd.Exec(ctx) @@ -88,5 +94,7 @@ func (sdo *SessionDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (sdo *SessionDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) + if err := sdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/token_delete.go b/entc/integration/customid/ent/token_delete.go index 5a7b2aca0..4b0ec9c3e 100644 --- a/entc/integration/customid/ent/token_delete.go +++ b/entc/integration/customid/ent/token_delete.go @@ -73,6 +73,12 @@ type TokenDeleteOne struct { td *TokenDelete } +// Where appends a list predicates to the TokenDelete builder. +func (tdo *TokenDeleteOne) Where(ps ...predicate.Token) *TokenDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TokenDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TokenDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TokenDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/customid/ent/user_delete.go b/entc/integration/customid/ent/user_delete.go index 4c37a6832..764396c4f 100644 --- a/entc/integration/customid/ent/user_delete.go +++ b/entc/integration/customid/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/car_delete.go b/entc/integration/edgefield/ent/car_delete.go index a2f53d004..a007db836 100644 --- a/entc/integration/edgefield/ent/car_delete.go +++ b/entc/integration/edgefield/ent/car_delete.go @@ -73,6 +73,12 @@ type CarDeleteOne struct { cd *CarDelete } +// Where appends a list predicates to the CarDelete builder. +func (cdo *CarDeleteOne) Where(ps ...predicate.Car) *CarDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CarDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CarDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CarDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/card_delete.go b/entc/integration/edgefield/ent/card_delete.go index d17989b73..531affdcc 100644 --- a/entc/integration/edgefield/ent/card_delete.go +++ b/entc/integration/edgefield/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/info_delete.go b/entc/integration/edgefield/ent/info_delete.go index 36a9d148b..4379ee51a 100644 --- a/entc/integration/edgefield/ent/info_delete.go +++ b/entc/integration/edgefield/ent/info_delete.go @@ -73,6 +73,12 @@ type InfoDeleteOne struct { id *InfoDelete } +// Where appends a list predicates to the InfoDelete builder. +func (ido *InfoDeleteOne) Where(ps ...predicate.Info) *InfoDeleteOne { + ido.id.mutation.Where(ps...) + return ido +} + // Exec executes the deletion query. func (ido *InfoDeleteOne) Exec(ctx context.Context) error { n, err := ido.id.Exec(ctx) @@ -88,5 +94,7 @@ func (ido *InfoDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ido *InfoDeleteOne) ExecX(ctx context.Context) { - ido.id.ExecX(ctx) + if err := ido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/metadata_delete.go b/entc/integration/edgefield/ent/metadata_delete.go index f240db03d..c4ebcc86d 100644 --- a/entc/integration/edgefield/ent/metadata_delete.go +++ b/entc/integration/edgefield/ent/metadata_delete.go @@ -73,6 +73,12 @@ type MetadataDeleteOne struct { md *MetadataDelete } +// Where appends a list predicates to the MetadataDelete builder. +func (mdo *MetadataDeleteOne) Where(ps ...predicate.Metadata) *MetadataDeleteOne { + mdo.md.mutation.Where(ps...) + return mdo +} + // Exec executes the deletion query. func (mdo *MetadataDeleteOne) Exec(ctx context.Context) error { n, err := mdo.md.Exec(ctx) @@ -88,5 +94,7 @@ func (mdo *MetadataDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (mdo *MetadataDeleteOne) ExecX(ctx context.Context) { - mdo.md.ExecX(ctx) + if err := mdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/node_delete.go b/entc/integration/edgefield/ent/node_delete.go index 154fdfb4f..19b56160d 100644 --- a/entc/integration/edgefield/ent/node_delete.go +++ b/entc/integration/edgefield/ent/node_delete.go @@ -73,6 +73,12 @@ type NodeDeleteOne struct { nd *NodeDelete } +// Where appends a list predicates to the NodeDelete builder. +func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -88,5 +94,7 @@ func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NodeDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/pet_delete.go b/entc/integration/edgefield/ent/pet_delete.go index d244112c7..f20a6b468 100644 --- a/entc/integration/edgefield/ent/pet_delete.go +++ b/entc/integration/edgefield/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/post_delete.go b/entc/integration/edgefield/ent/post_delete.go index a72616a36..c6ec9bc2c 100644 --- a/entc/integration/edgefield/ent/post_delete.go +++ b/entc/integration/edgefield/ent/post_delete.go @@ -73,6 +73,12 @@ type PostDeleteOne struct { pd *PostDelete } +// Where appends a list predicates to the PostDelete builder. +func (pdo *PostDeleteOne) Where(ps ...predicate.Post) *PostDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PostDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PostDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PostDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/rental_delete.go b/entc/integration/edgefield/ent/rental_delete.go index 6d5e0ea6f..84bb33927 100644 --- a/entc/integration/edgefield/ent/rental_delete.go +++ b/entc/integration/edgefield/ent/rental_delete.go @@ -73,6 +73,12 @@ type RentalDeleteOne struct { rd *RentalDelete } +// Where appends a list predicates to the RentalDelete builder. +func (rdo *RentalDeleteOne) Where(ps ...predicate.Rental) *RentalDeleteOne { + rdo.rd.mutation.Where(ps...) + return rdo +} + // Exec executes the deletion query. func (rdo *RentalDeleteOne) Exec(ctx context.Context) error { n, err := rdo.rd.Exec(ctx) @@ -88,5 +94,7 @@ func (rdo *RentalDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rdo *RentalDeleteOne) ExecX(ctx context.Context) { - rdo.rd.ExecX(ctx) + if err := rdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgefield/ent/user_delete.go b/entc/integration/edgefield/ent/user_delete.go index 3a5ed5ae7..ca9414dcc 100644 --- a/entc/integration/edgefield/ent/user_delete.go +++ b/entc/integration/edgefield/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/friendship_delete.go b/entc/integration/edgeschema/ent/friendship_delete.go index 7f62d4e63..7363f05f3 100644 --- a/entc/integration/edgeschema/ent/friendship_delete.go +++ b/entc/integration/edgeschema/ent/friendship_delete.go @@ -73,6 +73,12 @@ type FriendshipDeleteOne struct { fd *FriendshipDelete } +// Where appends a list predicates to the FriendshipDelete builder. +func (fdo *FriendshipDeleteOne) Where(ps ...predicate.Friendship) *FriendshipDeleteOne { + fdo.fd.mutation.Where(ps...) + return fdo +} + // Exec executes the deletion query. func (fdo *FriendshipDeleteOne) Exec(ctx context.Context) error { n, err := fdo.fd.Exec(ctx) @@ -88,5 +94,7 @@ func (fdo *FriendshipDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (fdo *FriendshipDeleteOne) ExecX(ctx context.Context) { - fdo.fd.ExecX(ctx) + if err := fdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/group_delete.go b/entc/integration/edgeschema/ent/group_delete.go index 4382d70a4..e9a08c729 100644 --- a/entc/integration/edgeschema/ent/group_delete.go +++ b/entc/integration/edgeschema/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/grouptag_delete.go b/entc/integration/edgeschema/ent/grouptag_delete.go index 01bdb7330..f2c1a75d2 100644 --- a/entc/integration/edgeschema/ent/grouptag_delete.go +++ b/entc/integration/edgeschema/ent/grouptag_delete.go @@ -73,6 +73,12 @@ type GroupTagDeleteOne struct { gtd *GroupTagDelete } +// Where appends a list predicates to the GroupTagDelete builder. +func (gtdo *GroupTagDeleteOne) Where(ps ...predicate.GroupTag) *GroupTagDeleteOne { + gtdo.gtd.mutation.Where(ps...) + return gtdo +} + // Exec executes the deletion query. func (gtdo *GroupTagDeleteOne) Exec(ctx context.Context) error { n, err := gtdo.gtd.Exec(ctx) @@ -88,5 +94,7 @@ func (gtdo *GroupTagDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gtdo *GroupTagDeleteOne) ExecX(ctx context.Context) { - gtdo.gtd.ExecX(ctx) + if err := gtdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/relationship_delete.go b/entc/integration/edgeschema/ent/relationship_delete.go index 0252e036c..8e6e770b9 100644 --- a/entc/integration/edgeschema/ent/relationship_delete.go +++ b/entc/integration/edgeschema/ent/relationship_delete.go @@ -68,6 +68,12 @@ type RelationshipDeleteOne struct { rd *RelationshipDelete } +// Where appends a list predicates to the RelationshipDelete builder. +func (rdo *RelationshipDeleteOne) Where(ps ...predicate.Relationship) *RelationshipDeleteOne { + rdo.rd.mutation.Where(ps...) + return rdo +} + // Exec executes the deletion query. func (rdo *RelationshipDeleteOne) Exec(ctx context.Context) error { n, err := rdo.rd.Exec(ctx) @@ -83,5 +89,7 @@ func (rdo *RelationshipDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rdo *RelationshipDeleteOne) ExecX(ctx context.Context) { - rdo.rd.ExecX(ctx) + if err := rdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/relationshipinfo_delete.go b/entc/integration/edgeschema/ent/relationshipinfo_delete.go index 120f60a23..da2281982 100644 --- a/entc/integration/edgeschema/ent/relationshipinfo_delete.go +++ b/entc/integration/edgeschema/ent/relationshipinfo_delete.go @@ -73,6 +73,12 @@ type RelationshipInfoDeleteOne struct { rid *RelationshipInfoDelete } +// Where appends a list predicates to the RelationshipInfoDelete builder. +func (rido *RelationshipInfoDeleteOne) Where(ps ...predicate.RelationshipInfo) *RelationshipInfoDeleteOne { + rido.rid.mutation.Where(ps...) + return rido +} + // Exec executes the deletion query. func (rido *RelationshipInfoDeleteOne) Exec(ctx context.Context) error { n, err := rido.rid.Exec(ctx) @@ -88,5 +94,7 @@ func (rido *RelationshipInfoDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rido *RelationshipInfoDeleteOne) ExecX(ctx context.Context) { - rido.rid.ExecX(ctx) + if err := rido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/role_delete.go b/entc/integration/edgeschema/ent/role_delete.go index 4aac07ef0..60e5aba02 100644 --- a/entc/integration/edgeschema/ent/role_delete.go +++ b/entc/integration/edgeschema/ent/role_delete.go @@ -73,6 +73,12 @@ type RoleDeleteOne struct { rd *RoleDelete } +// Where appends a list predicates to the RoleDelete builder. +func (rdo *RoleDeleteOne) Where(ps ...predicate.Role) *RoleDeleteOne { + rdo.rd.mutation.Where(ps...) + return rdo +} + // Exec executes the deletion query. func (rdo *RoleDeleteOne) Exec(ctx context.Context) error { n, err := rdo.rd.Exec(ctx) @@ -88,5 +94,7 @@ func (rdo *RoleDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rdo *RoleDeleteOne) ExecX(ctx context.Context) { - rdo.rd.ExecX(ctx) + if err := rdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/roleuser_delete.go b/entc/integration/edgeschema/ent/roleuser_delete.go index 9b70b28d4..d3f4a40eb 100644 --- a/entc/integration/edgeschema/ent/roleuser_delete.go +++ b/entc/integration/edgeschema/ent/roleuser_delete.go @@ -68,6 +68,12 @@ type RoleUserDeleteOne struct { rud *RoleUserDelete } +// Where appends a list predicates to the RoleUserDelete builder. +func (rudo *RoleUserDeleteOne) Where(ps ...predicate.RoleUser) *RoleUserDeleteOne { + rudo.rud.mutation.Where(ps...) + return rudo +} + // Exec executes the deletion query. func (rudo *RoleUserDeleteOne) Exec(ctx context.Context) error { n, err := rudo.rud.Exec(ctx) @@ -83,5 +89,7 @@ func (rudo *RoleUserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (rudo *RoleUserDeleteOne) ExecX(ctx context.Context) { - rudo.rud.ExecX(ctx) + if err := rudo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/tag_delete.go b/entc/integration/edgeschema/ent/tag_delete.go index ddc1b94d4..d7ea8af17 100644 --- a/entc/integration/edgeschema/ent/tag_delete.go +++ b/entc/integration/edgeschema/ent/tag_delete.go @@ -73,6 +73,12 @@ type TagDeleteOne struct { td *TagDelete } +// Where appends a list predicates to the TagDelete builder. +func (tdo *TagDeleteOne) Where(ps ...predicate.Tag) *TagDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TagDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TagDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TagDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/tweet_delete.go b/entc/integration/edgeschema/ent/tweet_delete.go index 59f7a1ae1..f7bf6d2b3 100644 --- a/entc/integration/edgeschema/ent/tweet_delete.go +++ b/entc/integration/edgeschema/ent/tweet_delete.go @@ -73,6 +73,12 @@ type TweetDeleteOne struct { td *TweetDelete } +// Where appends a list predicates to the TweetDelete builder. +func (tdo *TweetDeleteOne) Where(ps ...predicate.Tweet) *TweetDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TweetDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TweetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TweetDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/tweetlike_delete.go b/entc/integration/edgeschema/ent/tweetlike_delete.go index a499d4936..ee9a4bba8 100644 --- a/entc/integration/edgeschema/ent/tweetlike_delete.go +++ b/entc/integration/edgeschema/ent/tweetlike_delete.go @@ -68,6 +68,12 @@ type TweetLikeDeleteOne struct { tld *TweetLikeDelete } +// Where appends a list predicates to the TweetLikeDelete builder. +func (tldo *TweetLikeDeleteOne) Where(ps ...predicate.TweetLike) *TweetLikeDeleteOne { + tldo.tld.mutation.Where(ps...) + return tldo +} + // Exec executes the deletion query. func (tldo *TweetLikeDeleteOne) Exec(ctx context.Context) error { n, err := tldo.tld.Exec(ctx) @@ -83,5 +89,7 @@ func (tldo *TweetLikeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tldo *TweetLikeDeleteOne) ExecX(ctx context.Context) { - tldo.tld.ExecX(ctx) + if err := tldo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/tweettag_delete.go b/entc/integration/edgeschema/ent/tweettag_delete.go index e829be199..f059b5941 100644 --- a/entc/integration/edgeschema/ent/tweettag_delete.go +++ b/entc/integration/edgeschema/ent/tweettag_delete.go @@ -73,6 +73,12 @@ type TweetTagDeleteOne struct { ttd *TweetTagDelete } +// Where appends a list predicates to the TweetTagDelete builder. +func (ttdo *TweetTagDeleteOne) Where(ps ...predicate.TweetTag) *TweetTagDeleteOne { + ttdo.ttd.mutation.Where(ps...) + return ttdo +} + // Exec executes the deletion query. func (ttdo *TweetTagDeleteOne) Exec(ctx context.Context) error { n, err := ttdo.ttd.Exec(ctx) @@ -88,5 +94,7 @@ func (ttdo *TweetTagDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ttdo *TweetTagDeleteOne) ExecX(ctx context.Context) { - ttdo.ttd.ExecX(ctx) + if err := ttdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/user_delete.go b/entc/integration/edgeschema/ent/user_delete.go index de287819c..fa7b866a1 100644 --- a/entc/integration/edgeschema/ent/user_delete.go +++ b/entc/integration/edgeschema/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/usergroup_delete.go b/entc/integration/edgeschema/ent/usergroup_delete.go index 6476ae0ef..ce7ae2da4 100644 --- a/entc/integration/edgeschema/ent/usergroup_delete.go +++ b/entc/integration/edgeschema/ent/usergroup_delete.go @@ -73,6 +73,12 @@ type UserGroupDeleteOne struct { ugd *UserGroupDelete } +// Where appends a list predicates to the UserGroupDelete builder. +func (ugdo *UserGroupDeleteOne) Where(ps ...predicate.UserGroup) *UserGroupDeleteOne { + ugdo.ugd.mutation.Where(ps...) + return ugdo +} + // Exec executes the deletion query. func (ugdo *UserGroupDeleteOne) Exec(ctx context.Context) error { n, err := ugdo.ugd.Exec(ctx) @@ -88,5 +94,7 @@ func (ugdo *UserGroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ugdo *UserGroupDeleteOne) ExecX(ctx context.Context) { - ugdo.ugd.ExecX(ctx) + if err := ugdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/edgeschema/ent/usertweet_delete.go b/entc/integration/edgeschema/ent/usertweet_delete.go index e78e49a7c..267571828 100644 --- a/entc/integration/edgeschema/ent/usertweet_delete.go +++ b/entc/integration/edgeschema/ent/usertweet_delete.go @@ -73,6 +73,12 @@ type UserTweetDeleteOne struct { utd *UserTweetDelete } +// Where appends a list predicates to the UserTweetDelete builder. +func (utdo *UserTweetDeleteOne) Where(ps ...predicate.UserTweet) *UserTweetDeleteOne { + utdo.utd.mutation.Where(ps...) + return utdo +} + // Exec executes the deletion query. func (utdo *UserTweetDeleteOne) Exec(ctx context.Context) error { n, err := utdo.utd.Exec(ctx) @@ -88,5 +94,7 @@ func (utdo *UserTweetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (utdo *UserTweetDeleteOne) ExecX(ctx context.Context) { - utdo.utd.ExecX(ctx) + if err := utdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/api_delete.go b/entc/integration/ent/api_delete.go index a4691936e..51b9f0068 100644 --- a/entc/integration/ent/api_delete.go +++ b/entc/integration/ent/api_delete.go @@ -73,6 +73,12 @@ type APIDeleteOne struct { ad *APIDelete } +// Where appends a list predicates to the APIDelete builder. +func (ado *APIDeleteOne) Where(ps ...predicate.Api) *APIDeleteOne { + ado.ad.mutation.Where(ps...) + return ado +} + // Exec executes the deletion query. func (ado *APIDeleteOne) Exec(ctx context.Context) error { n, err := ado.ad.Exec(ctx) @@ -88,5 +94,7 @@ func (ado *APIDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ado *APIDeleteOne) ExecX(ctx context.Context) { - ado.ad.ExecX(ctx) + if err := ado.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/card_delete.go b/entc/integration/ent/card_delete.go index 92fc3611f..b7c3b12a5 100644 --- a/entc/integration/ent/card_delete.go +++ b/entc/integration/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/comment_delete.go b/entc/integration/ent/comment_delete.go index 451680d34..1a66b9960 100644 --- a/entc/integration/ent/comment_delete.go +++ b/entc/integration/ent/comment_delete.go @@ -73,6 +73,12 @@ type CommentDeleteOne struct { cd *CommentDelete } +// Where appends a list predicates to the CommentDelete builder. +func (cdo *CommentDeleteOne) Where(ps ...predicate.Comment) *CommentDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CommentDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/fieldtype_delete.go b/entc/integration/ent/fieldtype_delete.go index 8a03c46da..91fc8349a 100644 --- a/entc/integration/ent/fieldtype_delete.go +++ b/entc/integration/ent/fieldtype_delete.go @@ -73,6 +73,12 @@ type FieldTypeDeleteOne struct { ftd *FieldTypeDelete } +// Where appends a list predicates to the FieldTypeDelete builder. +func (ftdo *FieldTypeDeleteOne) Where(ps ...predicate.FieldType) *FieldTypeDeleteOne { + ftdo.ftd.mutation.Where(ps...) + return ftdo +} + // Exec executes the deletion query. func (ftdo *FieldTypeDeleteOne) Exec(ctx context.Context) error { n, err := ftdo.ftd.Exec(ctx) @@ -88,5 +94,7 @@ func (ftdo *FieldTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ftdo *FieldTypeDeleteOne) ExecX(ctx context.Context) { - ftdo.ftd.ExecX(ctx) + if err := ftdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/file_delete.go b/entc/integration/ent/file_delete.go index 71f8343ee..5bbc05066 100644 --- a/entc/integration/ent/file_delete.go +++ b/entc/integration/ent/file_delete.go @@ -73,6 +73,12 @@ type FileDeleteOne struct { fd *FileDelete } +// Where appends a list predicates to the FileDelete builder. +func (fdo *FileDeleteOne) Where(ps ...predicate.File) *FileDeleteOne { + fdo.fd.mutation.Where(ps...) + return fdo +} + // Exec executes the deletion query. func (fdo *FileDeleteOne) Exec(ctx context.Context) error { n, err := fdo.fd.Exec(ctx) @@ -88,5 +94,7 @@ func (fdo *FileDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (fdo *FileDeleteOne) ExecX(ctx context.Context) { - fdo.fd.ExecX(ctx) + if err := fdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/filetype_delete.go b/entc/integration/ent/filetype_delete.go index 432e89218..e87f0992d 100644 --- a/entc/integration/ent/filetype_delete.go +++ b/entc/integration/ent/filetype_delete.go @@ -73,6 +73,12 @@ type FileTypeDeleteOne struct { ftd *FileTypeDelete } +// Where appends a list predicates to the FileTypeDelete builder. +func (ftdo *FileTypeDeleteOne) Where(ps ...predicate.FileType) *FileTypeDeleteOne { + ftdo.ftd.mutation.Where(ps...) + return ftdo +} + // Exec executes the deletion query. func (ftdo *FileTypeDeleteOne) Exec(ctx context.Context) error { n, err := ftdo.ftd.Exec(ctx) @@ -88,5 +94,7 @@ func (ftdo *FileTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ftdo *FileTypeDeleteOne) ExecX(ctx context.Context) { - ftdo.ftd.ExecX(ctx) + if err := ftdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/goods_delete.go b/entc/integration/ent/goods_delete.go index 24a1daca3..7c93929ba 100644 --- a/entc/integration/ent/goods_delete.go +++ b/entc/integration/ent/goods_delete.go @@ -73,6 +73,12 @@ type GoodsDeleteOne struct { gd *GoodsDelete } +// Where appends a list predicates to the GoodsDelete builder. +func (gdo *GoodsDeleteOne) Where(ps ...predicate.Goods) *GoodsDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GoodsDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/group_delete.go b/entc/integration/ent/group_delete.go index 4512a1495..0fd82ce98 100644 --- a/entc/integration/ent/group_delete.go +++ b/entc/integration/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/groupinfo_delete.go b/entc/integration/ent/groupinfo_delete.go index b8185ccca..2d285b3d0 100644 --- a/entc/integration/ent/groupinfo_delete.go +++ b/entc/integration/ent/groupinfo_delete.go @@ -73,6 +73,12 @@ type GroupInfoDeleteOne struct { gid *GroupInfoDelete } +// Where appends a list predicates to the GroupInfoDelete builder. +func (gido *GroupInfoDeleteOne) Where(ps ...predicate.GroupInfo) *GroupInfoDeleteOne { + gido.gid.mutation.Where(ps...) + return gido +} + // Exec executes the deletion query. func (gido *GroupInfoDeleteOne) Exec(ctx context.Context) error { n, err := gido.gid.Exec(ctx) @@ -88,5 +94,7 @@ func (gido *GroupInfoDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gido *GroupInfoDeleteOne) ExecX(ctx context.Context) { - gido.gid.ExecX(ctx) + if err := gido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/item_delete.go b/entc/integration/ent/item_delete.go index 1f811c94b..e3a9ea3ef 100644 --- a/entc/integration/ent/item_delete.go +++ b/entc/integration/ent/item_delete.go @@ -73,6 +73,12 @@ type ItemDeleteOne struct { id *ItemDelete } +// Where appends a list predicates to the ItemDelete builder. +func (ido *ItemDeleteOne) Where(ps ...predicate.Item) *ItemDeleteOne { + ido.id.mutation.Where(ps...) + return ido +} + // Exec executes the deletion query. func (ido *ItemDeleteOne) Exec(ctx context.Context) error { n, err := ido.id.Exec(ctx) @@ -88,5 +94,7 @@ func (ido *ItemDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ido *ItemDeleteOne) ExecX(ctx context.Context) { - ido.id.ExecX(ctx) + if err := ido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/license_delete.go b/entc/integration/ent/license_delete.go index ecd013e32..270207a3c 100644 --- a/entc/integration/ent/license_delete.go +++ b/entc/integration/ent/license_delete.go @@ -73,6 +73,12 @@ type LicenseDeleteOne struct { ld *LicenseDelete } +// Where appends a list predicates to the LicenseDelete builder. +func (ldo *LicenseDeleteOne) Where(ps ...predicate.License) *LicenseDeleteOne { + ldo.ld.mutation.Where(ps...) + return ldo +} + // Exec executes the deletion query. func (ldo *LicenseDeleteOne) Exec(ctx context.Context) error { n, err := ldo.ld.Exec(ctx) @@ -88,5 +94,7 @@ func (ldo *LicenseDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ldo *LicenseDeleteOne) ExecX(ctx context.Context) { - ldo.ld.ExecX(ctx) + if err := ldo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/node_delete.go b/entc/integration/ent/node_delete.go index bc51f6997..752d6a759 100644 --- a/entc/integration/ent/node_delete.go +++ b/entc/integration/ent/node_delete.go @@ -73,6 +73,12 @@ type NodeDeleteOne struct { nd *NodeDelete } +// Where appends a list predicates to the NodeDelete builder. +func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -88,5 +94,7 @@ func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NodeDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/pet_delete.go b/entc/integration/ent/pet_delete.go index 46fa97c77..f55f8f94d 100644 --- a/entc/integration/ent/pet_delete.go +++ b/entc/integration/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/spec_delete.go b/entc/integration/ent/spec_delete.go index 5a2b4c7b4..0da21a188 100644 --- a/entc/integration/ent/spec_delete.go +++ b/entc/integration/ent/spec_delete.go @@ -73,6 +73,12 @@ type SpecDeleteOne struct { sd *SpecDelete } +// Where appends a list predicates to the SpecDelete builder. +func (sdo *SpecDeleteOne) Where(ps ...predicate.Spec) *SpecDeleteOne { + sdo.sd.mutation.Where(ps...) + return sdo +} + // Exec executes the deletion query. func (sdo *SpecDeleteOne) Exec(ctx context.Context) error { n, err := sdo.sd.Exec(ctx) @@ -88,5 +94,7 @@ func (sdo *SpecDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (sdo *SpecDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) + if err := sdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/task_delete.go b/entc/integration/ent/task_delete.go index 00e7b38cd..bb7656773 100644 --- a/entc/integration/ent/task_delete.go +++ b/entc/integration/ent/task_delete.go @@ -74,6 +74,12 @@ type TaskDeleteOne struct { td *TaskDelete } +// Where appends a list predicates to the TaskDelete builder. +func (tdo *TaskDeleteOne) Where(ps ...predicate.Task) *TaskDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -89,5 +95,7 @@ func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TaskDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/ent/user_delete.go b/entc/integration/ent/user_delete.go index c30edda17..070669034 100644 --- a/entc/integration/ent/user_delete.go +++ b/entc/integration/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/api_delete.go b/entc/integration/gremlin/ent/api_delete.go index 377c0e31d..539ae0515 100644 --- a/entc/integration/gremlin/ent/api_delete.go +++ b/entc/integration/gremlin/ent/api_delete.go @@ -67,6 +67,12 @@ type APIDeleteOne struct { ad *APIDelete } +// Where appends a list predicates to the APIDelete builder. +func (ado *APIDeleteOne) Where(ps ...predicate.Api) *APIDeleteOne { + ado.ad.mutation.Where(ps...) + return ado +} + // Exec executes the deletion query. func (ado *APIDeleteOne) Exec(ctx context.Context) error { n, err := ado.ad.Exec(ctx) @@ -82,5 +88,7 @@ func (ado *APIDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ado *APIDeleteOne) ExecX(ctx context.Context) { - ado.ad.ExecX(ctx) + if err := ado.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/card_delete.go b/entc/integration/gremlin/ent/card_delete.go index b5c6d5902..2be69d2b4 100644 --- a/entc/integration/gremlin/ent/card_delete.go +++ b/entc/integration/gremlin/ent/card_delete.go @@ -67,6 +67,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -82,5 +88,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/comment_delete.go b/entc/integration/gremlin/ent/comment_delete.go index 81cb8c500..cafa3f94e 100644 --- a/entc/integration/gremlin/ent/comment_delete.go +++ b/entc/integration/gremlin/ent/comment_delete.go @@ -67,6 +67,12 @@ type CommentDeleteOne struct { cd *CommentDelete } +// Where appends a list predicates to the CommentDelete builder. +func (cdo *CommentDeleteOne) Where(ps ...predicate.Comment) *CommentDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -82,5 +88,7 @@ func (cdo *CommentDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CommentDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/fieldtype_delete.go b/entc/integration/gremlin/ent/fieldtype_delete.go index 3b6d698bc..1471b45ec 100644 --- a/entc/integration/gremlin/ent/fieldtype_delete.go +++ b/entc/integration/gremlin/ent/fieldtype_delete.go @@ -67,6 +67,12 @@ type FieldTypeDeleteOne struct { ftd *FieldTypeDelete } +// Where appends a list predicates to the FieldTypeDelete builder. +func (ftdo *FieldTypeDeleteOne) Where(ps ...predicate.FieldType) *FieldTypeDeleteOne { + ftdo.ftd.mutation.Where(ps...) + return ftdo +} + // Exec executes the deletion query. func (ftdo *FieldTypeDeleteOne) Exec(ctx context.Context) error { n, err := ftdo.ftd.Exec(ctx) @@ -82,5 +88,7 @@ func (ftdo *FieldTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ftdo *FieldTypeDeleteOne) ExecX(ctx context.Context) { - ftdo.ftd.ExecX(ctx) + if err := ftdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/file_delete.go b/entc/integration/gremlin/ent/file_delete.go index ffb283d74..8f5580a83 100644 --- a/entc/integration/gremlin/ent/file_delete.go +++ b/entc/integration/gremlin/ent/file_delete.go @@ -67,6 +67,12 @@ type FileDeleteOne struct { fd *FileDelete } +// Where appends a list predicates to the FileDelete builder. +func (fdo *FileDeleteOne) Where(ps ...predicate.File) *FileDeleteOne { + fdo.fd.mutation.Where(ps...) + return fdo +} + // Exec executes the deletion query. func (fdo *FileDeleteOne) Exec(ctx context.Context) error { n, err := fdo.fd.Exec(ctx) @@ -82,5 +88,7 @@ func (fdo *FileDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (fdo *FileDeleteOne) ExecX(ctx context.Context) { - fdo.fd.ExecX(ctx) + if err := fdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/filetype_delete.go b/entc/integration/gremlin/ent/filetype_delete.go index fe8083963..6a607865b 100644 --- a/entc/integration/gremlin/ent/filetype_delete.go +++ b/entc/integration/gremlin/ent/filetype_delete.go @@ -67,6 +67,12 @@ type FileTypeDeleteOne struct { ftd *FileTypeDelete } +// Where appends a list predicates to the FileTypeDelete builder. +func (ftdo *FileTypeDeleteOne) Where(ps ...predicate.FileType) *FileTypeDeleteOne { + ftdo.ftd.mutation.Where(ps...) + return ftdo +} + // Exec executes the deletion query. func (ftdo *FileTypeDeleteOne) Exec(ctx context.Context) error { n, err := ftdo.ftd.Exec(ctx) @@ -82,5 +88,7 @@ func (ftdo *FileTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ftdo *FileTypeDeleteOne) ExecX(ctx context.Context) { - ftdo.ftd.ExecX(ctx) + if err := ftdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/goods_delete.go b/entc/integration/gremlin/ent/goods_delete.go index c5f91da92..76043031e 100644 --- a/entc/integration/gremlin/ent/goods_delete.go +++ b/entc/integration/gremlin/ent/goods_delete.go @@ -67,6 +67,12 @@ type GoodsDeleteOne struct { gd *GoodsDelete } +// Where appends a list predicates to the GoodsDelete builder. +func (gdo *GoodsDeleteOne) Where(ps ...predicate.Goods) *GoodsDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -82,5 +88,7 @@ func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GoodsDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/group_delete.go b/entc/integration/gremlin/ent/group_delete.go index fc24f190f..07c96a911 100644 --- a/entc/integration/gremlin/ent/group_delete.go +++ b/entc/integration/gremlin/ent/group_delete.go @@ -67,6 +67,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -82,5 +88,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/groupinfo_delete.go b/entc/integration/gremlin/ent/groupinfo_delete.go index 60ef5cb4c..99cc97117 100644 --- a/entc/integration/gremlin/ent/groupinfo_delete.go +++ b/entc/integration/gremlin/ent/groupinfo_delete.go @@ -67,6 +67,12 @@ type GroupInfoDeleteOne struct { gid *GroupInfoDelete } +// Where appends a list predicates to the GroupInfoDelete builder. +func (gido *GroupInfoDeleteOne) Where(ps ...predicate.GroupInfo) *GroupInfoDeleteOne { + gido.gid.mutation.Where(ps...) + return gido +} + // Exec executes the deletion query. func (gido *GroupInfoDeleteOne) Exec(ctx context.Context) error { n, err := gido.gid.Exec(ctx) @@ -82,5 +88,7 @@ func (gido *GroupInfoDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gido *GroupInfoDeleteOne) ExecX(ctx context.Context) { - gido.gid.ExecX(ctx) + if err := gido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/item_delete.go b/entc/integration/gremlin/ent/item_delete.go index 6d4209940..adc8ccc4e 100644 --- a/entc/integration/gremlin/ent/item_delete.go +++ b/entc/integration/gremlin/ent/item_delete.go @@ -67,6 +67,12 @@ type ItemDeleteOne struct { id *ItemDelete } +// Where appends a list predicates to the ItemDelete builder. +func (ido *ItemDeleteOne) Where(ps ...predicate.Item) *ItemDeleteOne { + ido.id.mutation.Where(ps...) + return ido +} + // Exec executes the deletion query. func (ido *ItemDeleteOne) Exec(ctx context.Context) error { n, err := ido.id.Exec(ctx) @@ -82,5 +88,7 @@ func (ido *ItemDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ido *ItemDeleteOne) ExecX(ctx context.Context) { - ido.id.ExecX(ctx) + if err := ido.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/license_delete.go b/entc/integration/gremlin/ent/license_delete.go index ed2ace796..2cd998a4e 100644 --- a/entc/integration/gremlin/ent/license_delete.go +++ b/entc/integration/gremlin/ent/license_delete.go @@ -67,6 +67,12 @@ type LicenseDeleteOne struct { ld *LicenseDelete } +// Where appends a list predicates to the LicenseDelete builder. +func (ldo *LicenseDeleteOne) Where(ps ...predicate.License) *LicenseDeleteOne { + ldo.ld.mutation.Where(ps...) + return ldo +} + // Exec executes the deletion query. func (ldo *LicenseDeleteOne) Exec(ctx context.Context) error { n, err := ldo.ld.Exec(ctx) @@ -82,5 +88,7 @@ func (ldo *LicenseDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ldo *LicenseDeleteOne) ExecX(ctx context.Context) { - ldo.ld.ExecX(ctx) + if err := ldo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/node_delete.go b/entc/integration/gremlin/ent/node_delete.go index 21b257e72..24dccd875 100644 --- a/entc/integration/gremlin/ent/node_delete.go +++ b/entc/integration/gremlin/ent/node_delete.go @@ -67,6 +67,12 @@ type NodeDeleteOne struct { nd *NodeDelete } +// Where appends a list predicates to the NodeDelete builder. +func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -82,5 +88,7 @@ func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NodeDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/pet_delete.go b/entc/integration/gremlin/ent/pet_delete.go index f65b516ac..f3258aafa 100644 --- a/entc/integration/gremlin/ent/pet_delete.go +++ b/entc/integration/gremlin/ent/pet_delete.go @@ -67,6 +67,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -82,5 +88,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/spec_delete.go b/entc/integration/gremlin/ent/spec_delete.go index 15789857f..22700f023 100644 --- a/entc/integration/gremlin/ent/spec_delete.go +++ b/entc/integration/gremlin/ent/spec_delete.go @@ -67,6 +67,12 @@ type SpecDeleteOne struct { sd *SpecDelete } +// Where appends a list predicates to the SpecDelete builder. +func (sdo *SpecDeleteOne) Where(ps ...predicate.Spec) *SpecDeleteOne { + sdo.sd.mutation.Where(ps...) + return sdo +} + // Exec executes the deletion query. func (sdo *SpecDeleteOne) Exec(ctx context.Context) error { n, err := sdo.sd.Exec(ctx) @@ -82,5 +88,7 @@ func (sdo *SpecDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (sdo *SpecDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) + if err := sdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/task_delete.go b/entc/integration/gremlin/ent/task_delete.go index 3ba2a6165..4cf7fdfce 100644 --- a/entc/integration/gremlin/ent/task_delete.go +++ b/entc/integration/gremlin/ent/task_delete.go @@ -68,6 +68,12 @@ type TaskDeleteOne struct { td *TaskDelete } +// Where appends a list predicates to the TaskDelete builder. +func (tdo *TaskDeleteOne) Where(ps ...predicate.Task) *TaskDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -83,5 +89,7 @@ func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TaskDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/gremlin/ent/user_delete.go b/entc/integration/gremlin/ent/user_delete.go index efe77cc6d..d9bd3a6db 100644 --- a/entc/integration/gremlin/ent/user_delete.go +++ b/entc/integration/gremlin/ent/user_delete.go @@ -67,6 +67,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -82,5 +88,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/hooks/ent/card_delete.go b/entc/integration/hooks/ent/card_delete.go index a506cbfcb..7af85664d 100644 --- a/entc/integration/hooks/ent/card_delete.go +++ b/entc/integration/hooks/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/hooks/ent/pet_delete.go b/entc/integration/hooks/ent/pet_delete.go index f2ebb619d..7b1482e7f 100644 --- a/entc/integration/hooks/ent/pet_delete.go +++ b/entc/integration/hooks/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/hooks/ent/user_delete.go b/entc/integration/hooks/ent/user_delete.go index c1a39de39..157886e80 100644 --- a/entc/integration/hooks/ent/user_delete.go +++ b/entc/integration/hooks/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/idtype/ent/user_delete.go b/entc/integration/idtype/ent/user_delete.go index d2e1ccdc4..72451e05b 100644 --- a/entc/integration/idtype/ent/user_delete.go +++ b/entc/integration/idtype/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/integration_test.go b/entc/integration/integration_test.go index f71291f49..d16f4d9d9 100644 --- a/entc/integration/integration_test.go +++ b/entc/integration/integration_test.go @@ -985,9 +985,28 @@ func Delete(t *testing.T, client *ent.Client) { require.Equal(3, affected) info := client.GroupInfo.Create().SetDesc("group info").SaveX(ctx) - client.Group.Create().SetInfo(info).SetName("GitHub").SetExpire(time.Now().Add(time.Hour)).ExecX(ctx) + hub := client.Group.Create().SetInfo(info).SetName("GitHub").SetExpire(time.Now().Add(time.Hour)).SaveX(ctx) err = client.GroupInfo.DeleteOne(info).Exec(ctx) require.True(ent.IsConstraintError(err)) + + // Group.DeleteOneID(id).Where(...), is identical to Group.Delete().Where(group.ID(id), ...), + // but, in case the OpDelete is not an allowed operation, the DeleteOne can be used with Where. + n, err := client.Group.Delete(). + Where( + group.ID(hub.ID), + group.ExpireLT(time.Now()), // Expired. + ).Exec(ctx) + require.Zero(n) + require.NoError(err) + + err = client.Group.DeleteOne(hub). + Where(group.ExpireLT(time.Now())). + Exec(ctx) + require.True(ent.IsNotFound(err)) + hub.Update().SetExpire(time.Now().Add(-time.Hour)).ExecX(ctx) + client.Group.DeleteOne(hub). + Where(group.ExpireLT(time.Now())). + ExecX(ctx) } func Relation(t *testing.T, client *ent.Client) { diff --git a/entc/integration/json/ent/user_delete.go b/entc/integration/json/ent/user_delete.go index d02bb6f73..140f1df09 100644 --- a/entc/integration/json/ent/user_delete.go +++ b/entc/integration/json/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv1/car_delete.go b/entc/integration/migrate/entv1/car_delete.go index adfa60b7c..a0e638bf4 100644 --- a/entc/integration/migrate/entv1/car_delete.go +++ b/entc/integration/migrate/entv1/car_delete.go @@ -73,6 +73,12 @@ type CarDeleteOne struct { cd *CarDelete } +// Where appends a list predicates to the CarDelete builder. +func (cdo *CarDeleteOne) Where(ps ...predicate.Car) *CarDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CarDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CarDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CarDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv1/conversion_delete.go b/entc/integration/migrate/entv1/conversion_delete.go index c1b2f0af7..ccdfdbe2e 100644 --- a/entc/integration/migrate/entv1/conversion_delete.go +++ b/entc/integration/migrate/entv1/conversion_delete.go @@ -73,6 +73,12 @@ type ConversionDeleteOne struct { cd *ConversionDelete } +// Where appends a list predicates to the ConversionDelete builder. +func (cdo *ConversionDeleteOne) Where(ps ...predicate.Conversion) *ConversionDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *ConversionDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *ConversionDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *ConversionDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv1/customtype_delete.go b/entc/integration/migrate/entv1/customtype_delete.go index c7d4c1890..3b2e29dbb 100644 --- a/entc/integration/migrate/entv1/customtype_delete.go +++ b/entc/integration/migrate/entv1/customtype_delete.go @@ -73,6 +73,12 @@ type CustomTypeDeleteOne struct { ctd *CustomTypeDelete } +// Where appends a list predicates to the CustomTypeDelete builder. +func (ctdo *CustomTypeDeleteOne) Where(ps ...predicate.CustomType) *CustomTypeDeleteOne { + ctdo.ctd.mutation.Where(ps...) + return ctdo +} + // Exec executes the deletion query. func (ctdo *CustomTypeDeleteOne) Exec(ctx context.Context) error { n, err := ctdo.ctd.Exec(ctx) @@ -88,5 +94,7 @@ func (ctdo *CustomTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ctdo *CustomTypeDeleteOne) ExecX(ctx context.Context) { - ctdo.ctd.ExecX(ctx) + if err := ctdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv1/user_delete.go b/entc/integration/migrate/entv1/user_delete.go index c045535c6..a48ba9808 100644 --- a/entc/integration/migrate/entv1/user_delete.go +++ b/entc/integration/migrate/entv1/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/blog_delete.go b/entc/integration/migrate/entv2/blog_delete.go index 3efb90b36..cb521544f 100644 --- a/entc/integration/migrate/entv2/blog_delete.go +++ b/entc/integration/migrate/entv2/blog_delete.go @@ -73,6 +73,12 @@ type BlogDeleteOne struct { bd *BlogDelete } +// Where appends a list predicates to the BlogDelete builder. +func (bdo *BlogDeleteOne) Where(ps ...predicate.Blog) *BlogDeleteOne { + bdo.bd.mutation.Where(ps...) + return bdo +} + // Exec executes the deletion query. func (bdo *BlogDeleteOne) Exec(ctx context.Context) error { n, err := bdo.bd.Exec(ctx) @@ -88,5 +94,7 @@ func (bdo *BlogDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (bdo *BlogDeleteOne) ExecX(ctx context.Context) { - bdo.bd.ExecX(ctx) + if err := bdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/car_delete.go b/entc/integration/migrate/entv2/car_delete.go index 18d07f09b..d385bbb06 100644 --- a/entc/integration/migrate/entv2/car_delete.go +++ b/entc/integration/migrate/entv2/car_delete.go @@ -73,6 +73,12 @@ type CarDeleteOne struct { cd *CarDelete } +// Where appends a list predicates to the CarDelete builder. +func (cdo *CarDeleteOne) Where(ps ...predicate.Car) *CarDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CarDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CarDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CarDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/conversion_delete.go b/entc/integration/migrate/entv2/conversion_delete.go index b85e97459..815fe767a 100644 --- a/entc/integration/migrate/entv2/conversion_delete.go +++ b/entc/integration/migrate/entv2/conversion_delete.go @@ -73,6 +73,12 @@ type ConversionDeleteOne struct { cd *ConversionDelete } +// Where appends a list predicates to the ConversionDelete builder. +func (cdo *ConversionDeleteOne) Where(ps ...predicate.Conversion) *ConversionDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *ConversionDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *ConversionDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *ConversionDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/customtype_delete.go b/entc/integration/migrate/entv2/customtype_delete.go index 684a883b4..637e0ccfb 100644 --- a/entc/integration/migrate/entv2/customtype_delete.go +++ b/entc/integration/migrate/entv2/customtype_delete.go @@ -73,6 +73,12 @@ type CustomTypeDeleteOne struct { ctd *CustomTypeDelete } +// Where appends a list predicates to the CustomTypeDelete builder. +func (ctdo *CustomTypeDeleteOne) Where(ps ...predicate.CustomType) *CustomTypeDeleteOne { + ctdo.ctd.mutation.Where(ps...) + return ctdo +} + // Exec executes the deletion query. func (ctdo *CustomTypeDeleteOne) Exec(ctx context.Context) error { n, err := ctdo.ctd.Exec(ctx) @@ -88,5 +94,7 @@ func (ctdo *CustomTypeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ctdo *CustomTypeDeleteOne) ExecX(ctx context.Context) { - ctdo.ctd.ExecX(ctx) + if err := ctdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/group_delete.go b/entc/integration/migrate/entv2/group_delete.go index c33525153..d771319cf 100644 --- a/entc/integration/migrate/entv2/group_delete.go +++ b/entc/integration/migrate/entv2/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/media_delete.go b/entc/integration/migrate/entv2/media_delete.go index 2e9b6af45..58c7cb3e4 100644 --- a/entc/integration/migrate/entv2/media_delete.go +++ b/entc/integration/migrate/entv2/media_delete.go @@ -73,6 +73,12 @@ type MediaDeleteOne struct { md *MediaDelete } +// Where appends a list predicates to the MediaDelete builder. +func (mdo *MediaDeleteOne) Where(ps ...predicate.Media) *MediaDeleteOne { + mdo.md.mutation.Where(ps...) + return mdo +} + // Exec executes the deletion query. func (mdo *MediaDeleteOne) Exec(ctx context.Context) error { n, err := mdo.md.Exec(ctx) @@ -88,5 +94,7 @@ func (mdo *MediaDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (mdo *MediaDeleteOne) ExecX(ctx context.Context) { - mdo.md.ExecX(ctx) + if err := mdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/pet_delete.go b/entc/integration/migrate/entv2/pet_delete.go index a0817616b..0b7f2dca3 100644 --- a/entc/integration/migrate/entv2/pet_delete.go +++ b/entc/integration/migrate/entv2/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/user_delete.go b/entc/integration/migrate/entv2/user_delete.go index 14cc03f21..88593ebc7 100644 --- a/entc/integration/migrate/entv2/user_delete.go +++ b/entc/integration/migrate/entv2/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/entv2/zoo_delete.go b/entc/integration/migrate/entv2/zoo_delete.go index 1677a0d7e..22cab60f4 100644 --- a/entc/integration/migrate/entv2/zoo_delete.go +++ b/entc/integration/migrate/entv2/zoo_delete.go @@ -73,6 +73,12 @@ type ZooDeleteOne struct { zd *ZooDelete } +// Where appends a list predicates to the ZooDelete builder. +func (zdo *ZooDeleteOne) Where(ps ...predicate.Zoo) *ZooDeleteOne { + zdo.zd.mutation.Where(ps...) + return zdo +} + // Exec executes the deletion query. func (zdo *ZooDeleteOne) Exec(ctx context.Context) error { n, err := zdo.zd.Exec(ctx) @@ -88,5 +94,7 @@ func (zdo *ZooDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (zdo *ZooDeleteOne) ExecX(ctx context.Context) { - zdo.zd.ExecX(ctx) + if err := zdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/versioned/group_delete.go b/entc/integration/migrate/versioned/group_delete.go index 8cdceb7e8..6cf839527 100644 --- a/entc/integration/migrate/versioned/group_delete.go +++ b/entc/integration/migrate/versioned/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/migrate/versioned/user_delete.go b/entc/integration/migrate/versioned/user_delete.go index 89d8bcd22..5452694c3 100644 --- a/entc/integration/migrate/versioned/user_delete.go +++ b/entc/integration/migrate/versioned/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/multischema/ent/friendship_delete.go b/entc/integration/multischema/ent/friendship_delete.go index a1dc3378e..c05cb3bc0 100644 --- a/entc/integration/multischema/ent/friendship_delete.go +++ b/entc/integration/multischema/ent/friendship_delete.go @@ -76,6 +76,12 @@ type FriendshipDeleteOne struct { fd *FriendshipDelete } +// Where appends a list predicates to the FriendshipDelete builder. +func (fdo *FriendshipDeleteOne) Where(ps ...predicate.Friendship) *FriendshipDeleteOne { + fdo.fd.mutation.Where(ps...) + return fdo +} + // Exec executes the deletion query. func (fdo *FriendshipDeleteOne) Exec(ctx context.Context) error { n, err := fdo.fd.Exec(ctx) @@ -91,5 +97,7 @@ func (fdo *FriendshipDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (fdo *FriendshipDeleteOne) ExecX(ctx context.Context) { - fdo.fd.ExecX(ctx) + if err := fdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/multischema/ent/group_delete.go b/entc/integration/multischema/ent/group_delete.go index e5e37d795..9ff2ff536 100644 --- a/entc/integration/multischema/ent/group_delete.go +++ b/entc/integration/multischema/ent/group_delete.go @@ -76,6 +76,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -91,5 +97,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/multischema/ent/pet_delete.go b/entc/integration/multischema/ent/pet_delete.go index 82ec94d76..de664ddfc 100644 --- a/entc/integration/multischema/ent/pet_delete.go +++ b/entc/integration/multischema/ent/pet_delete.go @@ -76,6 +76,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -91,5 +97,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/multischema/ent/user_delete.go b/entc/integration/multischema/ent/user_delete.go index 0efe11436..08d825a97 100644 --- a/entc/integration/multischema/ent/user_delete.go +++ b/entc/integration/multischema/ent/user_delete.go @@ -76,6 +76,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -91,5 +97,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/privacy/ent/task_delete.go b/entc/integration/privacy/ent/task_delete.go index 8261c9205..c974a9f49 100644 --- a/entc/integration/privacy/ent/task_delete.go +++ b/entc/integration/privacy/ent/task_delete.go @@ -73,6 +73,12 @@ type TaskDeleteOne struct { td *TaskDelete } +// Where appends a list predicates to the TaskDelete builder. +func (tdo *TaskDeleteOne) Where(ps ...predicate.Task) *TaskDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TaskDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TaskDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/privacy/ent/team_delete.go b/entc/integration/privacy/ent/team_delete.go index f0f6d1da5..014169783 100644 --- a/entc/integration/privacy/ent/team_delete.go +++ b/entc/integration/privacy/ent/team_delete.go @@ -73,6 +73,12 @@ type TeamDeleteOne struct { td *TeamDelete } +// Where appends a list predicates to the TeamDelete builder. +func (tdo *TeamDeleteOne) Where(ps ...predicate.Team) *TeamDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TeamDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TeamDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TeamDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/privacy/ent/user_delete.go b/entc/integration/privacy/ent/user_delete.go index 8c5d620c2..af6051858 100644 --- a/entc/integration/privacy/ent/user_delete.go +++ b/entc/integration/privacy/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/template/ent/group_delete.go b/entc/integration/template/ent/group_delete.go index bbb46ddc0..473dfeffb 100644 --- a/entc/integration/template/ent/group_delete.go +++ b/entc/integration/template/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/template/ent/pet_delete.go b/entc/integration/template/ent/pet_delete.go index 1247b0789..a320194ab 100644 --- a/entc/integration/template/ent/pet_delete.go +++ b/entc/integration/template/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/entc/integration/template/ent/user_delete.go b/entc/integration/template/ent/user_delete.go index a050db895..5a8e1b0b8 100644 --- a/entc/integration/template/ent/user_delete.go +++ b/entc/integration/template/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/edgeindex/ent/city_delete.go b/examples/edgeindex/ent/city_delete.go index 4dbb36c2f..4f803b5e4 100644 --- a/examples/edgeindex/ent/city_delete.go +++ b/examples/edgeindex/ent/city_delete.go @@ -73,6 +73,12 @@ type CityDeleteOne struct { cd *CityDelete } +// Where appends a list predicates to the CityDelete builder. +func (cdo *CityDeleteOne) Where(ps ...predicate.City) *CityDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CityDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CityDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CityDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/edgeindex/ent/street_delete.go b/examples/edgeindex/ent/street_delete.go index 108e64add..725f7c232 100644 --- a/examples/edgeindex/ent/street_delete.go +++ b/examples/edgeindex/ent/street_delete.go @@ -73,6 +73,12 @@ type StreetDeleteOne struct { sd *StreetDelete } +// Where appends a list predicates to the StreetDelete builder. +func (sdo *StreetDeleteOne) Where(ps ...predicate.Street) *StreetDeleteOne { + sdo.sd.mutation.Where(ps...) + return sdo +} + // Exec executes the deletion query. func (sdo *StreetDeleteOne) Exec(ctx context.Context) error { n, err := sdo.sd.Exec(ctx) @@ -88,5 +94,7 @@ func (sdo *StreetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (sdo *StreetDeleteOne) ExecX(ctx context.Context) { - sdo.sd.ExecX(ctx) + if err := sdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/encryptfield/ent/user_delete.go b/examples/encryptfield/ent/user_delete.go index d1d51258f..da98b4f39 100644 --- a/examples/encryptfield/ent/user_delete.go +++ b/examples/encryptfield/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/entcpkg/ent/user_delete.go b/examples/entcpkg/ent/user_delete.go index 32b6ecad7..2d8a91501 100644 --- a/examples/entcpkg/ent/user_delete.go +++ b/examples/entcpkg/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/fs/ent/file_delete.go b/examples/fs/ent/file_delete.go index e28b9a5fd..a2bc7715c 100644 --- a/examples/fs/ent/file_delete.go +++ b/examples/fs/ent/file_delete.go @@ -73,6 +73,12 @@ type FileDeleteOne struct { fd *FileDelete } +// Where appends a list predicates to the FileDelete builder. +func (fdo *FileDeleteOne) Where(ps ...predicate.File) *FileDeleteOne { + fdo.fd.mutation.Where(ps...) + return fdo +} + // Exec executes the deletion query. func (fdo *FileDeleteOne) Exec(ctx context.Context) error { n, err := fdo.fd.Exec(ctx) @@ -88,5 +94,7 @@ func (fdo *FileDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (fdo *FileDeleteOne) ExecX(ctx context.Context) { - fdo.fd.ExecX(ctx) + if err := fdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/jsonencode/ent/card_delete.go b/examples/jsonencode/ent/card_delete.go index 0ddc6cd78..aa212fb76 100644 --- a/examples/jsonencode/ent/card_delete.go +++ b/examples/jsonencode/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/jsonencode/ent/pet_delete.go b/examples/jsonencode/ent/pet_delete.go index 4f12d6d14..fdad3ab03 100644 --- a/examples/jsonencode/ent/pet_delete.go +++ b/examples/jsonencode/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/jsonencode/ent/user_delete.go b/examples/jsonencode/ent/user_delete.go index 9170cbd45..37f213aea 100644 --- a/examples/jsonencode/ent/user_delete.go +++ b/examples/jsonencode/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/m2m2types/ent/group_delete.go b/examples/m2m2types/ent/group_delete.go index 939a43067..f1be55d13 100644 --- a/examples/m2m2types/ent/group_delete.go +++ b/examples/m2m2types/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/m2m2types/ent/user_delete.go b/examples/m2m2types/ent/user_delete.go index 71bd7b0bc..974fe366e 100644 --- a/examples/m2m2types/ent/user_delete.go +++ b/examples/m2m2types/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/m2mbidi/ent/user_delete.go b/examples/m2mbidi/ent/user_delete.go index 35ff9355c..baa13d79f 100644 --- a/examples/m2mbidi/ent/user_delete.go +++ b/examples/m2mbidi/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/m2mrecur/ent/user_delete.go b/examples/m2mrecur/ent/user_delete.go index d3c4150a5..db82d812f 100644 --- a/examples/m2mrecur/ent/user_delete.go +++ b/examples/m2mrecur/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/migration/ent/card_delete.go b/examples/migration/ent/card_delete.go index 5cacfc741..903023a1b 100644 --- a/examples/migration/ent/card_delete.go +++ b/examples/migration/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/migration/ent/pet_delete.go b/examples/migration/ent/pet_delete.go index 9b71805db..76b308c55 100644 --- a/examples/migration/ent/pet_delete.go +++ b/examples/migration/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/migration/ent/user_delete.go b/examples/migration/ent/user_delete.go index 35f823650..9edd95bc8 100644 --- a/examples/migration/ent/user_delete.go +++ b/examples/migration/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2m2types/ent/pet_delete.go b/examples/o2m2types/ent/pet_delete.go index 65f668e25..daeb76696 100644 --- a/examples/o2m2types/ent/pet_delete.go +++ b/examples/o2m2types/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2m2types/ent/user_delete.go b/examples/o2m2types/ent/user_delete.go index 21dad5360..01c9071df 100644 --- a/examples/o2m2types/ent/user_delete.go +++ b/examples/o2m2types/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2mrecur/ent/node_delete.go b/examples/o2mrecur/ent/node_delete.go index 527961942..8233f13e9 100644 --- a/examples/o2mrecur/ent/node_delete.go +++ b/examples/o2mrecur/ent/node_delete.go @@ -73,6 +73,12 @@ type NodeDeleteOne struct { nd *NodeDelete } +// Where appends a list predicates to the NodeDelete builder. +func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -88,5 +94,7 @@ func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NodeDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2o2types/ent/card_delete.go b/examples/o2o2types/ent/card_delete.go index a7949c1de..37914869d 100644 --- a/examples/o2o2types/ent/card_delete.go +++ b/examples/o2o2types/ent/card_delete.go @@ -73,6 +73,12 @@ type CardDeleteOne struct { cd *CardDelete } +// Where appends a list predicates to the CardDelete builder. +func (cdo *CardDeleteOne) Where(ps ...predicate.Card) *CardDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CardDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CardDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CardDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2o2types/ent/user_delete.go b/examples/o2o2types/ent/user_delete.go index 80394a647..fc695ee50 100644 --- a/examples/o2o2types/ent/user_delete.go +++ b/examples/o2o2types/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2obidi/ent/user_delete.go b/examples/o2obidi/ent/user_delete.go index 021c40989..bbbcab837 100644 --- a/examples/o2obidi/ent/user_delete.go +++ b/examples/o2obidi/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/o2orecur/ent/node_delete.go b/examples/o2orecur/ent/node_delete.go index cc15079df..b164ed4ec 100644 --- a/examples/o2orecur/ent/node_delete.go +++ b/examples/o2orecur/ent/node_delete.go @@ -73,6 +73,12 @@ type NodeDeleteOne struct { nd *NodeDelete } +// Where appends a list predicates to the NodeDelete builder. +func (ndo *NodeDeleteOne) Where(ps ...predicate.Node) *NodeDeleteOne { + ndo.nd.mutation.Where(ps...) + return ndo +} + // Exec executes the deletion query. func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { n, err := ndo.nd.Exec(ctx) @@ -88,5 +94,7 @@ func (ndo *NodeDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (ndo *NodeDeleteOne) ExecX(ctx context.Context) { - ndo.nd.ExecX(ctx) + if err := ndo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/privacyadmin/ent/user_delete.go b/examples/privacyadmin/ent/user_delete.go index 7d6db9d27..6172b5122 100644 --- a/examples/privacyadmin/ent/user_delete.go +++ b/examples/privacyadmin/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/privacytenant/ent/group_delete.go b/examples/privacytenant/ent/group_delete.go index 5dda3f3e8..681121fc1 100644 --- a/examples/privacytenant/ent/group_delete.go +++ b/examples/privacytenant/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/privacytenant/ent/tenant_delete.go b/examples/privacytenant/ent/tenant_delete.go index 625412978..f05762230 100644 --- a/examples/privacytenant/ent/tenant_delete.go +++ b/examples/privacytenant/ent/tenant_delete.go @@ -73,6 +73,12 @@ type TenantDeleteOne struct { td *TenantDelete } +// Where appends a list predicates to the TenantDelete builder. +func (tdo *TenantDeleteOne) Where(ps ...predicate.Tenant) *TenantDeleteOne { + tdo.td.mutation.Where(ps...) + return tdo +} + // Exec executes the deletion query. func (tdo *TenantDeleteOne) Exec(ctx context.Context) error { n, err := tdo.td.Exec(ctx) @@ -88,5 +94,7 @@ func (tdo *TenantDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (tdo *TenantDeleteOne) ExecX(ctx context.Context) { - tdo.td.ExecX(ctx) + if err := tdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/privacytenant/ent/user_delete.go b/examples/privacytenant/ent/user_delete.go index f28a5b0b7..32e0f825d 100644 --- a/examples/privacytenant/ent/user_delete.go +++ b/examples/privacytenant/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/privacytenant/example_test.go b/examples/privacytenant/example_test.go index 159911c27..de5e2984e 100644 --- a/examples/privacytenant/example_test.go +++ b/examples/privacytenant/example_test.go @@ -115,8 +115,11 @@ func Example_TenantView() { client.User.Query().CountX(labView), // 0 ) - // DeleteOne with wrong viewer-context is nop. - client.User.DeleteOne(hubUsers[0]).ExecX(labView) + // DeleteOne with wrong viewer-context should cause the operation to fail with NotFoundError. + err := client.User.DeleteOne(hubUsers[0]).Exec(labView) + if !ent.IsNotFound(err) { + log.Fatal("expect user deletion to fail, but got:", err) + } fmt.Println(client.User.Query().CountX(hubView)) // 2 // Unlike queries, admin users are not allowed to mutate tenant specific data. diff --git a/examples/start/ent/car_delete.go b/examples/start/ent/car_delete.go index cedcabf30..d0ef82ce1 100644 --- a/examples/start/ent/car_delete.go +++ b/examples/start/ent/car_delete.go @@ -73,6 +73,12 @@ type CarDeleteOne struct { cd *CarDelete } +// Where appends a list predicates to the CarDelete builder. +func (cdo *CarDeleteOne) Where(ps ...predicate.Car) *CarDeleteOne { + cdo.cd.mutation.Where(ps...) + return cdo +} + // Exec executes the deletion query. func (cdo *CarDeleteOne) Exec(ctx context.Context) error { n, err := cdo.cd.Exec(ctx) @@ -88,5 +94,7 @@ func (cdo *CarDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (cdo *CarDeleteOne) ExecX(ctx context.Context) { - cdo.cd.ExecX(ctx) + if err := cdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/start/ent/group_delete.go b/examples/start/ent/group_delete.go index 104a860e4..dadad4d34 100644 --- a/examples/start/ent/group_delete.go +++ b/examples/start/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/start/ent/user_delete.go b/examples/start/ent/user_delete.go index b50135bba..e9fd1936e 100644 --- a/examples/start/ent/user_delete.go +++ b/examples/start/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/traversal/ent/group_delete.go b/examples/traversal/ent/group_delete.go index e607a1916..c53b9cc63 100644 --- a/examples/traversal/ent/group_delete.go +++ b/examples/traversal/ent/group_delete.go @@ -73,6 +73,12 @@ type GroupDeleteOne struct { gd *GroupDelete } +// Where appends a list predicates to the GroupDelete builder. +func (gdo *GroupDeleteOne) Where(ps ...predicate.Group) *GroupDeleteOne { + gdo.gd.mutation.Where(ps...) + return gdo +} + // Exec executes the deletion query. func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { n, err := gdo.gd.Exec(ctx) @@ -88,5 +94,7 @@ func (gdo *GroupDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (gdo *GroupDeleteOne) ExecX(ctx context.Context) { - gdo.gd.ExecX(ctx) + if err := gdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/traversal/ent/pet_delete.go b/examples/traversal/ent/pet_delete.go index 460f243bc..efb60b891 100644 --- a/examples/traversal/ent/pet_delete.go +++ b/examples/traversal/ent/pet_delete.go @@ -73,6 +73,12 @@ type PetDeleteOne struct { pd *PetDelete } +// Where appends a list predicates to the PetDelete builder. +func (pdo *PetDeleteOne) Where(ps ...predicate.Pet) *PetDeleteOne { + pdo.pd.mutation.Where(ps...) + return pdo +} + // Exec executes the deletion query. func (pdo *PetDeleteOne) Exec(ctx context.Context) error { n, err := pdo.pd.Exec(ctx) @@ -88,5 +94,7 @@ func (pdo *PetDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (pdo *PetDeleteOne) ExecX(ctx context.Context) { - pdo.pd.ExecX(ctx) + if err := pdo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/traversal/ent/user_delete.go b/examples/traversal/ent/user_delete.go index d09b7cdab..ce4c67401 100644 --- a/examples/traversal/ent/user_delete.go +++ b/examples/traversal/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } } diff --git a/examples/version/ent/user_delete.go b/examples/version/ent/user_delete.go index 168bd2cca..e51538b2b 100644 --- a/examples/version/ent/user_delete.go +++ b/examples/version/ent/user_delete.go @@ -73,6 +73,12 @@ type UserDeleteOne struct { ud *UserDelete } +// Where appends a list predicates to the UserDelete builder. +func (udo *UserDeleteOne) Where(ps ...predicate.User) *UserDeleteOne { + udo.ud.mutation.Where(ps...) + return udo +} + // Exec executes the deletion query. func (udo *UserDeleteOne) Exec(ctx context.Context) error { n, err := udo.ud.Exec(ctx) @@ -88,5 +94,7 @@ func (udo *UserDeleteOne) Exec(ctx context.Context) error { // ExecX is like Exec, but panics if an error occurs. func (udo *UserDeleteOne) ExecX(ctx context.Context) { - udo.ud.ExecX(ctx) + if err := udo.Exec(ctx); err != nil { + panic(err) + } }