From 17abe2d60fdfa91639369fb2d0f5cb7ba4950ec1 Mon Sep 17 00:00:00 2001 From: Ariel Mashraki <7413593+a8m@users.noreply.github.com> Date: Thu, 17 Sep 2020 09:19:55 +0300 Subject: [PATCH] entc/gen: less sophisticated naming logic (#774) Closed #772 --- entc/gen/func.go | 10 +- entc/gen/internal/bindata.go | 20 +- entc/gen/template/builder/query.tmpl | 24 +- entc/gen/template/builder/update.tmpl | 4 +- entc/gen/template/dialect/sql/create.tmpl | 16 +- entc/gen/template/dialect/sql/update.tmpl | 2 +- entc/gen/template/ent.tmpl | 2 +- entc/integration/config/ent/user_create.go | 10 +- entc/integration/config/ent/user_query.go | 24 +- entc/integration/config/ent/user_update.go | 14 +- entc/integration/customid/ent/blob_create.go | 12 +- entc/integration/customid/ent/blob_query.go | 24 +- entc/integration/customid/ent/blob_update.go | 14 +- entc/integration/customid/ent/car_create.go | 20 +- entc/integration/customid/ent/car_query.go | 24 +- entc/integration/customid/ent/car_update.go | 14 +- entc/integration/customid/ent/group_create.go | 14 +- entc/integration/customid/ent/group_query.go | 24 +- entc/integration/customid/ent/group_update.go | 14 +- entc/integration/customid/ent/pet_create.go | 10 +- entc/integration/customid/ent/pet_query.go | 24 +- entc/integration/customid/ent/pet_update.go | 14 +- entc/integration/customid/ent/user_create.go | 14 +- entc/integration/customid/ent/user_query.go | 24 +- entc/integration/customid/ent/user_update.go | 14 +- entc/integration/ent/card_create.go | 18 +- entc/integration/ent/card_query.go | 24 +- entc/integration/ent/card_update.go | 14 +- entc/integration/ent/client.go | 95 ++ entc/integration/ent/comment_create.go | 16 +- entc/integration/ent/comment_query.go | 24 +- entc/integration/ent/comment_update.go | 14 +- entc/integration/ent/config.go | 1 + entc/integration/ent/fieldtype_create.go | 100 +- entc/integration/ent/fieldtype_query.go | 24 +- entc/integration/ent/fieldtype_update.go | 14 +- entc/integration/ent/file_create.go | 20 +- entc/integration/ent/file_query.go | 24 +- entc/integration/ent/file_update.go | 14 +- entc/integration/ent/filetype_create.go | 16 +- entc/integration/ent/filetype_query.go | 24 +- entc/integration/ent/filetype_update.go | 14 +- entc/integration/ent/goods.go | 80 ++ entc/integration/ent/goods/goods.go | 34 + entc/integration/ent/goods/where.go | 127 +++ entc/integration/ent/goods_create.go | 170 ++++ entc/integration/ent/goods_delete.go | 113 +++ entc/integration/ent/goods_query.go | 860 ++++++++++++++++++ entc/integration/ent/goods_update.go | 210 +++++ entc/integration/ent/group_create.go | 20 +- entc/integration/ent/group_query.go | 24 +- entc/integration/ent/group_update.go | 14 +- entc/integration/ent/groupinfo_create.go | 14 +- entc/integration/ent/groupinfo_query.go | 24 +- entc/integration/ent/groupinfo_update.go | 14 +- entc/integration/ent/hook/hook.go | 13 + entc/integration/ent/item_create.go | 10 +- entc/integration/ent/item_query.go | 24 +- entc/integration/ent/item_update.go | 14 +- entc/integration/ent/migrate/schema.go | 12 + entc/integration/ent/mutation.go | 231 +++++ entc/integration/ent/node_create.go | 12 +- entc/integration/ent/node_query.go | 24 +- entc/integration/ent/node_update.go | 14 +- entc/integration/ent/pet_create.go | 12 +- entc/integration/ent/pet_query.go | 24 +- entc/integration/ent/pet_update.go | 14 +- entc/integration/ent/predicate/predicate.go | 3 + entc/integration/ent/privacy/privacy.go | 24 + entc/integration/ent/schema/goods.go | 22 + entc/integration/ent/spec_create.go | 10 +- entc/integration/ent/spec_query.go | 24 +- entc/integration/ent/spec_update.go | 14 +- entc/integration/ent/task_create.go | 12 +- entc/integration/ent/task_query.go | 24 +- entc/integration/ent/task_update.go | 14 +- entc/integration/ent/tx.go | 3 + entc/integration/ent/user_create.go | 28 +- entc/integration/ent/user_query.go | 24 +- entc/integration/ent/user_update.go | 14 +- entc/integration/gremlin/ent/card_query.go | 24 +- entc/integration/gremlin/ent/card_update.go | 4 +- entc/integration/gremlin/ent/client.go | 94 ++ entc/integration/gremlin/ent/comment_query.go | 24 +- .../integration/gremlin/ent/comment_update.go | 4 +- entc/integration/gremlin/ent/config.go | 1 + .../gremlin/ent/fieldtype_query.go | 24 +- .../gremlin/ent/fieldtype_update.go | 4 +- entc/integration/gremlin/ent/file_query.go | 24 +- entc/integration/gremlin/ent/file_update.go | 4 +- .../integration/gremlin/ent/filetype_query.go | 24 +- .../gremlin/ent/filetype_update.go | 4 +- entc/integration/gremlin/ent/goods.go | 93 ++ entc/integration/gremlin/ent/goods/goods.go | 16 + entc/integration/gremlin/ent/goods/where.go | 120 +++ entc/integration/gremlin/ent/goods_create.go | 105 +++ entc/integration/gremlin/ent/goods_delete.go | 111 +++ entc/integration/gremlin/ent/goods_query.go | 839 +++++++++++++++++ entc/integration/gremlin/ent/goods_update.go | 206 +++++ entc/integration/gremlin/ent/group_query.go | 24 +- entc/integration/gremlin/ent/group_update.go | 4 +- .../gremlin/ent/groupinfo_query.go | 24 +- .../gremlin/ent/groupinfo_update.go | 4 +- entc/integration/gremlin/ent/hook/hook.go | 13 + entc/integration/gremlin/ent/item_query.go | 24 +- entc/integration/gremlin/ent/item_update.go | 4 +- entc/integration/gremlin/ent/mutation.go | 231 +++++ entc/integration/gremlin/ent/node_query.go | 24 +- entc/integration/gremlin/ent/node_update.go | 4 +- entc/integration/gremlin/ent/pet_query.go | 24 +- entc/integration/gremlin/ent/pet_update.go | 4 +- .../gremlin/ent/predicate/predicate.go | 3 + .../gremlin/ent/privacy/privacy.go | 24 + entc/integration/gremlin/ent/spec_query.go | 24 +- entc/integration/gremlin/ent/spec_update.go | 4 +- entc/integration/gremlin/ent/task_query.go | 24 +- entc/integration/gremlin/ent/task_update.go | 4 +- entc/integration/gremlin/ent/tx.go | 3 + entc/integration/gremlin/ent/user_query.go | 24 +- entc/integration/gremlin/ent/user_update.go | 4 +- entc/integration/hooks/ent/card_create.go | 18 +- entc/integration/hooks/ent/card_query.go | 24 +- entc/integration/hooks/ent/card_update.go | 14 +- entc/integration/hooks/ent/user_create.go | 16 +- entc/integration/hooks/ent/user_query.go | 24 +- entc/integration/hooks/ent/user_update.go | 14 +- entc/integration/idtype/ent/user_create.go | 12 +- entc/integration/idtype/ent/user_query.go | 24 +- entc/integration/idtype/ent/user_update.go | 14 +- entc/integration/json/ent/user_create.go | 24 +- entc/integration/json/ent/user_query.go | 24 +- entc/integration/json/ent/user_update.go | 14 +- entc/integration/migrate/entv1/car_create.go | 10 +- entc/integration/migrate/entv1/car_query.go | 24 +- entc/integration/migrate/entv1/car_update.go | 14 +- entc/integration/migrate/entv1/user_create.go | 30 +- entc/integration/migrate/entv1/user_query.go | 24 +- entc/integration/migrate/entv1/user_update.go | 14 +- entc/integration/migrate/entv2/car_create.go | 10 +- entc/integration/migrate/entv2/car_query.go | 24 +- entc/integration/migrate/entv2/car_update.go | 14 +- .../integration/migrate/entv2/group_create.go | 10 +- entc/integration/migrate/entv2/group_query.go | 24 +- .../integration/migrate/entv2/group_update.go | 14 +- entc/integration/migrate/entv2/pet_create.go | 10 +- entc/integration/migrate/entv2/pet_query.go | 24 +- entc/integration/migrate/entv2/pet_update.go | 14 +- entc/integration/migrate/entv2/user_create.go | 38 +- entc/integration/migrate/entv2/user_query.go | 24 +- entc/integration/migrate/entv2/user_update.go | 14 +- entc/integration/privacy/ent/galaxy_create.go | 14 +- entc/integration/privacy/ent/galaxy_query.go | 24 +- entc/integration/privacy/ent/galaxy_update.go | 14 +- entc/integration/privacy/ent/planet_create.go | 14 +- entc/integration/privacy/ent/planet_query.go | 24 +- entc/integration/privacy/ent/planet_update.go | 14 +- entc/integration/template/ent/group_create.go | 12 +- entc/integration/template/ent/group_query.go | 24 +- entc/integration/template/ent/group_update.go | 14 +- entc/integration/template/ent/pet_create.go | 14 +- entc/integration/template/ent/pet_query.go | 24 +- entc/integration/template/ent/pet_update.go | 14 +- entc/integration/template/ent/user_create.go | 12 +- entc/integration/template/ent/user_query.go | 24 +- entc/integration/template/ent/user_update.go | 14 +- examples/edgeindex/ent/city_create.go | 12 +- examples/edgeindex/ent/city_query.go | 24 +- examples/edgeindex/ent/city_update.go | 14 +- examples/edgeindex/ent/street_create.go | 12 +- examples/edgeindex/ent/street_query.go | 24 +- examples/edgeindex/ent/street_update.go | 14 +- examples/entcpkg/ent/user_create.go | 10 +- examples/entcpkg/ent/user_query.go | 24 +- examples/entcpkg/ent/user_update.go | 14 +- examples/m2m2types/ent/group_create.go | 12 +- examples/m2m2types/ent/group_query.go | 24 +- examples/m2m2types/ent/group_update.go | 14 +- examples/m2m2types/ent/user_create.go | 14 +- examples/m2m2types/ent/user_query.go | 24 +- examples/m2m2types/ent/user_update.go | 14 +- examples/m2mbidi/ent/user_create.go | 14 +- examples/m2mbidi/ent/user_query.go | 24 +- examples/m2mbidi/ent/user_update.go | 14 +- examples/m2mrecur/ent/user_create.go | 14 +- examples/m2mrecur/ent/user_query.go | 24 +- examples/m2mrecur/ent/user_update.go | 14 +- examples/o2m2types/ent/pet_create.go | 12 +- examples/o2m2types/ent/pet_query.go | 24 +- examples/o2m2types/ent/pet_update.go | 14 +- examples/o2m2types/ent/user_create.go | 14 +- examples/o2m2types/ent/user_query.go | 24 +- examples/o2m2types/ent/user_update.go | 14 +- examples/o2mrecur/ent/node_create.go | 12 +- examples/o2mrecur/ent/node_query.go | 24 +- examples/o2mrecur/ent/node_update.go | 14 +- examples/o2o2types/ent/card_create.go | 14 +- examples/o2o2types/ent/card_query.go | 24 +- examples/o2o2types/ent/card_update.go | 14 +- examples/o2o2types/ent/user_create.go | 14 +- examples/o2o2types/ent/user_query.go | 24 +- examples/o2o2types/ent/user_update.go | 14 +- examples/o2obidi/ent/user_create.go | 14 +- examples/o2obidi/ent/user_query.go | 24 +- examples/o2obidi/ent/user_update.go | 14 +- examples/o2orecur/ent/node_create.go | 12 +- examples/o2orecur/ent/node_query.go | 24 +- examples/o2orecur/ent/node_update.go | 14 +- examples/start/ent/car_create.go | 14 +- examples/start/ent/car_query.go | 24 +- examples/start/ent/car_update.go | 14 +- examples/start/ent/group_create.go | 12 +- examples/start/ent/group_query.go | 24 +- examples/start/ent/group_update.go | 14 +- examples/start/ent/user_create.go | 14 +- examples/start/ent/user_query.go | 24 +- examples/start/ent/user_update.go | 14 +- examples/traversal/ent/group_create.go | 12 +- examples/traversal/ent/group_query.go | 24 +- examples/traversal/ent/group_update.go | 14 +- examples/traversal/ent/pet_create.go | 12 +- examples/traversal/ent/pet_query.go | 24 +- examples/traversal/ent/pet_update.go | 14 +- examples/traversal/ent/user_create.go | 14 +- examples/traversal/ent/user_query.go | 24 +- examples/traversal/ent/user_update.go | 14 +- 225 files changed, 5542 insertions(+), 1679 deletions(-) create mode 100644 entc/integration/ent/goods.go create mode 100644 entc/integration/ent/goods/goods.go create mode 100644 entc/integration/ent/goods/where.go create mode 100644 entc/integration/ent/goods_create.go create mode 100644 entc/integration/ent/goods_delete.go create mode 100644 entc/integration/ent/goods_query.go create mode 100644 entc/integration/ent/goods_update.go create mode 100644 entc/integration/ent/schema/goods.go create mode 100644 entc/integration/gremlin/ent/goods.go create mode 100644 entc/integration/gremlin/ent/goods/goods.go create mode 100644 entc/integration/gremlin/ent/goods/where.go create mode 100644 entc/integration/gremlin/ent/goods_create.go create mode 100644 entc/integration/gremlin/ent/goods_delete.go create mode 100644 entc/integration/gremlin/ent/goods_query.go create mode 100644 entc/integration/gremlin/ent/goods_update.go diff --git a/entc/gen/func.go b/entc/gen/func.go index cd320aca8..5401e66bb 100644 --- a/entc/gen/func.go +++ b/entc/gen/func.go @@ -8,6 +8,7 @@ import ( "bytes" "errors" "fmt" + "go/token" "path/filepath" "reflect" "sort" @@ -202,10 +203,15 @@ func receiver(s string) (r string) { r += w[:i] } if _, ok := importPkg[r]; !ok { - return r + s = r + break } } - return strings.ToLower(s) + name := strings.ToLower(s) + if token.Lookup(name).IsKeyword() { + name = "_" + name + } + return name } // typeScope wraps the Type object with extended scope. diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 56811a1c6..77904a9ae 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -206,7 +206,7 @@ func templateBuilderMutationTmpl() (*asset, error) { return a, nil } -var _templateBuilderQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x5a\x5f\x8f\xdb\x36\x12\x7f\xb6\x3f\xc5\xd4\xd8\x2e\xec\x85\x57\x4e\xf2\x76\x7b\xd8\x03\xd2\x6c\x72\x67\xa0\x48\xdb\x24\x87\x16\x08\x82\x94\x2b\x8d\x6c\x36\x32\xa5\x92\x94\x77\x17\x7b\xfe\xee\x07\x0e\x29\x89\xfa\xb7\x96\x37\x6e\x6f\x7b\x4f\xb6\x24\x72\x38\x9c\xf9\xcd\x8f\x43\x0e\xef\xef\x17\x67\xe3\x57\x69\x76\x27\xf9\x6a\xad\xe1\xc5\xb3\xe7\x7f\x3b\xcf\x24\x2a\x14\x1a\xde\xb0\x10\xaf\xd3\xf4\x0b\x2c\x45\x18\xc0\xcb\x24\x01\x6a\xa4\xc0\x7c\x97\x5b\x8c\x82\xf1\x87\x35\x57\xa0\xd2\x5c\x86\x08\x61\x1a\x21\x70\x05\x09\x0f\x51\x28\x8c\x20\x17\x11\x4a\xd0\x6b\x84\x97\x19\x0b\xd7\x08\x2f\x82\x67\xc5\x57\x88\xd3\x5c\x44\x63\x2e\xe8\xfb\xf7\xcb\x57\xaf\xdf\xbe\x7f\x0d\x31\x4f\x10\xdc\x3b\x99\xa6\x1a\x22\x2e\x31\xd4\xa9\xbc\x83\x34\x06\xed\x0d\xa6\x25\x62\x30\x3e\x5b\xec\x76\xe3\xf1\xfd\x3d\x44\x18\x73\x81\x30\xf9\x3d\x47\x79\x37\x81\xdd\xce\xbc\x3c\xc9\xbe\xac\xe0\xe2\x12\xae\x99\x42\x38\x09\x5e\xa5\x22\xe6\xab\xe0\x47\x16\x7e\x61\x2b\x04\xd7\x53\xe3\x26\x4b\x98\x46\x98\xac\x91\x45\x28\x27\x70\xd2\xfe\xc4\x37\x59\x2a\x75\xf1\xc9\x3e\xc1\x74\x3c\xba\xbf\x3f\x07\xc9\xc4\x0a\xe1\x24\x63\x7a\x6d\x06\x3b\x09\xde\xf3\xeb\x84\x8b\xd5\x92\x5a\x29\xd3\x63\x34\x9a\x90\x3a\xa6\xc9\x6e\x37\xb1\xfd\x50\x44\xe6\xdb\x6c\x4c\x63\x9d\x5c\xe7\x3c\x31\xe6\x22\x11\x3f\x99\x69\xbc\x65\x1b\x2c\x66\x22\x31\x44\xbe\xb5\x9f\xcb\xff\x65\x1f\xa3\xd4\x62\x01\xbe\x98\xdd\xce\xb8\xc2\xd8\xb1\x78\x13\xa7\x12\xc8\x3c\x5c\xac\x4c\xd3\x8c\xa9\x90\x25\x70\x12\xb8\x71\x00\x85\xe6\x9a\xa3\x0a\xc6\xfa\x2e\xc3\xa6\x34\xa5\x65\x1e\x6a\xb8\x1f\x8f\x42\xb2\xe3\x78\x94\xf0\x0d\xd7\xa3\xd1\x19\x17\x7a\x3c\x4a\xe3\x58\x61\xf5\x24\x23\x94\xa3\xd1\xc7\x4f\x3f\x98\x3f\x6f\x72\x11\x8e\x47\xb9\xe0\xbf\xe7\x68\x5e\x2a\x2d\xb9\x58\x8d\x47\x99\xc4\x88\x87\x4c\xa3\x82\xd1\xc7\x4f\xe5\x53\x60\x46\x2e\xb4\xb2\xb6\xba\xe1\x7a\x0d\x27\xc1\xeb\x68\x85\xce\xa0\x8b\x05\x20\x5b\xa1\x3c\x4f\x52\x16\x99\x19\xa1\xf9\x16\x8c\x47\xbe\x4f\xd0\x98\x2b\xb0\x1d\x46\x46\x86\x37\x6d\x2c\xe7\x7d\x66\xc6\xc3\xe0\xc3\x5d\x86\x75\xc3\x8f\x7c\x3f\xb5\xfe\x2f\xce\xe0\x65\x14\x71\xcd\x53\xc1\x12\x88\x39\x26\x91\x02\x9d\x02\x8b\x22\xf3\xe3\x99\x3e\x00\xc2\x29\xf5\x3a\xd1\x9b\x2c\x31\x6a\x65\x92\x0b\x1d\xc3\x24\xe2\x2c\xc1\x50\x2f\xbe\x55\x0b\xf2\xce\xc2\x4a\x9a\x18\x20\xe9\x54\x3a\xa4\x52\x5f\x1e\xc3\x9a\xa9\x0f\x05\x2a\xad\xa8\x52\xcf\x5b\x5d\xff\x10\xb4\xb4\x5e\x2c\x80\x0b\x8d\x72\x83\x11\x37\xed\x68\x3c\x98\xf2\x00\x03\xd0\x92\x6d\x51\x2a\x96\x80\x41\xe9\x2c\x30\x3d\x6b\x2a\x80\xff\x1c\x7c\x57\x21\x6f\x44\xb0\x8e\x73\x11\x4e\xc3\x54\x68\xbc\xd5\x26\xd2\xcc\xef\x0c\xa6\x3d\x9d\xe6\x80\x52\xa6\x72\x36\xb6\xc0\xfd\x79\x8d\x12\x8d\xe1\x14\x30\x10\x78\x03\x25\x16\x08\xb5\xbe\x29\xc7\x66\x20\x2b\xb7\x8c\x83\xc2\x87\x15\x5a\x67\x56\xe4\x34\x53\x10\x04\x41\x37\xb2\x66\xcd\x4e\x06\xdb\xbe\xdc\xdd\x2e\xf0\x10\x7a\x09\x2c\xcb\x50\x44\xcd\xa1\xbd\x36\x73\xc8\x54\x10\x04\xb3\xf1\x48\xa2\xce\xa5\x80\x46\x53\x37\xdb\xef\x4d\xdc\x14\xb3\xa5\x20\x02\xa5\x31\x2b\x40\x43\x5e\x19\x3c\x4f\x12\x36\xb5\x52\xb8\xd0\x7b\x27\x65\x34\xb6\xad\x2f\xe1\x94\xfe\xec\xd1\xf6\x07\x0a\x6c\xa7\xae\x00\x1b\xe7\x5f\xa1\xb0\x95\x37\x75\x72\x86\xaa\xec\x9a\x5f\xc2\xa9\xfd\xb7\x4f\x69\x43\x3b\x95\xce\xf4\xf4\x15\x2a\x9b\xfe\xd3\xd4\x40\xa9\xe4\xb3\x61\x5a\xd3\xc0\xbd\xc8\xa1\xcf\x73\x48\xf7\x61\xc6\xac\xd1\x76\xf1\xa3\x25\x76\xcd\x14\x28\xbe\xe1\x09\x93\x5c\xdf\x59\x6e\x34\xec\x47\xb3\xe2\xa8\xcc\x02\x1a\x26\x1c\x85\x0e\x88\x08\x88\x7c\xee\xef\x0b\x52\xfc\x3c\x77\xc4\xe8\xf3\x29\x51\x60\xb4\xc2\xcf\xde\x32\x44\x0c\x05\xd3\x8a\x30\x89\x21\x4d\xf4\xcc\x60\xf2\x53\xb9\xd0\x1a\x5a\xa1\xa7\x4e\x72\x0d\xd7\x8c\x0b\xbb\x10\x85\xb9\x94\x26\xad\xb0\xb4\x93\xda\x55\xde\x72\x6f\xb9\x04\x45\x2b\x0c\xc6\xa3\x81\x7e\xe9\x1d\x75\xea\xbc\x53\x9b\x91\x75\xd1\xc8\x8e\x7e\x71\x09\xa7\x1d\x2d\xee\xed\xda\x76\xd1\xf4\x42\x60\xdf\xef\x8a\xfe\x01\x71\xde\xa5\x63\x3d\x7d\x0b\x6d\xe6\x8b\x65\xba\xf9\x77\x1f\x69\x12\xff\x39\x0e\x24\xad\x46\x3c\xa6\x57\x17\x97\xad\xa1\x33\x89\x19\x93\x48\x93\x35\x63\xcd\xfe\x4e\x2d\xbf\xb9\x04\xc1\x13\xdb\xb9\xc0\x8e\xe0\x09\x49\x36\xef\x68\xcd\x2b\xd7\x4e\xbc\xd5\x66\x15\x38\x81\xc9\x3b\x27\x7a\xe2\x8d\x32\x31\x40\x98\x18\x58\x4c\x96\x11\x0a\x3d\x81\x09\xa9\x3f\x81\x73\xbb\x76\x12\x3e\xf6\xae\x5c\xc6\x28\xcd\x75\x6b\xf4\xd0\xe2\x54\x2d\xb0\x6e\x1c\x37\x0f\x1a\x7c\x6e\xa6\x33\xb6\x13\x71\xef\x69\x98\xf1\x88\xd0\xec\x16\x35\x13\xed\x6f\xb8\x54\x1a\x6c\x1b\x0b\xb5\x98\xde\xf8\x6c\x6f\xb3\x9b\xbb\x22\xb9\xb4\x5e\x84\x77\xae\xcf\xd9\xdb\x54\xbf\x31\x09\xe9\x6b\xe3\x12\xb8\x59\xa3\x00\x91\x1a\x01\x49\x7a\x63\x32\xad\x52\xcc\x0d\x53\x36\x75\x1d\xcc\x1e\xa4\x5d\x0f\x48\xce\x7c\x15\xe7\x1e\x20\x0c\xaa\x93\x5c\x52\x7e\xf6\xae\x92\x3e\xef\x03\x89\x5d\x06\x9e\xcf\x82\x97\x49\x42\x20\x19\x17\x88\xf2\x70\xd2\x42\xc9\x8e\x5a\x25\x28\xa6\x3d\xe3\xcd\xe0\xf2\x12\x9e\xb5\x3a\x9f\xd6\xcc\x75\x6f\x0d\x5d\xe5\xd5\xc1\xf7\xec\x1a\x93\x1d\xc9\xaf\x58\xad\x4b\xfe\xc7\x67\x9f\xac\x9b\x3d\x47\xfe\x62\xf7\x10\x5f\xd0\x3e\xce\xe1\x3a\xd7\x90\x31\xc1\x43\x65\x32\x20\x26\xac\x99\x20\x0d\xc3\x5c\xaa\xc3\xdc\xf0\x4b\xb7\x1f\x6a\x6e\x28\x88\x7c\x90\xdd\x4b\xe7\xb6\x0c\x7e\x7a\x0a\xdf\x2c\x55\x61\xa8\x29\x4a\x17\xe9\x34\x13\x7a\x6c\xd8\xa7\x36\xa0\x6f\x90\xe5\xd5\x3e\x6c\xf3\xe8\x30\x5c\xf3\xe8\xb1\x38\x5e\x5e\xf5\x20\x99\x47\x56\xa5\xe5\x15\x2d\x13\x1d\x1c\xb7\x65\x12\x78\xa4\xe0\xe3\xa7\x46\x43\xb2\x1c\x8f\x94\xed\xf0\x00\xb6\x97\x57\xaa\x9b\x00\xad\x79\x7c\x3c\xf3\x48\x79\xd8\xb5\x72\x87\xa2\xd6\x17\xe7\xdc\xc3\x23\xd5\x09\xd5\xe5\x55\x1d\xac\xcb\xab\xe3\xc2\xb5\xcf\xdc\x0d\x0b\x9a\x49\xf2\xe8\x61\x90\x5a\x51\x5f\x09\x53\x1e\x15\x09\x96\x48\xee\x6a\xa8\x4c\xcd\x8b\x7d\x84\x3b\x2f\xbb\x94\x66\xe1\x31\x88\x54\x03\xde\xb2\x50\x27\x26\x2b\xc0\xa2\xa3\x41\xa8\x6d\x8e\xc3\x41\x6a\xf4\xfa\x73\xb8\xf6\xc5\xe1\x5c\xab\x6e\xb8\x0e\xd7\x0f\xf3\xad\xd9\x5f\x33\x85\xf0\xfc\xa2\x12\xb2\x8f\x3c\x6d\x8f\x67\x17\x8f\x64\xe9\x08\x63\x96\x27\xba\xab\xfb\x7b\x2e\x56\x79\xc2\xe4\x5e\x9e\xaf\x50\x51\xd1\xb7\x79\x3a\x56\x38\x90\xe4\x63\x93\x77\x01\x96\x4e\x07\x1e\xc4\xd3\x46\x52\x83\xa6\xdb\x01\xd1\x60\xe9\x61\xc1\xe0\xa8\xfa\x51\x81\xf0\xbf\x23\xeb\x17\xc3\xc8\xda\x0b\x08\x22\xec\x1a\xf8\x79\x04\x97\x8e\x78\x7d\x84\x1f\xc6\xe5\x1e\xb6\xab\x8e\x83\x51\x5d\xe8\xea\x3b\xb9\x8e\xef\xe3\x11\xbe\x93\x7e\x0c\xbe\xaf\x7c\x7f\x00\xb2\x4b\x6a\x7f\x99\x24\x80\xb7\x18\xe6\x1a\x55\x85\x56\x60\x22\xaa\x00\x0b\x09\x57\x1a\xd2\xb8\x46\x4d\x0e\xe7\x83\x67\xec\xe8\xb3\x03\x9f\x1f\x3f\xf5\x92\xf5\xd7\xec\x93\xba\x38\xb9\x7b\xd7\x1d\x34\x0e\xbf\x4a\xa6\x2f\x4d\x54\xc1\xe0\x65\x92\x1c\x0b\x03\x46\x6e\xb7\x49\x1a\x16\x79\xcc\xb2\xf5\xd0\x6a\xd5\x4b\x76\x5d\x23\x38\x23\x2c\xaf\xd4\x41\x38\xf1\x89\x70\xb8\x49\x1c\x8d\x74\x82\xa4\x8b\xc3\x06\xf1\x57\x8f\x85\xde\xa3\xd9\xcf\x4e\x9b\x7c\xf0\x86\x63\x12\x2d\xaf\x66\xc1\xfb\x90\x09\xa3\xcc\x1c\x4e\x0d\x5d\x1d\x82\x2f\x62\xcc\x2a\x7b\x5c\x5e\xa9\x0a\x40\xcb\x2b\x75\x2c\x00\x19\xb9\x7d\x00\xea\xe4\x10\xd5\x0b\x97\x82\xbf\x0f\x61\x10\xe5\xa6\xf7\x2a\xcd\x45\x7d\x43\x1e\xd2\x1b\xaa\xe1\x20\xac\xf8\x16\xc5\x81\x67\x70\x24\xb2\x6f\x39\x13\xfa\xc8\x14\xf1\xec\x50\x82\x28\xd5\x9b\xf9\x26\xa8\x7c\x4c\x8f\xc7\xf2\xb2\x95\xdd\x6d\x0c\x2e\x5c\x8d\x26\x77\x46\xe9\xb2\x83\xa7\xed\x60\xef\x92\x44\x37\xb9\xd7\xb7\xdc\x3f\x70\x91\x39\x9a\xe9\x54\x1c\xb0\x66\x0a\x30\xc1\x0d\x0a\xad\x8a\x9c\x67\x25\x59\xb6\x1e\x3c\x45\x1a\xa1\xc7\xdd\xd7\x69\x9a\x1c\xd9\xdf\x31\x4b\x14\x1e\xea\xf3\x52\xc7\x99\x6f\x96\xca\xe7\xf4\x78\x2c\x9f\x5b\xd9\xdd\x16\x31\x06\x31\xb3\x41\x3b\x60\x8f\x31\x3c\x75\x07\x3b\x9d\x24\x16\x88\x4e\x4c\x3e\x5a\x51\x7b\x94\x67\x89\xad\xd1\xa4\xbe\xef\x9d\xd2\x73\xe0\x22\x4c\x72\x2a\xcd\xb1\x24\x01\xa6\x54\x1a\x72\xa6\x31\xa2\x83\x78\x15\xc0\x52\x43\xc8\x04\x5c\xa3\x11\x9e\x2b\xa4\xaa\x99\xf3\x18\x84\xe9\x66\x93\x8a\xba\x48\x45\x6b\x4b\xae\xd0\x8c\xb6\x81\x88\xc7\x31\x4a\x14\x26\x53\x66\xb1\x76\x95\xe6\x90\xb4\xe4\x0a\x36\x2c\xc2\xe1\x11\x65\x7a\x4d\x3b\xcf\xf4\x9d\x25\x4e\xeb\x5f\x8c\xc9\x8a\xb3\xe2\xd6\xb1\xbf\xfd\x30\x1f\x8f\x6c\x89\xf4\x02\x46\xdd\x25\x18\xd3\xc2\x96\x33\x3a\x84\xd8\x0f\xd4\x44\x46\x28\x8d\x10\x57\x46\xf0\xaa\xaa\xf7\xbb\x79\xcb\xcf\xd4\x3c\x08\x82\x99\xe9\x6b\x8b\xae\x17\x50\xf5\xb5\xc5\xd7\xae\x8e\xb6\x6d\xd1\xb3\x2a\x6b\x5d\x40\xd9\xb9\xbb\x92\xd6\x25\xac\xea\x5e\x08\x5c\x2c\x0a\xe7\xb4\x6a\x90\xb6\x6c\x5b\x0b\xae\xf6\x11\x7c\xa3\x41\xe0\x7c\x46\xba\x32\xbd\x6e\x77\x30\x6f\xe7\x6e\x73\xda\x2c\x0a\xb7\x6a\x1f\x7e\xf9\xbd\xb3\x16\xbc\x58\x00\xfc\xdc\x57\x42\xd6\x98\x24\x5e\x12\x74\x5e\x48\xd3\xa9\x57\xa5\xb6\x0d\x44\x1a\x51\xbe\xc4\x34\x58\xa0\x0b\x81\xa1\x26\xf4\xd3\x20\xa6\xcd\xa4\x56\x15\x99\xd8\xb2\x08\x7c\x30\xbb\xca\xcc\xd5\x9b\x99\x5c\xe5\x96\x5f\x8b\xd0\xb1\xa8\xcb\x25\xb6\x83\xb1\x88\xd0\xc3\xca\x2b\x7d\xb3\x9d\xa6\x99\xa6\xba\x2a\x55\x3f\xce\x6a\xe6\xdb\xed\x66\x9d\x51\xd4\x2c\xbb\x1c\x54\x72\x89\x53\x09\x9f\xe7\x66\xee\x74\xfd\x81\xdc\x48\x3a\x50\xf1\x23\xcd\xf4\x94\xa4\xcf\x5c\xb1\xa0\x29\xa8\xb7\xf0\x7f\x59\x14\x14\xfa\x6a\x6f\x54\x69\x28\xeb\xe7\x74\x11\x63\x25\xd3\x3c\xfb\xce\x2b\x92\xd5\x6e\x51\xfc\xa7\x2c\x8e\x7c\xab\xfe\x49\x2d\x6d\x8d\xcc\x50\x9c\x7b\x2e\xfd\x45\x92\x60\x8b\x52\xf3\x10\x15\x5c\xdb\xfd\x7e\x2a\x61\x93\x4a\x74\xf7\x09\x16\x61\x9a\xe4\x1b\xa1\x02\x4a\x1a\xb5\xe1\xb5\x34\xd6\x28\xac\x10\xaa\xec\xb0\xd5\x4a\xe2\x8a\x4a\xe5\xb9\x08\x0d\x3a\xd4\x9c\xd6\x1f\xb2\xe8\x6f\x29\x17\x30\xfd\x82\x77\xaa\x6a\x38\x83\xc9\x1c\x26\xb4\x53\x2b\xeb\x43\x09\x0a\x38\xb1\x99\xae\xb2\x77\x4e\xce\xe1\x24\x36\x13\xe4\x22\xc2\xdb\xea\xdb\x33\xf3\x75\xb1\xb0\xcb\x1d\xdb\x64\x09\x5e\xd8\x47\x4a\xb9\xb7\x40\x04\x63\x2f\x8a\x2c\x16\xd6\x17\x71\xf0\x9e\x5e\x91\x84\xe2\x26\x41\x5c\xe6\xa1\xbf\xfa\x6d\x3e\xb0\x15\xec\x76\xbf\x52\x5f\x9b\x45\x9a\x84\xe6\xd7\xdf\x54\x2a\x2e\x26\x36\xa9\x49\x37\x5c\xe3\x26\xd3\x77\x13\x6a\xe6\xb4\x19\xb9\x8a\x67\xc7\xc5\x16\x1b\xc8\xd3\x59\x40\x52\x9d\x1b\x5a\x59\xbe\xd5\xe2\x55\x2a\x94\x66\x42\x1b\x20\xdb\xf6\x2f\x0b\xb3\x51\x8f\xec\xcb\xaa\x4a\xa0\x66\xae\x89\xb7\x2f\xd8\xce\x8c\x3a\x1e\x68\x06\xc6\x5a\xa1\x15\xb9\x1d\x2c\x47\xcf\x8b\x4b\x25\x41\x10\xd8\x37\x2e\xb4\x6a\x18\xb4\xf1\x65\xc1\x54\x84\x57\xa3\xc1\xfe\x10\xa3\x0e\x81\x1b\xee\x12\x9a\x8b\x05\x7d\xd8\x15\xfa\xd8\x72\xb5\xed\xb2\xbf\x0e\x9a\x49\xdc\x0e\x2e\x83\x7e\x55\x15\xb4\x5d\x04\xdd\xf5\x86\x76\x73\x35\x71\x10\x71\xe7\xa9\x55\x02\x44\xb3\x1c\xbb\xd8\x57\xb4\x3f\x1c\x14\xfc\x76\x2b\x59\xc6\xbe\x7d\xec\x08\x70\x2a\x75\xb6\x37\x45\x4f\x39\x2e\x0f\x0d\xb8\x9e\x5d\x75\x5f\xbc\x1d\x21\x98\xdc\x88\x83\x62\xa9\xee\x53\x1b\x4c\xf6\x5d\x2a\xcb\x78\x6a\x36\xda\x1f\x50\x85\x88\xc3\x62\xaa\xec\xf5\xff\x1e\x56\xc5\x44\x4d\x64\x0d\x74\x6a\x53\xd3\xb6\x4d\xec\xbe\xca\x6e\x08\xbb\x72\xc1\xda\x76\x47\xe2\xb6\x77\xa7\x64\x1a\xbb\x8d\x52\xc7\x4e\xa9\xdc\x1b\x95\xb6\xd8\x63\x04\xb8\x34\xca\x6f\x69\xfe\xee\x1a\xdf\x49\xf0\x2f\xa6\x7e\x4c\x13\x1e\xde\xd9\x8b\x10\x75\x0f\xf9\x71\x62\x5b\x05\xaf\xb7\x2c\x29\xe7\xde\x4a\xb7\xfb\xdd\x56\x6a\xe9\x5f\x04\xac\x5c\xea\xa8\xad\x71\x47\xc4\x41\x69\x52\x79\x60\xe2\x34\x9a\x14\x4b\xe0\x78\xd0\x95\x90\xf6\x2d\xc6\xee\x9b\x20\xde\x7d\x0e\xba\xec\x44\xb4\x7b\x5d\xe5\xaf\xe5\x3d\x5f\xbb\xb4\xbd\xeb\xbc\x0d\xdb\x58\xf5\xca\x2b\xb1\xcd\xe5\xb2\xe3\x5e\x2c\x35\x39\xbf\xbe\x1b\x7a\x2f\xb6\x29\xb2\x7d\x39\xd6\xc5\x7d\x75\xd9\x35\x16\x0a\x00\xe0\xe3\xa7\x32\xa1\xb0\xd7\x62\x9f\xec\xa5\xcc\x52\x4f\x7b\x8f\xae\x5a\xa3\x8a\x44\x92\xa7\xa2\xca\x39\x8b\x9b\x75\xa5\x25\x5b\xc7\x7b\x75\xcf\x15\x21\xde\xb0\xe4\xac\x1a\x76\x6a\x2c\x16\x04\x41\xcd\x5e\xfd\x19\x50\xd7\x10\x81\x11\x51\xbb\x7e\xd7\xd5\x62\x0e\xb1\x68\xdf\xdb\x6c\xb6\x74\x56\x31\xcb\x93\x11\x98\x70\x77\xea\x5d\x9f\x30\x1d\x51\x28\xd3\x86\xae\xb0\xa3\xca\x13\x4a\x61\x53\xcf\x7e\x5b\x96\xe4\xf8\x08\xcb\x14\x2b\x63\x93\xf9\xe6\xb0\xb5\x10\x8a\x59\x88\xf7\x3b\x8f\x08\x5d\x9d\xd1\x63\x96\xd6\xfc\x3d\xae\xeb\x2d\x62\x17\xc7\x62\x9d\x02\xda\x64\xe7\x36\x55\x0f\xd8\xb2\xd9\xa9\x5a\xf3\xb7\x33\xcf\xce\xd5\x51\x9a\x79\x3a\xe0\x24\xed\x00\x83\x76\x1e\xa9\xb5\x2c\xda\x3a\x65\x6c\xcd\xc8\x9f\x42\x8b\x8c\xeb\x87\x6b\x96\xc9\xbc\xdb\x98\xda\x51\xe8\x86\x6b\xbe\xf5\x0e\x25\x5c\xf1\xc5\x4b\x34\xb5\x49\x32\xed\x5b\x77\x26\xe1\xb5\xdb\xed\xca\xd3\xb9\x8e\xf2\x9c\x49\xb1\x6c\xb6\x59\x20\x36\x28\x76\x94\x22\xb9\x03\x96\x24\xe9\x8d\xd9\x53\xae\x8b\x2c\x94\x8b\x55\x05\x6e\x5a\x20\x4c\xfa\x4a\xbc\x56\x3b\x43\x18\x68\xec\x9a\xa2\x0f\x96\x74\x74\xa3\x96\xe3\xdd\x51\xeb\x88\x5f\xe2\xd9\x19\xfc\x03\x9e\x77\xa6\x2b\xa9\x54\xc1\x5b\xbc\x99\x4e\xaa\xdd\xdb\x45\x17\x85\x07\x75\x43\x72\x45\x95\x78\x16\xae\x39\x6e\xd9\x75\x82\xd6\x30\xd4\xc9\x18\x86\x52\x78\xbd\x66\x02\x9e\x5b\x93\x4c\x8a\xd3\x87\x22\xdd\x2e\x66\xd2\x5a\xdc\x1f\x80\xce\x69\x07\x76\x1e\xce\xbf\xb6\x65\x6a\xd5\x46\x43\x15\x3e\xb5\xd7\x7b\xe3\xe8\x2b\x7d\xfb\x60\x01\x4a\x17\xe7\x41\xdb\x87\x69\xa9\x85\x96\x9e\x5c\xcc\x8f\xac\x9a\x5d\xac\x49\x28\x79\x77\xd5\xfe\x7a\x1c\x9d\x7b\xf1\x53\xb6\xf0\x22\x88\x81\x79\x9b\x58\xdb\x3d\x85\xd8\xf1\x94\xec\x89\x9e\xcf\x50\x8b\x1e\x3f\x82\xba\x41\xb9\xf5\x2f\x71\x0c\x70\x41\x1f\x36\x9d\xe9\xbd\xdb\x1c\x5b\x3b\x6c\x75\x99\xa3\xf4\x4b\x75\x69\xc9\xbb\xd3\x71\xe8\x05\x3d\xef\x56\x87\xeb\x1a\x6f\x74\x40\xbd\xe2\x43\x23\xbd\xb8\x59\x03\xdf\x46\x6e\xbd\x56\xd6\x91\xc6\x63\x37\x4c\x01\xde\x66\x74\x40\x3b\x99\xbb\xa9\xd5\xa1\x56\x8b\x3d\xcf\x49\xf5\xe8\xf3\x3e\xfc\x41\xf1\xe7\x0f\xdd\x7f\x89\xe4\x90\xf8\x6b\x20\xee\x31\x11\x58\xcb\xeb\xfb\x77\x19\xcd\xcc\x7d\xdf\xde\x82\xda\x3f\x76\x6f\x61\xf7\x9e\x1d\x5b\x0b\xfb\xa1\x7b\x6f\xd1\x3c\x01\x28\x37\x17\xad\xf3\x83\x8e\xdd\x85\x1b\xd1\x6d\x09\xdc\xb2\x3c\x60\x97\xd1\x92\x3d\x60\x9b\xf1\x34\xb7\x13\x9d\x99\x73\x79\xcc\xf2\xf8\xcc\xb9\xe1\xb2\x22\x40\x9a\x86\x3b\x4e\xee\xdc\x1a\xec\xe0\xe4\xb9\x2d\x61\x48\xf6\xbc\xb7\xd7\xb1\xd3\xe7\x83\xac\xfa\xc8\x04\xba\x3d\xa9\xbf\x50\x06\x5d\x9e\xd3\xf5\x66\x01\xb6\x85\x49\x03\xba\x17\xfe\xc1\x26\x3e\x4e\xda\xdc\xb6\xf6\xa3\xf3\xe6\xa6\x8a\xc3\x12\xe7\xca\x1e\x5f\x91\x39\x3f\x84\x99\x27\x97\x3a\x3f\xce\xc3\x8f\x49\x9e\xbb\xf9\xe1\x29\x66\xcf\x7f\x72\xdc\xfc\xd1\x29\xf3\x10\xc3\xff\x45\x73\xe6\x3d\x51\xfe\xa4\x93\xe6\xc7\x62\xe4\xf0\xb4\xb9\x1b\x00\x7f\x5e\xde\xdc\xca\x4a\xf7\x25\xce\xca\x95\x25\x1f\x91\x39\x17\x7f\xff\x1b\x00\x00\xff\xff\x14\x70\xd7\xcc\x31\x44\x00\x00") +var _templateBuilderQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xdc\x5a\x6d\x6f\xdb\xb8\xb2\xfe\x6c\xff\x8a\x59\x21\x1b\xd8\x81\x23\xb7\xfd\x76\x73\x91\x0b\x74\x9b\xf6\x1e\x03\x8b\xee\x4b\x7b\xb0\x0b\x14\x45\x97\x91\x46\x36\xb7\x32\xa5\x25\x29\x27\x41\x8e\xff\xfb\x01\x87\x94\x44\xbd\xc5\x72\x9a\xdd\xd3\x3d\x9f\x6c\x49\xe4\x70\x38\xf3\xcc\xc3\x21\x87\xf7\xf7\xcb\xb3\xe9\xab\x2c\xbf\x93\x7c\xbd\xd1\xf0\xe2\xd9\xf3\xff\x39\xcf\x25\x2a\x14\x1a\xde\xb0\x08\xaf\xb3\xec\x33\xac\x44\x14\xc2\xcb\x34\x05\x6a\xa4\xc0\x7c\x97\x3b\x8c\xc3\xe9\xfb\x0d\x57\xa0\xb2\x42\x46\x08\x51\x16\x23\x70\x05\x29\x8f\x50\x28\x8c\xa1\x10\x31\x4a\xd0\x1b\x84\x97\x39\x8b\x36\x08\x2f\xc2\x67\xe5\x57\x48\xb2\x42\xc4\x53\x2e\xe8\xfb\xf7\xab\x57\xaf\xdf\xbe\x7b\x0d\x09\x4f\x11\xdc\x3b\x99\x65\x1a\x62\x2e\x31\xd2\x99\xbc\x83\x2c\x01\xed\x0d\xa6\x25\x62\x38\x3d\x5b\xee\xf7\xd3\xe9\xfd\x3d\xc4\x98\x70\x81\x10\xfc\x51\xa0\xbc\x0b\x60\xbf\x37\x2f\x4f\xf2\xcf\x6b\xb8\xb8\x84\x6b\xa6\x10\x4e\xc2\x57\x99\x48\xf8\x3a\xfc\x91\x45\x9f\xd9\x1a\xc1\xf5\xd4\xb8\xcd\x53\xa6\x11\x82\x0d\xb2\x18\x65\x00\x27\xdd\x4f\x7c\x9b\x67\x52\x97\x9f\xec\x13\xcc\xa6\x93\xfb\xfb\x73\x90\x4c\xac\x11\x4e\x72\xa6\x37\x66\xb0\x93\xf0\x1d\xbf\x4e\xb9\x58\xaf\xa8\x95\x32\x3d\x26\x93\x80\xd4\x31\x4d\xf6\xfb\xc0\xf6\x43\x11\x9b\x6f\xf3\x29\x8d\x75\x72\x5d\xf0\xd4\x98\x8b\x44\xfc\x64\xa6\xf1\x96\x6d\xb1\x9c\x89\xc4\x08\xf9\xce\x7e\xae\xfe\x57\x7d\x8c\x52\xcb\x25\xf8\x62\xf6\x7b\xe3\x0a\x63\xc7\xf2\x4d\x92\x49\x20\xf3\x70\xb1\x36\x4d\x73\xa6\x22\x96\xc2\x49\xe8\xc6\x01\x14\x9a\x6b\x8e\x2a\x9c\xea\xbb\x1c\xdb\xd2\x94\x96\x45\xa4\xe1\x7e\x3a\x89\xc8\x8e\xd3\x49\xca\xb7\x5c\x4f\x26\x67\x5c\xe8\xe9\x24\x4b\x12\x85\xf5\x93\x8c\x51\x4e\x26\x1f\x3e\xfe\x60\xfe\xbc\x29\x44\x34\x9d\x14\x82\xff\x51\xa0\x79\xa9\xb4\xe4\x62\x3d\x9d\xe4\x12\x63\x1e\x31\x8d\x0a\x26\x1f\x3e\x56\x4f\xa1\x19\xb9\xd4\xca\xda\xea\x86\xeb\x0d\x9c\x84\xaf\xe3\x35\x3a\x83\x2e\x97\x80\x6c\x8d\xf2\x3c\xcd\x58\x6c\x66\x84\xe6\x5b\x38\x9d\xf8\x3e\x41\x63\xae\xd0\x76\x98\x18\x19\xde\xb4\xb1\x9a\xf7\x99\x19\x0f\xc3\xf7\x77\x39\x36\x0d\x3f\xf1\xfd\xd4\xf9\xbf\x3c\x83\x97\x71\xcc\x35\xcf\x04\x4b\x21\xe1\x98\xc6\x0a\x74\x06\x2c\x8e\xcd\x8f\x67\xfa\x10\x08\xa7\xd4\xeb\x44\x6f\xf3\xd4\xa8\x95\x4b\x2e\x74\x02\x41\xcc\x59\x8a\x91\x5e\x7e\xab\x96\xe4\x9d\xa5\x95\x14\x18\x20\xe9\x4c\x3a\xa4\x52\x5f\x9e\xc0\x86\xa9\xf7\x25\x2a\xad\xa8\x4a\xcf\x5b\xdd\xfc\x10\x76\xb4\x5e\x2e\x81\x0b\x8d\x72\x8b\x31\x37\xed\x68\x3c\x98\xf1\x10\x43\xd0\x92\xed\x50\x2a\x96\x82\x41\xe9\x3c\x34\x3d\x1b\x2a\x80\xff\x1c\x7e\x57\x23\x6f\x42\xb0\x4e\x0a\x11\xcd\xa2\x4c\x68\xbc\xd5\x26\xd2\xcc\xef\x1c\x66\x03\x9d\x16\x80\x52\x66\x72\x3e\xb5\xc0\xfd\x65\x83\x12\x8d\xe1\x14\x30\x10\x78\x03\x15\x16\x08\xb5\xbe\x29\xa7\x66\x20\x2b\xb7\x8a\x83\xd2\x87\x35\x5a\xe7\x56\xe4\x2c\x57\x10\x86\x61\x3f\xb2\xe6\xed\x4e\x06\xdb\xbe\xdc\xfd\x3e\xf4\x10\x7a\x09\x2c\xcf\x51\xc4\xed\xa1\xbd\x36\x0b\xc8\x55\x18\x86\xf3\xe9\x44\xa2\x2e\xa4\x80\x56\x53\x37\xdb\xef\x4d\xdc\x94\xb3\xa5\x20\x02\xa5\x31\x2f\x41\x43\x5e\x19\x3d\x4f\x12\x36\xb3\x52\xb8\xd0\x07\x27\x65\x34\xb6\xad\x2f\xe1\x94\xfe\x1c\xd0\xf6\x07\x0a\x6c\xa7\xae\x00\x1b\xe7\x5f\xa0\xb0\x95\x37\x73\x72\xc6\xaa\xec\x9a\x5f\xc2\xa9\xfd\x77\x48\x69\x43\x3b\xb5\xce\xf4\xf4\x05\x2a\x9b\xfe\xb3\xcc\x40\xa9\xe2\xb3\x71\x5a\xd3\xc0\x83\xc8\xa1\xcf\x0b\xc8\x0e\x61\xc6\xac\xd1\x76\xf1\xa3\x25\x76\xc3\x14\x28\xbe\xe5\x29\x93\x5c\xdf\x59\x6e\x34\xec\x47\xb3\xe2\xa8\xcc\x02\x1a\xa5\x1c\x85\x0e\x89\x08\x88\x7c\xee\xef\x4b\x52\xfc\xb4\x70\xc4\xe8\xf3\x29\x51\x60\xbc\xc6\x4f\xde\x32\x44\x0c\x05\xb3\x9a\x30\x89\x21\x4d\xf4\xcc\x21\xf8\xa9\x5a\x68\x0d\xad\xd0\x53\x2f\xb9\x46\x1b\xc6\x85\x5d\x88\xa2\x42\x4a\x93\x56\x58\xda\xc9\xec\x2a\x6f\xb9\xb7\x5a\x82\xe2\x35\x86\xd3\xc9\x48\xbf\x0c\x8e\x3a\x73\xde\x69\xcc\xc8\xba\x68\x62\x47\xbf\xb8\x84\xd3\x9e\x16\xf7\x76\x6d\xbb\x68\x7b\x21\xb4\xef\xf7\x65\xff\x90\x38\xef\xd2\xb1\x9e\xbe\x85\x2e\xf3\x25\x32\xdb\xfe\x73\x88\x34\x89\xff\x1c\x07\x92\x56\x13\x9e\xd0\xab\x8b\xcb\xce\xd0\xb9\xc4\x9c\x49\xa4\xc9\x9a\xb1\xe6\xff\x4b\x2d\xbf\xb9\x04\xc1\x53\xdb\xb9\xc4\x8e\xe0\x29\x49\x36\xef\x68\xcd\xab\xd6\x4e\xbc\xd5\x66\x15\x38\x81\xe0\x67\x27\x3a\xf0\x46\x09\x0c\x10\x02\x03\x8b\x60\x15\xa3\xd0\x01\x04\xa4\x7e\x00\xe7\x76\xed\x24\x7c\x1c\x5c\xb9\x8c\x51\xda\xeb\xd6\xe4\xa1\xc5\xa9\x5e\x60\xdd\x38\x6e\x1e\x34\xf8\xc2\x4c\x67\x6a\x27\xe2\xde\xd3\x30\xd3\x09\xa1\xd9\x2d\x6a\x26\xda\xdf\x70\xa9\x34\xd8\x36\x16\x6a\x09\xbd\xf1\xd9\xde\x66\x37\x77\x65\x72\x69\xbd\x08\x3f\xbb\x3e\x67\x6f\x33\xfd\xc6\x24\xa4\xaf\x8d\x4b\xe0\x66\x83\x02\x44\x66\x04\xa4\xd9\x8d\xc9\xb4\x2a\x31\x37\x4c\xd9\xd4\x75\x34\x7b\x90\x76\x03\x20\x39\xf3\x55\x5c\x78\x80\x10\x59\x6c\xd6\x93\x01\x48\x58\xd2\x7f\x3e\x0f\x5f\xa6\x29\x41\x62\x5a\xe2\xc7\x43\x45\x07\x13\x7b\x6a\x95\xa2\x98\x91\xf4\x39\x5c\x5e\xc2\xb3\x4e\xd3\xd3\x86\x29\xee\xad\x11\xeb\x9c\x39\xfc\x9e\x5d\x63\xba\x27\x69\x65\x37\x23\xed\xc3\xb3\x8f\xd6\x61\x9e\x4b\x7e\xb5\xbb\x81\xcf\x68\x1f\x17\x70\x5d\x68\xc8\x99\xe0\x91\x32\xb9\x0c\x13\x76\xc2\x90\x45\x51\x21\xd5\x71\x06\xfd\xb5\xdf\xa2\x0d\x83\x96\x86\x1c\xb4\x63\xe5\x9a\x8e\x01\x4f\x4f\xe1\x9b\x95\x2a\x4d\x31\x43\xe9\xe2\x94\xb4\xa7\xc7\xb6\x05\xfc\x89\xaf\xae\x0e\xa1\x91\xc7\xc7\x21\x91\xc7\x8f\x45\xde\xea\x6a\x00\x7b\x3c\xb6\x2a\xad\xae\x88\xd8\x7b\x58\x69\xc7\x24\xf0\x58\xc1\x87\x8f\xad\x86\x64\x2d\x1e\x3b\x80\x3e\x80\xcf\xd5\x95\xea\xa7\x2c\x6b\x1e\x1f\x93\x3c\xf6\x11\x69\xe5\x8e\xc5\xa2\x2f\xce\xb9\x84\xc7\xfd\x90\x5c\x5d\x35\x41\xb9\xba\x7a\x5a\x58\x0e\x99\xbb\x65\x41\x33\x49\x1e\x3f\x0c\x4c\x2b\xea\x0b\xa1\xc9\xe3\x32\x25\x12\xe9\x5d\x03\x95\x99\x79\x71\x88\x22\x17\x55\x97\xca\x2c\x3c\x01\x91\x69\xc0\x5b\x16\xe9\xd4\xac\xe3\x58\x76\x34\x08\xb5\xcd\x71\x3c\x48\x8d\x5e\x7f\x06\x3b\xbe\x38\x9e\x1d\xd5\x0d\xd7\xd1\xc6\x67\x48\xb3\xdb\x65\x0a\xe1\xf9\x85\xd7\xa5\x41\x77\xf6\xfb\xb3\x8b\x47\xb2\x68\x8c\x09\x2b\x52\xdd\xd7\xfd\x1d\x17\xeb\x22\x65\xf2\x20\x0f\xd7\xfe\xad\x09\xd7\x3c\x3d\x15\xb0\x49\xf2\x53\xd0\x6d\xe9\xea\x5e\x87\x1c\x64\x56\xd3\xbb\x45\xac\x5d\x08\xb7\x78\x75\x1c\x7c\x1d\xb9\x3e\x0a\xba\xff\x39\x7a\x7d\x31\x8e\x5e\x3d\x50\x13\xc5\x36\x20\xcd\x63\xb8\x74\x54\xe9\x23\xf9\x38\xf6\xf5\x30\x5c\x77\x1c\x8d\xde\x52\x57\xdf\xc9\x4d\x1c\x3f\x1d\x45\x3b\xe9\x4f\xc1\xd0\xb5\xef\x8f\x40\x73\x45\xc6\x2f\xd3\x14\xf0\x16\xa3\x42\xa3\xaa\xd1\x0a\x4c\xc4\x35\x60\x21\xe5\x4a\x43\x96\xd0\x59\x5d\x5a\x48\xff\xac\x6e\xf4\x8c\x1d\x05\xf6\xe0\xf3\xc3\xc7\x41\x7a\xfd\x92\xbd\x48\x1f\xaf\xf6\xef\x6c\xc3\xd6\x01\x53\xc5\xd6\x95\x89\x6a\x18\xbc\x4c\xd3\xa7\xc2\x80\x91\xdb\x6f\x92\x96\x45\x0e\x2f\x34\x0f\xad\x2f\xc3\x74\xa6\xdc\x04\x57\x57\xea\x28\x0c\xf8\x24\x37\x7e\xba\x8e\x22\x7a\x01\xd0\xc7\x4f\xa3\xb8\x69\xc0\x1e\xef\xd0\xec\x07\x67\xed\x58\x7f\xc3\x31\x8d\x57\x57\xf3\xf0\x5d\xc4\x84\x51\x66\x01\xa7\x86\x8a\x8e\xc1\x0e\xb1\x61\x9d\xcb\xad\xae\x54\x0d\x8e\xd5\x95\x7a\x2a\x70\x18\xb9\x43\xe0\xe8\xe5\x87\x61\x70\x94\xdc\x7c\x0c\x3b\x94\xd0\x78\x95\x15\xa2\xb9\xa1\x8d\xe8\x0d\xd5\x40\x10\xd6\x7c\x87\xe2\xc8\x33\x2c\x12\x39\xb4\x54\x09\xfd\xc4\xe1\xff\xec\xd8\xe0\xaf\xd4\x9b\xfb\x26\xa8\x7d\x4c\x8f\x4f\xe5\x65\x2b\xbb\xdf\x18\x5c\xb8\x1a\x47\xe1\x8c\xd2\x67\x07\x4f\xdb\xd1\xde\x25\x89\x6e\x72\xaf\x6f\xb9\x7f\x60\x21\x0b\x34\xd3\xa9\x39\x60\xc3\x14\x60\x8a\x5b\x14\x5a\x95\xf9\xcc\x5a\xb2\x7c\x33\x7a\x8a\x34\xc2\x80\xbb\xaf\xb3\x2c\x7d\x62\x7f\x27\x2c\x55\x78\xac\xcf\x2b\x1d\xe7\xbe\x59\x6a\x9f\xd3\xe3\x53\xf9\xdc\xca\xee\xb7\x88\x31\x88\x99\x0d\xda\x01\x07\x8c\xe1\xa9\x3b\xda\xe9\x24\xb1\x44\x74\x6a\x72\xcd\x9a\xda\xe3\x22\x4f\x6d\x8d\x23\xf3\x7d\xef\x94\x5e\x00\x17\x51\x5a\x50\x69\x8b\xa5\x29\x30\xa5\xb2\x88\x33\x8d\x31\x1d\x64\xab\x10\x56\x1a\x22\x26\xe0\x1a\x8d\xf0\x42\x21\x55\x9d\x9c\xc7\x20\xca\xb6\xdb\x4c\x34\x45\x2a\x5a\x5b\x0a\x85\x66\xb4\x2d\xc4\x3c\x49\x50\xa2\x30\x59\x30\x4b\xb4\xab\xd4\x46\xa4\x25\x57\xb0\x65\x31\x8e\x8f\x28\xd3\x6b\xd6\x7b\x26\xee\x2c\x71\xda\xfc\x62\x4c\x56\x9e\xb5\x76\x8e\xcd\xed\x87\xc5\x74\x62\x4b\x8c\x17\x30\xe9\x2f\x61\x98\x16\xb6\x1c\xd0\x23\xc4\x7e\xa0\x26\x32\x46\x69\x84\xb8\x63\x78\xaf\x2a\x79\xbf\x5f\x74\xfc\x4c\xcd\xc3\x30\x9c\x9b\xbe\xb6\x68\x79\x01\x75\x5f\x5b\xbc\xec\xeb\x68\xdb\x96\x3d\xeb\xb2\xd0\x05\x54\x9d\xfb\x2b\x51\x7d\xc2\xea\xee\xa5\xc0\xe5\xb2\x74\x4e\xa7\x86\x67\xcb\x9e\x8d\xe0\xea\x1e\x61\xb7\x1a\x84\xce\x67\xa4\x2b\xd3\x9b\x6e\x07\xf3\x76\xe1\x36\x98\xed\xa2\x6a\xa7\x76\xe0\x97\xaf\x7b\x6b\xa9\xcb\x25\xc0\x2f\x43\x25\x58\x8d\x69\xea\x25\x41\xe7\xa5\x34\x9d\x79\x55\x5e\xdb\x80\x52\x28\xd0\x1b\xa6\xc1\x02\x5d\x08\x8c\x34\xa1\x9f\x06\x31\x6d\x82\x46\x55\x21\xb0\x65\x05\x78\x6f\x76\x8c\xb9\xab\xd7\x32\xb9\x2e\x2c\xbf\x96\xa1\x63\x51\x57\x48\xec\x06\x63\x19\xa1\xc7\x95\x27\x86\x66\x3b\xcb\x72\x4d\x75\x49\xaa\x1e\x9c\x35\xcc\xb7\xdf\xcf\x7b\xa3\xa8\x5d\xb6\x38\xaa\x64\x91\x64\x12\x3e\x2d\xcc\xdc\xe9\xfa\x00\xb9\x91\x74\xa0\xe2\x41\x96\xeb\x19\x49\x9f\xbb\xc3\xf6\xb6\xa0\xc1\xc2\xf9\x65\x79\x20\x3f\x54\xbb\xa2\x93\xfa\xaa\xfe\x4c\x17\x19\xd6\x32\x2b\xf2\xef\xbc\x22\x53\xe3\x16\xc2\xbf\xaa\xe2\xc2\xb7\xea\xff\xa9\xa5\xad\x31\x19\x8a\x73\xcf\x95\xbf\x48\x12\xec\x50\x6a\x1e\xa1\x82\x6b\xbb\x97\xcf\x24\x6c\x33\x89\xae\x1e\xbf\x8c\xb2\xb4\xd8\x0a\x15\x52\xd2\xa8\x0d\xaf\x65\x89\x46\x61\x85\x50\x65\x84\xad\xd7\x12\xd7\x54\x6a\x2e\x44\x64\xd0\xa1\x16\xb4\xfe\x90\x45\x7f\xcf\xb8\x80\xd9\x67\xbc\x53\x75\xc3\x39\x04\x0b\x08\x68\x17\x56\xd5\x57\x52\x14\x70\x62\x33\x5d\x65\xef\x6c\x9c\xc3\x49\x62\x26\xc8\x45\x8c\xb7\xf5\xb7\x67\xe6\xeb\x72\x69\x97\x3b\xb6\xcd\x53\xbc\xb0\x8f\x94\x72\xef\x80\x08\xc6\x5e\xb4\x58\x2e\xad\x2f\x92\xf0\x1d\xbd\x22\x09\x65\x25\x3e\xa9\xf2\xd0\xdf\xfc\x36\xef\xd9\x1a\xf6\xfb\xdf\xa8\xaf\xcd\x22\x4d\x42\xf3\xdb\xef\x2a\x13\x17\x81\x4d\x6a\xb2\x2d\xd7\xb8\xcd\xf5\x5d\x40\xcd\x9c\x36\x13\x57\x31\xec\xb9\x18\x62\x03\x79\x36\x0f\x49\xaa\x73\x43\x27\xcb\xb7\x5a\xbc\xca\x84\xd2\x4c\x68\x03\x64\xdb\xfe\x65\x69\x36\xea\x91\x7f\x5e\xd7\x09\xd4\xdc\x35\xf1\xf6\x05\xbb\xb9\x51\xc7\x03\xcd\xc8\x58\x2b\xb5\x22\xb7\x83\xe5\xe8\x45\x79\x29\x23\x0c\x43\xfb\xc6\x85\x56\x03\x83\x36\xbe\x2c\x98\xca\xf0\x6a\x35\x38\x1c\x62\xd4\x21\x74\xc3\x5d\x42\x7b\xb1\xa0\x0f\xfb\x52\x1f\x5b\xee\xb5\x5d\x0e\xd7\x11\x73\x89\xbb\xd1\x65\xc4\x2f\xaa\x22\x76\x8b\x88\xfb\xc1\xd0\x6e\xaf\x26\x0e\x22\xee\x4c\xb4\x4e\x80\x68\x96\x53\x17\xfb\x8a\xf6\x87\xa3\x82\xdf\x6e\x25\xab\xd8\xb7\x8f\x3d\x01\x4e\xa5\xc2\xee\xa6\xe8\x6b\x8e\xcb\x63\x03\x6e\x60\x57\x3d\x14\x6f\x4f\x10\x4c\x6e\xc4\x51\xb1\xd4\xf4\xa9\x0d\x26\xfb\x2e\x93\x55\x3c\xb5\x1b\x1d\x0e\xa8\x52\xc4\x71\x31\x55\xf5\xfa\x6f\x0f\xab\x72\xa2\x26\xb2\x46\x3a\xb5\xad\x69\xd7\x26\x76\x5f\x65\x37\x84\x7d\xb9\x60\x63\xbb\x23\x71\x37\xb8\x53\x32\x8d\xdd\x46\xa9\x67\xa7\x54\xed\x8d\x2a\x5b\x1c\x30\x02\x5c\x1a\xe5\x77\x34\x7f\x77\x0d\xee\x24\xfc\x07\x53\x3f\x66\x29\x8f\xee\xec\x45\x82\xa6\x87\xfc\x38\xb1\xad\xc2\xd7\x3b\x96\x56\x73\xef\xa4\xdb\xc3\x6e\xab\xb4\xf4\x2f\xd2\xd5\x2e\x75\xd4\xd6\xba\x63\xe1\xa0\x14\xd4\x1e\x08\x9c\x46\x41\xb9\x04\x4e\x47\x5d\xa9\xe8\xde\x02\xec\xbf\x49\xe1\xdd\x87\xa0\xcb\x42\x44\xbb\xd7\x75\xfe\x5a\xdd\x93\xb5\x4b\xdb\xcf\xbd\xb7\x49\x5b\xab\x5e\x75\xa5\xb4\xbd\x5c\xf6\xdc\x2b\xa5\x26\xe7\xd7\x77\x63\xef\x95\xb6\x45\x76\x2f\x97\xba\xb8\xaf\x2f\x8b\x26\x42\x01\x00\x7c\xf8\x58\x25\x14\xf6\x5a\xe9\x57\x7b\xa9\xb1\xd2\xd3\xde\x43\xab\xd7\xa8\x32\x91\xe4\x99\xa8\x73\xce\xf2\x66\x5a\x65\xc9\xce\xf1\x5e\xd3\x73\x65\x88\xb7\x2c\x39\xaf\x87\x9d\x19\x8b\x85\x61\xd8\xb0\xd7\x70\x06\xd4\x37\x44\x68\x44\x34\xae\xaf\xf5\xb5\x58\x40\x22\xba\xf7\x1e\xdb\x2d\x9d\x55\xcc\xf2\x64\x04\xa6\xdc\x9d\x7a\x37\x27\x4c\x47\x14\xca\xb4\xa1\x2b\xe0\xa8\x8a\x94\x52\xd8\xcc\xb3\xdf\x8e\xa5\x05\x3e\xc2\x32\xe5\xca\xd8\x66\xbe\x05\xec\x2c\x84\x12\x16\xe1\xfd\xde\x23\x42\x57\x43\xf4\x98\xa5\x33\x7f\x8f\xeb\x06\x8b\xcc\xe5\xb1\x58\xaf\x80\x2e\xd9\xb9\x4d\xd5\x03\xb6\x6c\x77\xaa\xd7\xfc\xdd\xdc\xb3\x73\x7d\x94\x66\x9e\x8e\x38\x49\x3b\xc2\xa0\xbd\x47\x6a\x1d\x8b\x76\x4e\x19\x3b\x33\xf2\xa7\xd0\x21\xe3\xe6\xe1\x9a\x65\x32\xef\x36\xa3\x76\x14\xba\xe5\x9a\xef\xbc\x43\x09\x57\x35\xf3\x12\x4d\x6d\x92\x4c\xfb\xd6\x9d\x49\x78\xed\xf6\xfb\xea\x74\xae\xa7\xf4\x66\x52\x2c\x9b\x6d\x96\x88\x0d\xcb\x1d\xa5\x48\xef\x80\xa5\x69\x76\x63\xf6\x94\x9b\x32\x0b\xe5\x62\x5d\x83\x9b\x16\x08\x93\xbe\x12\xaf\x35\xce\x10\x46\x1a\xbb\xa1\xe8\x83\x25\x1d\xdd\xaa\xe5\x94\x37\x6c\xfa\xe3\x97\x78\x76\x0e\xff\x07\xcf\x7b\xd3\x95\x4c\xaa\xf0\x2d\xde\xcc\x82\x7a\xf7\x76\xd1\x47\xe1\x61\xd3\x90\x5c\x51\x95\x9d\x45\x1b\x8e\x3b\x76\x9d\xa2\x35\x0c\x75\x32\x86\xa1\x14\x5e\x6f\x98\x80\xe7\xd6\x24\x41\x79\xfa\x50\xa6\xdb\xe5\x4c\x3a\x8b\xfb\x03\xd0\x39\xed\xc1\xce\xc3\xf9\xd7\xae\x4a\xad\xba\x68\xa8\xc3\xa7\xf1\xfa\x60\x1c\x7d\xa1\x6f\x1f\x2c\x40\xe9\xf2\x3c\x68\xf7\x30\x2d\x75\xd0\x32\x90\x8b\xf9\x91\xd5\xb0\x8b\x35\x09\x25\xef\xae\x92\xdf\x8c\xa3\x73\x2f\x7e\xaa\x16\x5e\x04\x31\x30\x6f\x53\x6b\xbb\xaf\x21\x76\x3c\x25\x07\xa2\xe7\x13\x34\xa2\xc7\x8f\xa0\x7e\x50\xee\xfc\x0b\x1a\x23\x5c\x30\x84\x4d\x67\x7a\xef\xa6\xc6\xce\x0e\x5b\x5f\xd4\xa8\xfc\x52\x5f\x3c\xf2\xee\x6b\x1c\x7b\x5d\xce\xbb\xb1\xe1\xba\x26\x5b\x1d\x52\xaf\xe4\xd8\x48\x2f\x6f\xcd\xc0\xb7\xb1\x5b\xaf\x95\x75\xa4\xf1\xd8\x0d\x53\x80\xb7\x39\x1d\xd0\x06\x0b\x37\xb5\x26\xd4\x1a\xb1\xe7\x39\xa9\x19\x7d\xde\x87\x3f\x29\xfe\xfc\xa1\x87\x2f\x88\x1c\x13\x7f\x2d\xc4\x3d\x26\x02\x1b\x79\xfd\xf0\x2e\xa3\x9d\xb9\x1f\xda\x5b\x50\xfb\xc7\xee\x2d\xec\xde\xb3\x67\x6b\x61\x3f\xf4\xef\x2d\xda\x27\x00\xd5\xe6\xa2\x73\x7e\xd0\xb3\xbb\x70\x23\xba\x2d\x81\x5b\x96\x47\xec\x32\x3a\xb2\x47\x6c\x33\xbe\xce\xed\x44\x6f\xe6\x5c\x1d\xb3\x3c\x3e\x73\x6e\xb9\xac\x0c\x90\xb6\xe1\x9e\x26\x77\xee\x0c\x76\x74\xf2\xdc\x95\x30\x26\x7b\x3e\xd8\xeb\xa9\xd3\xe7\xa3\xac\xfa\xc8\x04\xba\x3b\xa9\xbf\x51\x06\x5d\x9d\xd3\x0d\x66\x01\xb6\x85\x49\x03\xfa\x17\xfe\xd1\x26\x7e\x9a\xb4\xb9\x6b\xed\x47\xe7\xcd\x6d\x15\xc7\x25\xce\xb5\x3d\xbe\x20\x73\x7e\x08\x33\x5f\x5d\xea\xfc\x38\x0f\x3f\x26\x79\xee\xe7\x87\xaf\x31\x7b\xfe\x8b\xe3\xe6\xcf\x4e\x99\xc7\x18\xfe\x6f\x9a\x33\x1f\x88\xf2\xaf\x3a\x69\x7e\x2c\x46\x8e\x4f\x9b\xfb\x01\xf0\xd7\xe5\xcd\x9d\xac\xf4\x50\xe2\xac\x5c\x59\xf2\x11\x99\x73\xf9\xf7\xdf\x01\x00\x00\xff\xff\x7a\x0e\xe8\x44\x71\x43\x00\x00") func templateBuilderQueryTmplBytes() ([]byte, error) { return bindataRead( @@ -221,7 +221,7 @@ func templateBuilderQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/query.tmpl", size: 17457, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/builder/query.tmpl", size: 17265, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -246,7 +246,7 @@ func templateBuilderSetterTmpl() (*asset, error) { return a, nil } -var _templateBuilderUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x6d\x6f\xdc\xb8\x11\xfe\x2c\xfd\x8a\x89\xb0\x09\x24\xc3\xe6\x26\xf9\x56\x07\x2e\x70\x49\x9c\x9e\x81\x36\x57\xc4\xb9\xeb\x01\x49\x70\xe0\x4a\x23\x2f\x6b\xad\xa8\x90\xd4\xda\xc6\x56\xff\xbd\x18\x52\xd4\xcb\xae\xd6\x59\x1b\xe9\xa1\x57\xf4\x70\x80\x25\x91\x1c\xce\x3c\x33\x9c\x79\x86\x9b\xcd\x66\x7e\x14\xbe\x91\xd5\x9d\x12\x57\x4b\x03\x2f\x9f\xbf\xf8\xd3\x49\xa5\x50\x63\x69\xe0\x1d\x4f\x71\x21\xe5\x35\x5c\x94\x29\x83\x1f\x8a\x02\xec\x24\x0d\x34\xae\xd6\x98\xb1\xf0\xe3\x52\x68\xd0\xb2\x56\x29\x42\x2a\x33\x04\xa1\xa1\x10\x29\x96\x1a\x33\xa8\xcb\x0c\x15\x98\x25\xc2\x0f\x15\x4f\x97\x08\x2f\xd9\x73\x3f\x0a\xb9\xac\xcb\x2c\x14\xa5\x1d\xff\xeb\xc5\x9b\xf3\xf7\x97\xe7\x90\x8b\x02\xa1\xfd\xa6\xa4\x34\x90\x09\x85\xa9\x91\xea\x0e\x64\x0e\x66\xb0\x99\x51\x88\x2c\x3c\x9a\x37\x4d\x18\x6e\x36\x90\x61\x2e\x4a\x84\xa8\xae\x32\x6e\x30\x82\xa6\xa1\xaf\xb3\xea\xfa\x0a\x4e\xcf\x60\xc1\x35\xc2\x8c\xbd\x91\x65\x2e\xae\xd8\xdf\x79\x7a\xcd\xaf\x10\xda\xa5\x06\x57\x55\xc1\x0d\x42\xb4\x44\x9e\xa1\x8a\x60\xb6\x3b\x24\x56\x95\x54\xc6\x0f\xb9\x37\x88\xc3\x60\xb3\x39\x01\xc5\xcb\x2b\x84\x59\xc5\xcd\x92\x36\x9b\xb1\x4b\xb1\x28\x44\x79\x75\x61\x67\x69\x5a\x11\x04\x91\x55\x87\xa6\x34\x4d\xe4\xd6\x61\x99\xd1\x58\x12\xda\xbd\x66\x8b\x5a\x14\x84\x97\x15\xf1\xb3\xb5\xe3\x3d\x5f\xa1\x37\x45\x61\x8a\x62\xed\xc6\xbb\xe7\x6e\x51\x3b\x69\x55\x1b\x6e\x84\x2c\x69\x52\xa5\x44\x69\x06\xeb\x22\xe6\x47\x2d\x3c\xe1\x7c\x0e\xc3\x6d\x9b\x86\x7c\x47\xc0\xfb\x2f\xb9\x54\x60\xf1\x14\xe5\x95\x9d\xca\x5a\x7d\x00\x4b\x23\x8c\x40\xcd\x42\x73\x57\xe1\xb6\x18\x6d\x54\x9d\x1a\xd8\x84\x41\x6a\x01\x77\xd6\xf6\x58\x3a\x1f\xcd\x73\x81\x45\xa6\x09\xd2\x13\x42\xa8\x52\x98\x89\x94\x1b\xd4\xf0\xe9\x4b\xf7\xc2\x86\xfb\x86\x4e\xeb\x7f\x2c\x51\x21\xf0\x2c\xd3\xc0\xa1\xc4\x1b\xe8\x66\x5b\x95\x07\x26\xb0\x30\xaf\xcb\x14\xe2\x21\x7e\x4d\x03\x47\x63\x85\x13\x27\x31\xae\x34\x30\xc6\xa6\xb7\x4e\xb6\x17\x91\x79\x63\xb1\x6c\x60\xc1\x19\xf0\xaa\xc2\x32\x8b\xf7\x4e\x39\x86\x4a\x33\xc6\x92\x30\x50\x68\x6a\x55\xc2\xc8\xc7\xce\xd6\xcd\x06\x6e\x84\x59\x02\xde\x1a\x8a\x95\x19\x44\xaf\xdd\xfe\xd1\xc8\xf1\xc1\x28\x52\x35\x1a\x43\x33\x58\x1b\x13\x6d\x94\x3d\x4e\x58\xeb\x2a\xcc\xae\x50\xef\x8a\x9c\xcf\xe1\x92\xaf\x11\xf0\x16\xd3\x9a\xcc\x26\xe8\xbf\xd6\xa8\xee\x80\x97\x19\x38\xc3\xdc\xd7\xb2\x5e\x2d\x50\xd1\x21\x56\xf2\x46\xcf\xd7\xa8\x8c\x48\x51\xc3\x8a\x9b\x74\x89\x19\x2c\xee\xdc\xe9\x96\x15\x2a\x1b\xa3\x53\xae\x83\x29\xdf\x91\x06\x71\x6a\x6e\x21\x95\xa5\xc1\x5b\x43\xa7\x9c\xfe\x26\x10\x8b\xd2\x1c\x03\x2a\x25\x55\x42\xee\x5a\x73\x45\x47\x36\x40\xa5\xdc\xd7\x30\x08\x78\x9e\x63\x6a\x30\x03\x51\x9a\x30\x48\x5c\xa8\x8a\x1c\x66\xec\x47\xae\xdd\x21\x7c\x8b\x39\xaf\x0b\xe3\x8e\xf1\x96\x3a\x2c\x73\x83\x3a\x4e\x46\x67\x3a\x10\x39\x14\x58\x6e\x6b\xcf\x96\x52\x5e\xeb\x04\xce\xce\xe0\x39\x69\x34\xb1\xdb\x9b\x25\xa6\xd7\xa8\xda\xac\x41\x72\x48\xdd\xb3\xed\xf0\x60\x29\xcd\x8b\x93\x57\x76\xf8\xc9\x19\x94\xa2\xb0\x12\x03\x1f\x4f\xcf\xad\xe9\xf4\xa5\x69\x37\xf2\xba\x75\x46\x1f\xef\x91\x6d\x03\xff\xd2\x48\xe5\xb2\xa4\x47\x38\x09\x83\x06\xb0\xd0\x68\x37\x22\x34\x57\xb5\x81\xbf\x51\x52\x91\x24\xc6\x3e\xe1\xbb\xba\x4c\x63\xf2\xdd\x94\x53\x8e\x61\xe5\xa6\x09\x59\x26\x10\xff\xc2\x8b\x1a\x87\x2e\x0a\x02\x9f\xa3\x8e\x41\x5e\x53\x16\x5b\xb1\xd8\xba\x9c\xf9\x65\xfe\x40\xb6\xe8\x3c\x91\xd7\x63\xbb\x4b\x51\x1c\x43\xbe\x32\xec\x9c\xa4\xe6\x71\x54\x97\x78\x5b\x39\x27\x77\xe9\xd1\xa6\xad\xa7\x1f\xa3\x63\x58\x25\x1e\xa2\x6f\x3b\xe3\x31\xde\xd8\x75\x47\xbf\x59\xe7\x90\x60\x94\xbb\x9b\x06\xce\x3a\x55\x69\xf4\xf1\xfe\xea\xf1\x64\x99\x2c\x11\xce\xc0\xa8\x1a\xc3\x5e\xad\x91\xe8\x30\x08\x2c\xae\x94\x45\x05\x81\x7f\x4f\x08\x9f\xc0\x8b\x57\x20\xe0\xcf\x67\xf0\xfc\x15\x88\x93\x93\xce\x7b\x13\xfa\xd9\x25\x9f\xc4\x97\x78\x55\x1b\x92\x4f\x26\x8b\x1c\x7e\x73\xf6\x9c\x5a\x63\x9d\x7f\xad\xde\xc7\xb0\x05\xc7\x04\xae\xdb\xa8\x36\x21\xfd\x3f\x69\x54\x9f\xa8\x7e\x75\xec\xe4\x1a\xed\xdb\x31\x2c\x6a\x03\x15\x2f\x45\xaa\xc9\xef\xbc\x74\x81\x08\x32\x4d\x6b\xa5\x1f\x94\x80\x7e\x9d\xce\x40\x54\x80\x37\xe1\x96\xff\x4e\x77\x01\x1a\x78\xac\x0d\xb1\x81\xad\x56\xc3\x18\x95\x4a\xa6\x6c\x6c\xcd\x3b\xbf\xc5\x74\x22\x0f\x1f\x6c\x04\xad\x9f\xb6\xc1\x61\xb2\x09\x83\xdf\x0e\x51\xbf\xd5\xae\xc7\x9d\x04\xf7\xb8\xd3\xdb\xf7\xc2\xdd\x4a\x9e\xd6\x79\xd3\xe1\x38\xa1\xad\x37\x75\x37\xaa\xc6\x48\x4f\xd6\xcc\x0f\xad\xa0\x68\x48\xac\x5a\x42\x19\x39\xbe\xf9\x80\xba\x6a\xd3\xc6\x44\x61\x3d\xa4\x56\x6f\xed\xda\x6e\x31\x33\xab\xaa\xe8\xd8\x5f\x0e\x51\x26\x78\x81\xa9\x99\x3f\xd5\x73\xcf\x8d\x87\xb9\xc2\x2e\xba\xed\x14\x73\xcb\x27\xd4\x99\xc9\x12\x27\x08\xea\x4f\xe5\x34\x47\x1d\x52\xd4\xc1\xca\x6d\x96\x7a\x30\x49\x1d\xc9\xb8\x97\xa7\x72\xd0\xa2\xbc\x2a\x70\x82\xb0\xde\x0d\xe8\xea\x58\xe0\x83\x19\xeb\xb7\xf9\xd9\xd8\xea\xc3\x28\xda\xa3\x05\x7e\x37\x9a\xe6\x04\x65\x1d\x5e\xf7\x1c\xc5\x31\x82\xf7\xf2\xb0\xa3\xa1\x2f\xbe\xc5\xc8\x4a\xea\x22\x47\x2b\xfe\xb7\x78\x99\xe5\x27\xfb\x98\x19\x19\xff\x7f\x56\xf6\xfb\xb1\xb2\xa1\x33\x1e\xce\xcb\x1e\xe7\xad\x6f\x72\xb2\x4e\xec\x1f\x8f\x8f\x0d\xf0\x1c\x31\xb2\xde\xa4\xff\x04\x1b\x1b\xa5\xa2\x7b\x09\xd9\x28\xaf\xf8\x16\x9e\x7d\xe8\x05\x7e\x4f\x8a\xb6\x2d\xfb\x7e\xaa\x06\xd2\x5d\x7b\x3d\x34\xf5\xfe\x61\xb8\xdb\x84\xd6\xff\xe5\xf4\xed\x80\x92\xfb\x18\x06\x37\x10\xfb\xfb\x92\xb8\xfe\x71\x7e\x04\x7a\xc9\x15\x66\x9e\xfa\x38\x6a\x03\x0b\x34\x37\x88\x2e\x10\xcd\x8d\x6c\xf9\x80\xd2\x60\x2f\x5a\x77\xee\x59\x3d\x23\x22\x15\x6c\x52\x81\x4f\x5f\x7e\x94\xf2\x3a\xec\x52\x1c\x4c\x96\x89\x7d\xca\x58\x02\x03\x0a\x57\x72\xcd\x8b\x07\x2b\xd3\xd2\x9f\x96\x64\x0e\xd8\x6a\xc5\x75\xca\x0b\x60\x97\xa9\xac\x90\xbd\x1e\x93\xd1\xef\x7e\xaf\xba\xd9\xf8\x1b\x61\x74\x54\xf9\xdc\x5a\xe5\x7d\x6b\x4f\x08\x7d\xc7\x0e\x95\x37\x05\x72\x17\x62\x2d\xdd\xb5\x73\x9a\x06\x52\x1a\xd0\xf4\x89\x2a\x20\xb2\x9f\x4b\xf1\xb5\x26\x00\x09\x12\x7b\xa3\x8c\x3e\x99\x45\x16\x3c\xc2\x95\xa8\x40\xd3\xf0\xa2\x98\x9c\xa1\x3b\xe8\xc1\x48\xe8\xf8\x30\xb2\x8f\x77\x55\x37\x95\x85\xc1\x81\x4d\xd8\x40\xdb\x78\xf2\x8e\x74\xbb\x84\xb2\xd1\x8a\x30\xd8\x77\xfd\x19\x38\xb8\x44\x0e\xa5\x34\x23\xdb\x5b\x99\x95\x2d\x88\xf2\x06\x15\xc4\xfe\x9c\x3c\x65\x2f\x88\x9e\x0f\x8c\x49\xfc\x82\xf9\x11\xc9\xb2\x57\x91\x64\xa3\x74\xcf\x15\x57\x7c\x85\x06\x15\x25\xa1\xbc\x10\xa9\xd1\xee\xdc\xda\x1f\x20\xbc\x3a\x76\x85\x0d\xba\xa0\xd5\x09\xbf\x92\x02\x23\x68\x9c\x4e\x67\x10\xad\xa3\xf6\xb5\xa3\x11\x34\x24\x32\xfd\xae\xf5\xbc\x0b\xa0\xe8\x03\x85\x39\x46\x10\x53\xc3\x52\x17\x5c\x75\xbe\xfa\x57\x1b\xb1\x09\x44\x17\x6f\x5d\x44\x07\x3e\x34\xbc\x9c\xa6\x71\xe7\xa4\x2d\x21\x23\x4f\x5b\x47\x93\x7b\x77\x3d\x0b\x8b\x3b\x10\x99\x66\xc4\x2a\x0e\xf7\x70\xbf\x69\x2c\x32\x7b\x4b\x3e\x90\x7c\xf1\xd6\xfe\xdd\x77\x49\x3e\x1d\x01\x63\x89\xee\x22\x7c\x7f\x2c\x04\x1e\xc5\x7c\x1a\xc2\x19\xb2\x4b\x9b\xc7\xde\x51\x3e\x1a\xe1\x95\x6f\x81\xb5\x0b\x94\x9e\x46\xea\x81\x10\xf9\x90\x76\x61\xd0\x34\x04\xd2\xd1\xae\xd4\x3d\x10\x11\xaa\xc4\xbb\xf8\x35\xc6\x9f\xbe\x4c\x82\x7b\xdc\xb1\x3f\x12\x9f\x24\x1e\x59\x4b\x0c\x23\x41\x51\xd2\xc7\xa6\x70\xb3\xdc\xf8\x19\x44\xff\x6c\x87\x29\x24\x4f\x1c\xb5\x25\x52\xe9\xc6\x9b\xc6\xe6\x3e\x9b\xb3\x3a\xf5\x1d\x4f\x16\x99\xfe\xe4\x27\x7d\x69\x99\x24\x0d\xf7\x1f\xd9\xc5\xdb\x8e\xaa\x4f\xbb\x6f\xbf\xbf\xdd\x11\x6f\x8f\xc9\xd4\xd3\xa8\x38\x74\xf5\xcd\xff\xc8\xf3\xb2\xad\x08\xfe\x22\x60\x6f\x61\xf0\x45\x7a\xfc\xa3\x60\x5b\x0e\x06\xbf\x06\x6e\x97\x83\x76\xc6\x90\xc2\x3d\xa4\xb2\x3c\xb0\x68\xec\xef\x6e\xe7\x73\xf0\xfd\x2c\x68\x34\xee\xc4\xb7\x5f\x60\x4d\xdd\x9a\xf6\x09\xcd\xeb\xb6\xc0\x5c\x2a\x04\xcd\xd7\x78\x78\x32\xef\x9b\xe6\xae\x09\x6e\x2b\x59\xee\x2a\xd9\x3b\xc7\x12\x9a\x51\x63\x96\xb3\x89\x7e\xdc\x37\x14\xae\x5d\x9c\xac\x01\x5d\xf9\xfb\x0b\x1a\x5b\x0c\x5e\xb9\xb6\x71\xd3\x4a\xfd\xa9\xa2\x41\x5e\x90\xaa\xcf\x9e\xc1\x93\x69\x21\xe3\x73\x6f\x2b\x29\x66\x71\xd2\xe7\x5f\xdf\xf1\xad\xbd\x22\x03\x8f\xb7\x32\x46\xfa\xb7\x07\xb5\x53\xe3\x42\x7f\x14\xf6\x4b\x9c\x0c\x73\xfa\x44\x5e\xbb\x44\x33\xa5\x53\xbc\x4e\xf6\xb4\x97\xc3\x97\x6d\xae\x76\x4f\xcb\x3b\x9f\x83\x8d\x68\x50\x75\xa9\x81\x0a\xbd\x0b\x70\x7b\x9b\x53\x6b\x54\x27\x2e\xfe\x33\x8a\x0d\x91\x71\x23\x95\xf6\xdd\x45\xf7\xc3\xe8\xa1\x31\xd1\xf6\xd0\x7d\x2b\x71\x7f\x58\x40\xfb\x1f\x4d\xb2\x85\x94\x74\x8a\xa5\x22\x58\x7e\xe9\xb5\xb1\xb8\x9e\x97\xf5\x2a\x81\xd8\xd6\xf7\x9c\x5d\xac\x08\xcb\x45\xe1\x4b\xb6\x8d\xa0\xf5\x43\x23\xa8\xbb\x77\xb0\x6a\xce\x16\x5c\x0b\xc7\xb6\x72\xf6\x9a\x9e\x6d\x32\x75\x25\xda\x4d\x1b\x37\x1a\xbb\xb1\xd1\x29\xed\x93\xbb\x13\x39\xd9\x04\xf7\x29\xf0\x59\xbb\x4c\xc8\xd2\x5e\x78\x6c\x28\xaa\x4e\x1d\x21\xcb\x3b\x42\x66\x9b\xb2\xd3\xd1\xb5\x88\xcf\x4f\x4d\x73\xda\x7b\x0f\x72\x2e\x0a\xcc\x6c\xe2\xb3\x8c\x1b\x3e\x8f\x25\x7d\x8e\x4e\xe1\xe9\x8d\x93\x97\xb4\x86\x35\x07\x04\xdd\xd0\x97\x3b\x64\xb5\x3b\xe1\xe4\xc2\x9e\x80\xc5\x2d\x1f\xf3\xc7\x33\x39\xf4\xc0\x6f\xd7\xe8\x8b\xb7\xe4\xb0\x43\x66\xf6\xa7\x9a\xf2\x40\xef\xe2\xbe\x61\x95\x4a\xb3\xf7\x78\x33\xc6\xcf\xb2\x67\x77\x27\xac\xf0\x6b\x2d\x94\xfd\x27\x29\xd6\x08\x4b\x90\x3e\x8f\xf9\xf1\xe7\x28\x3a\xe4\xa0\x0e\xae\x3a\x76\x4f\xad\x7b\xfc\x77\x00\x00\x00\xff\xff\x32\x73\x1b\xd9\x54\x23\x00\x00") +var _templateBuilderUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x6d\x6f\xdc\xb8\x11\xfe\x2c\xfd\x8a\x89\xb0\x09\x24\xc3\xd6\x26\xf9\x56\x07\x2e\x70\x49\x9c\x9e\x81\x36\x57\xc4\xb9\xeb\x01\x49\x70\xd0\x4a\x23\x2f\x6b\x2d\xa9\x90\xd4\xda\xc6\x56\xff\xbd\x18\xbe\xe8\x65\x57\xeb\xac\x8d\xf4\xd0\x2b\x7a\x38\xc0\x92\x48\x0e\x67\x9e\x19\xce\x3c\xc3\xcd\x66\x33\x3f\x0a\xdf\x88\xfa\x4e\xb2\xab\xa5\x86\x97\xcf\x5f\xfc\xe9\xa4\x96\xa8\x90\x6b\x78\x97\xe5\xb8\x10\xe2\x1a\x2e\x78\x9e\xc2\x0f\x55\x05\x66\x92\x02\x1a\x97\x6b\x2c\xd2\xf0\xe3\x92\x29\x50\xa2\x91\x39\x42\x2e\x0a\x04\xa6\xa0\x62\x39\x72\x85\x05\x34\xbc\x40\x09\x7a\x89\xf0\x43\x9d\xe5\x4b\x84\x97\xe9\x73\x3f\x0a\xa5\x68\x78\x11\x32\x6e\xc6\xff\x7a\xf1\xe6\xfc\xfd\xe5\x39\x94\xac\x42\x70\xdf\xa4\x10\x1a\x0a\x26\x31\xd7\x42\xde\x81\x28\x41\x0f\x36\xd3\x12\x31\x0d\x8f\xe6\x6d\x1b\x86\x9b\x0d\x14\x58\x32\x8e\x10\x35\x75\x91\x69\x8c\xa0\x6d\xe9\xeb\xac\xbe\xbe\x82\xd3\x33\x58\x64\x0a\x61\x96\xbe\x11\xbc\x64\x57\xe9\xdf\xb3\xfc\x3a\xbb\x42\x70\x4b\x35\xae\xea\x2a\xd3\x08\xd1\x12\xb3\x02\x65\x04\xb3\xdd\x21\xb6\xaa\x85\xd4\x7e\xc8\xbe\x41\x1c\x06\x9b\xcd\x09\xc8\x8c\x5f\x21\xcc\xea\x4c\x2f\x69\xb3\x59\x7a\xc9\x16\x15\xe3\x57\x17\x66\x96\xa2\x15\x41\x10\x19\x75\x68\x4a\xdb\x46\x76\x1d\xf2\x82\xc6\x92\xd0\xec\x35\x5b\x34\xac\x22\xbc\x8c\x88\x9f\x8d\x1d\xef\xb3\x15\x7a\x53\x24\xe6\xc8\xd6\x76\xbc\x7b\xee\x16\xb9\x49\xab\x46\x67\x9a\x09\x4e\x93\x6a\xc9\xb8\x1e\xac\x8b\x52\x3f\x6a\xe0\x09\xe7\x73\x18\x6e\xdb\xb6\xe4\x3b\x02\xde\x7f\x29\x85\x04\x83\x27\xe3\x57\x66\x6a\xea\xf4\x01\xe4\x9a\x69\x86\x2a\x0d\xf5\x5d\x8d\xdb\x62\x94\x96\x4d\xae\x61\x13\x06\xb9\x01\xdc\x5a\xdb\x63\x69\x7d\x34\x2f\x19\x56\x85\x22\x48\x4f\x08\xa1\x5a\x62\xc1\xf2\x4c\xa3\x82\x4f\x5f\xba\x97\x74\xb8\x6f\x68\xb5\xfe\xc7\x12\x25\x42\x56\x14\x0a\x32\xe0\x78\x03\xdd\x6c\xa3\xf2\xc0\x84\x34\x2c\x1b\x9e\x43\x3c\xc4\xaf\x6d\xe1\x68\xac\x70\x62\x25\xc6\xb5\x82\x34\x4d\xa7\xb7\x4e\xb6\x17\x91\x79\x63\xb1\xe9\xc0\x82\x33\xc8\xea\x1a\x79\x11\xef\x9d\x72\x0c\xb5\x4a\xd3\x34\x09\x03\x89\xba\x91\x1c\x46\x3e\xb6\xb6\x6e\x36\x70\xc3\xf4\x12\xf0\x56\x53\xac\xcc\x20\x7a\x6d\xf7\x8f\x46\x8e\x0f\x46\x91\xaa\x50\x6b\x9a\x91\xba\x98\x70\x51\xf6\x38\x61\xce\x55\x58\x5c\xa1\xda\x15\x39\x9f\xc3\x65\xb6\x46\xc0\x5b\xcc\x1b\x32\x9b\xa0\xff\xda\xa0\xbc\x83\x8c\x17\x60\x0d\xb3\x5f\x79\xb3\x5a\xa0\xa4\x43\x2c\xc5\x8d\x9a\xaf\x51\x6a\x96\xa3\x82\x55\xa6\xf3\x25\x16\xb0\xb8\xb3\xa7\x5b\xd4\x28\x4d\x8c\x4e\xb9\x0e\xa6\x7c\x47\x1a\xc4\xb9\xbe\x85\x5c\x70\x8d\xb7\x9a\x4e\x39\xfd\x4d\x20\x66\x5c\x1f\x03\x4a\x29\x64\x42\xee\x5a\x67\x92\x8e\x6c\x80\x52\xda\xaf\x61\x10\x64\x65\x89\xb9\xc6\x02\x18\xd7\x61\x90\xd8\x50\x65\x25\xcc\xd2\x1f\x33\x65\x0f\xe1\x5b\x2c\xb3\xa6\xd2\xf6\x18\x6f\xa9\x93\x16\x76\x50\xc5\xc9\xe8\x4c\x07\xac\x84\x0a\xf9\xb6\xf6\xe9\x52\x88\x6b\x95\xc0\xd9\x19\x3c\x27\x8d\x26\x76\x7b\xb3\xc4\xfc\x1a\xa5\xcb\x1a\x24\x87\xd4\x3d\xdb\x0e\x8f\x34\xa7\x79\x71\xf2\xca\x0c\x3f\x39\x03\xce\x2a\x23\x31\xf0\xf1\xf4\xdc\x98\x4e\x5f\x5a\xb7\x91\xd7\xad\x33\xfa\x78\x8f\x6c\x13\xf8\x97\x5a\x48\x9b\x25\x3d\xc2\x49\x18\xb4\x80\x95\x42\xb3\x11\xa1\xb9\x6a\x34\xfc\x8d\x92\x8a\x20\x31\xe6\x09\xdf\x35\x3c\x8f\xc9\x77\x53\x4e\x39\x86\x95\x9d\xc6\x04\x4f\x20\xfe\x25\xab\x1a\x1c\xba\x28\x08\x7c\x8e\x3a\x06\x71\x4d\x59\x6c\x95\xc6\xc6\xe5\xa9\x5f\xe6\x0f\xa4\x43\xe7\x89\xb8\x1e\xdb\xcd\x59\x75\x0c\xe5\x4a\xa7\xe7\x24\xb5\x8c\xa3\x86\xe3\x6d\x6d\x9d\xdc\xa5\x47\x93\xb6\x9e\x7e\x8c\x8e\x61\x95\x78\x88\xbe\xed\x8c\xc7\x78\x63\xd7\x1d\xfd\x66\x9d\x43\x82\x51\xee\x6e\x5b\x38\xeb\x54\xa5\xd1\xc7\xfb\xab\xc7\x33\x2d\x04\x47\x38\x03\x2d\x1b\x0c\x7b\xb5\x46\xa2\xc3\x20\x30\xb8\x52\x16\x65\x04\xfe\x3d\x21\x7c\x02\x2f\x5e\x01\x83\x3f\x9f\xc1\xf3\x57\xc0\x4e\x4e\x3a\xef\x4d\xe8\x67\x96\x7c\x62\x5f\xe2\x55\xa3\x49\x3e\x99\xcc\x4a\xf8\xcd\xda\x73\x6a\x8c\xb5\xfe\x35\x7a\x1f\xc3\x16\x1c\x13\xb8\x6e\xa3\xda\x86\xf4\xff\xa4\x51\x7d\xa2\xfa\xd5\xb2\x93\x6b\x34\x6f\xc7\xb0\x68\x34\xd4\x19\x67\xb9\x22\xbf\x67\xdc\x06\x22\x88\x3c\x6f\xa4\x7a\x50\x02\xfa\x75\x3a\x03\x51\x01\xde\x84\x5b\xfe\x3b\xdd\x05\x68\xe0\x31\x17\x62\x03\x5b\x8d\x86\x31\x4a\x99\x4c\xd9\xe8\xcc\x3b\xbf\xc5\x7c\x22\x0f\x1f\x6c\x04\xad\x9f\xb6\xc1\x62\xb2\x09\x83\xdf\x0e\x51\xdf\x69\xd7\xe3\x4e\x82\x7b\xdc\xe9\xed\x7b\xe1\x6e\x24\x4f\xeb\xbc\xe9\x70\x9c\xd0\xd6\x9b\xba\x1b\x55\x63\xa4\x27\x6b\xe6\x07\x27\x28\x1a\x12\x2b\x47\x28\x23\xcb\x37\x1f\x50\x57\x4d\xda\x98\x28\xac\x87\xd4\xea\xad\x5d\xdd\x16\x33\xbd\xaa\xab\x8e\xfd\x95\x10\x15\x2c\xab\x30\xd7\xf3\xa7\x6a\xee\xb9\xf1\x30\x57\x98\x45\xb7\x9d\x62\x76\xf9\x84\x3a\x33\xc1\x71\x82\xa0\xfe\xc4\xa7\x39\xea\x90\xa2\x0e\x56\x6e\xb3\xd4\x83\x49\xea\x48\xc6\xbd\x3c\x35\x03\xc5\xf8\x55\x85\x13\x84\xf5\x6e\x40\x57\xc7\x02\x1f\xcc\x58\xbf\xcd\xcf\xc6\x56\x1f\x46\xd1\x1e\x2d\xf0\xbb\xd1\x34\x2b\xa8\xe8\xf0\xba\xe7\x28\x8e\x11\xbc\x97\x87\x1d\x0d\x7d\xf1\x2d\x46\xc6\xa9\x8b\x1c\xad\xf8\xdf\xe2\x65\x86\x9f\xec\x63\x66\x64\xfc\xff\x59\xd9\xef\xc7\xca\x86\xce\x78\x38\x2f\x7b\x9c\xb7\xbe\xc9\xc9\x3a\xb1\x7f\x3c\x3e\x36\xc0\x73\xc4\xc8\x7a\x93\xfe\x13\x6c\x6c\x94\x8a\xee\x25\x64\xa3\xbc\x42\x9a\xf7\x2e\xfc\x3e\xb4\x8c\xe4\xdd\x4f\xc9\x40\xd8\xeb\xad\x87\xa6\xd8\x3f\x0c\x47\x9b\xd0\xfa\xbf\x9c\xa6\x1d\x50\x5a\x1f\xc3\xd4\x06\x62\x7f\x5f\xb2\xd6\x3f\xce\x8f\x40\x2d\x33\x89\x85\xa7\x38\x96\xc2\xc0\x02\xf5\x0d\xa2\x0d\x44\x7d\x23\x5c\xdd\x97\x0a\xcc\x85\xea\xce\x7d\xaa\x67\x3e\xa4\x82\x49\x1e\xf0\xe9\xcb\x8f\x42\x5c\x87\x5d\x2a\x83\xc9\x72\xb0\x4f\x19\x43\x54\x40\xe2\x4a\xac\xb3\xea\xc1\xca\x38\x9a\xe3\xc8\xe4\x80\x95\xd6\x99\xca\xb3\x0a\xd2\xcb\x5c\xd4\x98\xbe\x1e\x93\xce\xef\x7e\x7f\xba\xd9\xf8\x9b\x5f\xb4\x94\xf8\xdc\x58\xe5\x7d\x6b\x4e\x08\x7d\xc7\x0e\x95\x37\x15\x66\x36\xc4\x1c\xad\x35\x73\xda\x16\x72\x1a\x50\xf4\x89\x2a\x1d\xa6\x3f\x73\xf6\xb5\x21\x00\x09\x12\x73\x73\x8c\x3e\x69\x45\x06\x3c\xc2\x95\x4a\x7e\xdb\x66\x55\x35\x39\x43\x75\xd0\x83\x16\xd0\xf1\x5e\x4c\x3f\xde\xd5\xdd\xd4\x34\x0c\x0e\x6c\xb6\x06\xda\xc6\x93\x77\xa1\xdb\xa5\x32\x1d\xad\x08\x83\x7d\xd7\x9c\x81\x85\x8b\x95\xc0\x85\x1e\xd9\xee\x64\xd6\xa6\xf0\x89\x1b\x94\x10\xfb\x73\xf2\x34\x7d\x41\x34\x7c\x60\x4c\xe2\x17\xcc\x8f\x48\x96\xb9\x72\x24\x1b\x85\x7d\xae\x33\x99\xad\x50\xa3\xa4\x24\x54\x56\x2c\xd7\xca\x9e\x5b\xf3\x43\x83\x57\xc7\xac\x30\x41\x17\x38\x9d\xf0\x2b\x29\x30\x82\xc6\xea\x74\x06\xd1\x3a\x72\xaf\x1d\x5d\xa0\x21\x56\xa8\x77\xce\xf3\x36\x80\xa2\x0f\x14\xe6\x18\x41\x4c\x8d\x49\x53\x65\xb2\xf3\xd5\xbf\x5c\xc4\x26\x10\x5d\xbc\xb5\x11\x1d\xf8\xd0\xf0\x72\xda\xd6\x9e\x13\x57\x42\x46\x9e\x36\x8e\x26\xf7\xee\x7a\x16\x16\x77\xc0\x0a\x95\x12\x7b\x38\xdc\xc3\xfd\xa6\x31\x2b\xcc\x6d\xf8\x40\xf2\xc5\x5b\xf3\x77\xdf\x65\xf8\x74\x04\x8c\x25\xda\x0b\xef\xfd\xb1\x10\x78\x14\xcb\x69\x08\x67\x98\x5e\x9a\x3c\xf6\x8e\xf2\xd1\x08\xaf\x72\x0b\xac\x5d\xa0\xd4\x34\x52\x0f\x84\xc8\x87\xb4\x0d\x83\xb6\x25\x90\x8e\x76\xa5\xee\x81\x88\x50\x25\x7e\x95\x5d\x63\xfc\xe9\xcb\x24\xb8\xc7\x1d\xcb\x23\xf1\x49\xe2\x91\x35\x04\x30\x62\x14\x25\x7d\x6c\x32\x3b\xcb\x8e\x9f\x41\xf4\x4f\x37\x4c\x21\x79\x62\x29\x2c\x91\x47\x3b\xde\xb6\x26\xf7\x99\x9c\xd5\xa9\x6f\xf9\x30\x2b\xd4\x27\x3f\xe9\x8b\x63\x8c\x34\xdc\x7f\x4c\x2f\xde\x76\x94\x7c\xda\x7d\xfb\xfd\x6d\x8f\xb8\x3b\x26\x53\x4f\xa3\xe2\xd0\xd5\x37\xff\x63\xce\x4b\x57\x11\x7c\xc3\xbf\xb7\x30\xf8\x22\x3d\xfe\xf1\xcf\x95\x83\xc1\xaf\x7e\xdb\xe5\xc0\xcd\xf8\x30\x08\xc5\x87\x54\x96\x07\x16\x8d\xfd\x5d\xec\x7c\x0e\xbe\x6f\x05\x85\xda\x9e\x78\xf7\x05\xd6\xd4\x95\x29\x9f\xd0\xbc\x6e\x0b\x2c\x85\x44\x50\xd9\x1a\x0f\x4f\xe6\x7d\x73\xdc\x35\xbb\xae\x92\x95\xb6\x92\xbd\xb3\x2c\xa1\x1d\x35\x60\x65\x3a\xd1\x77\xfb\xc6\xc1\xb6\x85\x93\x35\xa0\x2b\x7f\x7f\x41\x6d\x8a\xc1\x2b\xdb\x1e\x6e\x9c\xd4\x9f\x6a\x1a\xcc\x2a\x52\xf5\xd9\x33\x78\x32\x2d\x64\x7c\xee\x4d\x25\xc5\x22\x4e\xfa\xfc\xeb\x3b\xbb\xb5\x57\x64\xe0\x71\x27\x63\xa4\xbf\x3b\xa8\x9d\x1a\x17\xea\x23\x33\x5f\xe2\x64\x98\xd3\x27\xf2\xda\x25\xea\x29\x9d\xe2\x75\xb2\xa7\x8d\x1c\xbe\x6c\x73\xb5\x7b\x5a\xdb\xf9\x1c\x4c\x44\x83\x6c\xb8\x02\x2a\xf4\x36\xc0\xcd\xad\x4d\xa3\x50\x9e\xd8\xf8\x2f\x28\x36\x58\x41\xfd\xbe\xf2\xdd\x45\xf7\x03\xe8\xa1\x31\xe1\x7a\xe5\xbe\x95\xb8\x3f\x2c\xc0\xfd\x47\x93\x4c\x21\x25\x9d\x62\x21\x09\x96\x5f\x7a\x6d\x0c\xae\xe7\xbc\x59\x25\x10\x9b\xfa\x5e\xa6\x17\x2b\xc2\x72\x51\xf9\x92\x6d\x22\x68\xfd\xd0\x08\xea\xee\x17\x8c\x9a\xb3\x45\xa6\x98\x65\x5b\x65\xfa\x9a\x9e\x4d\x32\xb5\x25\xda\x4e\x1b\x37\x1a\xbb\xb1\xd1\x29\xed\x93\xbb\x15\x39\xd9\xec\xf6\x29\xf0\x99\x5b\xc6\x04\x37\x17\x1b\x1b\x8a\xaa\x53\x4b\xc8\xca\x8e\x90\x99\xa6\xec\x74\x74\xfd\xe1\xf3\x53\xdb\x9e\xf6\xde\x83\x32\x63\x15\x16\x26\xf1\x19\xc6\x0d\x9f\xc7\x92\x3e\x47\xa7\xf0\xf4\xc6\xca\x4b\x9c\x61\xed\x01\x41\x37\xf4\xe5\x0e\x59\xed\x4e\x38\xb9\xb0\x27\x60\xb1\xe3\x63\xfe\x78\x26\x87\x1e\xf8\xed\x1a\x7d\xf1\x96\x1c\x76\xc8\xcc\xfe\x54\x53\x1e\xe8\x5d\xdc\x37\xac\x42\xaa\xf4\x3d\xde\x8c\xf1\x33\xec\xd9\xde\xfd\x4a\xfc\xda\x30\x69\xfe\xe9\x89\x31\xc2\x10\xa4\xcf\x63\x7e\xfc\x39\x8a\x0e\x39\xa8\x83\x2b\x8d\xdd\x53\x6b\x1f\xff\x1d\x00\x00\xff\xff\xa1\xa5\x1b\x07\x3c\x23\x00\x00") func templateBuilderUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -261,7 +261,7 @@ func templateBuilderUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/update.tmpl", size: 9044, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/builder/update.tmpl", size: 9020, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -606,7 +606,7 @@ func templateDialectSqlByTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlCreateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x6d\x6f\xdb\xc8\x11\xfe\x4c\xfe\x8a\x39\xc1\x0d\x48\x57\xa6\x9c\xa0\x28\x50\xa7\x3a\xe0\xce\x4a\x5a\x01\x77\x41\x5b\x27\x87\x43\x0d\x21\x58\x91\x43\x69\x21\x6a\x97\xd9\x5d\xba\x36\x04\xfe\xf7\x62\x66\x49\x8a\x12\x65\xd9\x7d\xb9\x2f\x31\xb5\x3b\x6f\x3b\xf3\xcc\xec\xb3\xd9\xed\x26\x97\xe1\xad\x2e\x9f\x8c\x5c\xad\x1d\xbc\xbb\x7e\xfb\xa7\xab\xd2\xa0\x45\xe5\xe0\xa3\x48\x71\xa9\xf5\x06\xe6\x2a\x4d\xe0\x87\xa2\x00\x16\xb2\x40\xfb\xe6\x01\xb3\x24\xfc\xbc\x96\x16\xac\xae\x4c\x8a\x90\xea\x0c\x41\x5a\x28\x64\x8a\xca\x62\x06\x95\xca\xd0\x80\x5b\x23\xfc\x50\x8a\x74\x8d\xf0\x2e\xb9\x6e\x77\x21\xd7\x95\xca\x42\xa9\x78\xff\xa7\xf9\xed\x87\x4f\x77\x1f\x20\x97\x05\x42\xb3\x66\xb4\x76\x90\x49\x83\xa9\xd3\xe6\x09\x74\x0e\xae\xe7\xcc\x19\xc4\x24\xbc\x9c\xd4\x75\x18\xee\x76\x90\x61\x2e\x15\xc2\x28\x93\xa2\xc0\xd4\x4d\xec\xb7\x62\x92\x1a\x14\x0e\x47\x50\xd7\x24\x71\xb1\xac\x64\x41\xf1\xdc\x4c\xa1\x14\x36\x15\x05\x5c\x24\x77\xa9\x2e\x31\xf9\xb1\xd9\x69\x04\x0d\xa6\x28\x1f\xbc\x64\xf7\xdd\xa9\x37\x42\xdb\xca\x09\x27\xb5\x62\x73\x46\x2a\xd7\xd3\x1b\x25\xed\xee\x08\x48\x3e\xcc\x2b\x95\x42\x74\x60\xbb\xae\xe1\xb2\x1f\x55\x5d\xc7\x60\xbf\x15\x77\xe2\x01\xa3\xd4\x3d\x42\xaa\x95\xc3\x47\x97\xdc\xfa\xbf\x31\x44\x2c\x9e\x7c\x12\x5b\x84\xba\x1e\x03\x1a\xa3\x4d\x0c\xbb\x30\xe0\xf5\x7f\xec\x0d\x8f\xe1\xab\x2d\x31\xa5\xc8\x8e\x5c\x26\x3e\x25\x77\x25\xa6\x51\x1c\x06\x32\x27\x2b\x24\x67\xbf\x15\x2b\x23\xca\x75\x72\xcb\x02\x9f\x74\xc6\x51\x8c\x07\x06\x32\x43\x5f\x8d\x87\xf8\x3d\xeb\x7f\x37\x05\x25\x0b\x8a\x84\x2c\xa6\x68\xcc\x18\xf4\x86\xcc\x4a\x7b\xf7\xf7\x9f\x6e\xb5\xb2\xce\x08\xa9\xdc\x07\x0a\x39\x42\x63\xe2\xf7\x24\x40\x0a\x01\x19\x98\xb2\x52\x18\x04\x75\x18\x04\x06\x5d\x65\x14\x59\xe4\x33\x86\xb4\xb8\xdb\x5d\x81\xcc\x41\xa8\x0c\x2e\x92\xf9\x2c\xf9\x62\xd1\xcc\xb8\xe2\x19\x44\xda\xf8\xc5\xb9\xbd\x73\x46\xaa\x55\xfb\xeb\xcb\x97\xf9\x2c\xa6\xf4\x07\xac\x3f\xb9\x84\x99\x06\xa5\xdd\x5a\xaa\xd5\x18\x96\x98\x8a\xca\x22\x21\xcd\x22\xbc\x03\xf7\x54\xa2\x85\x6d\x65\x1d\x2c\x11\x6c\x55\x96\x85\xc4\x0c\x96\x4f\x8c\xc5\xca\xa2\x49\xe0\x72\x02\x57\x75\x13\x0e\x16\x16\xf7\xc6\x65\x3e\x0c\x8c\x37\x29\x23\xc7\xf5\x49\xe6\x33\x98\x4e\xe1\x9a\x13\xc0\xb6\x54\x27\x9d\x51\xda\x38\xb9\x64\xee\x17\x51\x54\x98\x44\x52\xb9\x3f\xfe\x21\xa6\xfd\x93\xa6\xbc\x83\xf9\x2c\xf9\xfc\x54\x52\x4c\x91\xcc\xe2\x17\xe3\xaa\x8f\x7c\xf7\xbf\x9b\x12\x0c\x71\xa5\x64\x11\xbe\x1e\xce\x7d\xb0\x0d\xe0\x7b\x79\x04\x39\x12\x63\x34\x3f\x08\x03\x51\x38\x3c\x2a\x4c\xe1\x4d\xdf\xc4\x2e\xd5\x2a\x97\xab\x9b\x21\xc6\x79\x9d\xce\xe7\xdb\x60\x0a\x6f\x4e\xf8\x62\xf0\x7d\x16\xcb\x02\xbd\x85\xe4\x6f\x22\xdd\x88\x15\x59\x4e\x78\x79\x4c\x02\xf3\xd9\x4d\x4f\xfb\xa3\xc4\x22\xeb\x94\x03\x4a\xf7\x0d\xe4\xb4\x98\xf4\x4b\x90\x30\xe2\xdb\x93\xb2\xe8\xad\x2e\xaa\xad\x1a\x7a\x6a\xd5\x58\x43\x28\xd7\x2a\xf0\xbf\x75\x18\xc4\xe1\xf9\x32\xca\x1c\x64\xd6\x76\xdb\xc1\x58\xea\x19\xff\xb9\x59\xfb\x0b\x92\xfd\xa8\xd7\x7c\xa7\xe1\x24\x33\xda\x3b\x04\x61\xbb\x7c\x84\x14\xfa\x36\x42\xad\x10\x2e\x72\x0a\xe1\xc2\xe7\xc8\x76\xd1\x3d\x90\xf2\xb9\x00\xf3\x33\xe1\xf9\x10\x1a\x8b\x53\x10\x65\x89\x2a\x8b\xfa\xab\xe3\xd7\x57\x27\x7f\xae\x36\x7c\xbe\x9b\x26\xd2\x17\xab\x95\x0f\x6b\x75\xba\x33\xbd\xf0\x9d\x33\x55\xea\x38\x34\x8f\xe1\xdd\x8e\xab\x99\x27\x9f\x64\x51\x10\xce\xa0\xae\x09\xd7\x3e\xa3\x1c\xc4\xd9\x34\xa3\x4f\xf3\x87\x6c\x85\xfb\x2c\x2b\x9d\xa1\x7d\x2e\xc3\x78\x14\xc4\x7c\x66\x29\xc9\x05\xaa\x88\xf5\x62\xf8\xbe\x99\x45\xec\xe7\x5f\xd2\xad\x01\x1f\x1d\xf9\xbe\x80\x11\x39\x1a\x91\xdb\x11\x5d\x0a\x76\x04\xce\x54\x08\xa3\x7f\xa2\xd1\x23\x18\x29\x59\x8c\x9a\x81\x42\x19\x70\xb8\x2d\x0b\xe1\x8e\xee\xe1\x0c\x73\x64\x2b\x09\xb5\xed\x6e\x72\xd9\xdc\xd6\x19\xdd\xf4\x24\x50\x95\x99\x70\x98\xb8\x6d\x59\x00\xdf\xe8\xc1\xf1\x5c\xf4\x35\xf7\x87\x3e\x02\x02\x2f\x8e\x81\x3c\xc4\xc3\xcc\x3d\x3b\xca\x58\x39\xf4\xe4\xa1\x11\x3e\xcf\x23\xbe\x2e\xab\x62\xf3\x1b\x90\x89\x70\x32\x01\xba\xf5\x9b\x71\x69\xf9\xbe\xe9\x0f\x3a\x40\xe5\xa4\x93\x68\x5b\x62\x94\x09\x27\x96\xc2\x62\xf2\xda\x41\x7c\x86\x54\xdc\x2f\x9e\xa5\x15\x94\x20\x06\xd5\x56\x6c\x90\x04\x4f\x4c\xd1\x31\xc3\xe8\x78\x02\x37\xbe\x6d\x1c\x87\x41\x07\xcd\xd6\xca\xa1\xbb\x97\xd4\x19\xcc\xda\xf4\x2d\xfc\xec\x97\x5e\xd6\xcd\xb5\x01\xc9\x79\xe7\xd6\x79\x4e\x94\xa1\x4f\x99\x8c\x24\x48\xe5\xc6\x9e\x78\x0e\x52\xc5\x0d\xd2\x2b\xfb\x73\xe6\xee\xe5\xa2\xc5\x2f\x8f\xed\xbf\x0a\x3b\xc3\x5c\x54\x85\x6b\x1b\xa5\x91\x4c\x32\xbf\x6c\xa3\x78\x08\x78\xba\x05\xb7\x95\x83\xe6\xb0\x30\xf5\x5f\xf8\x91\xe2\xe4\x60\x4f\xd4\x73\x0c\x5b\x68\xa7\x69\x0c\xd1\x2f\x7e\xf6\xee\x2b\x1a\x04\x41\x3b\x1c\xda\x91\xbc\x4d\x9a\x8b\xb9\xd5\x6b\x2a\xc3\x21\xd1\x68\xf9\xae\x1d\xc6\x87\xcc\x2c\xdf\xba\x84\xe9\x5c\x1e\x8d\x2a\x85\x8f\x25\xa6\x0e\x33\xe8\x66\x0f\xd1\x29\xf8\xdd\xe7\xd1\x18\xb6\xde\x54\xdd\x1a\x6c\x18\x67\x9b\x84\x74\x8d\xe9\x26\x1a\x32\xc9\xe0\x04\x13\xec\xcc\xb4\xca\x9d\xbb\x69\xe7\x99\xf7\x19\x74\xf7\x72\x31\x06\x06\xf1\xbd\x5c\x40\xcf\xe3\x01\x07\x6e\x72\x4d\xde\x39\x51\x6d\x98\x12\xfe\xcc\x00\x6b\x01\x18\x5f\xbd\x6d\xe3\xfa\xca\xe1\xb4\x3e\x35\x95\xfc\xf7\x6f\x17\x3e\x83\x18\x11\x7a\x86\xbc\x79\x8f\x0e\x12\x6d\x83\x6d\x52\xe3\xc9\x64\x63\x7d\x32\x81\xb9\x7a\xd0\x1b\xa6\xa6\x20\x52\x57\x89\x02\x74\x89\xc6\x9f\x54\xfb\x19\x40\x53\xd6\xba\x7d\xbe\x9b\xd1\x90\xae\x85\x54\x89\x37\xd4\xe4\xba\x47\xee\x7f\x14\x2e\x5d\xfb\xe6\x3d\xcf\xee\xdf\x9c\x52\xe1\xab\x95\x2f\x81\x1b\x9f\xd6\xfa\x64\xd5\xfe\x8b\x37\x40\x70\xfc\x0e\xd8\x57\xba\xf9\x53\x1f\x80\x37\xc9\xb4\x22\x46\x42\x57\x51\x1f\x56\xaf\x85\xcf\xff\xfa\x9c\x08\xfe\xef\x2f\x8a\xb6\xff\xbb\x47\x45\xf0\x12\x7f\x0f\xf6\x17\xff\xbd\x5c\x1c\x3c\x29\x06\xc3\xa4\x7b\x58\xb4\xdd\x70\xf2\x6d\xd1\xeb\x9b\x73\xcf\x8a\xd7\x44\x56\x9f\x8c\xe2\xe8\x67\x5b\x9f\xae\x57\xe9\x75\xd1\xf1\xa9\x6e\x78\x53\x13\xb6\xad\xbb\xd6\x7a\x63\x63\xb8\x82\xb7\xef\x41\xc2\xf7\x53\xb8\x7e\x0f\xf2\xea\x6a\x3f\xdb\x7a\x6d\xce\xb2\xf7\x72\x41\x1d\x1c\xb7\x2f\x9e\x60\xdf\xb2\x0b\xdf\xc0\x44\x19\x22\x39\x86\xd4\x3d\xc6\xfc\xd6\x94\xf9\x61\xdf\x77\xec\x48\xe6\xd0\x74\xfe\x4d\xaf\xf5\xaf\xbb\xc6\x3f\xd9\x51\x5d\xdf\x5f\xf7\xba\x7e\xd8\x36\x43\xac\xd6\x1c\x4c\x3f\x47\xdd\xf3\xab\x21\x0c\xbf\x42\x2a\x8a\xc2\x7a\xf2\x40\x58\x2e\x85\x92\xa9\xa5\xca\xf0\x92\xd7\xb5\x20\x94\x9f\x6c\xff\x11\x5d\xf8\xf5\x34\x5f\x38\xba\xbf\xf9\xbd\xd6\xe5\xe4\xf8\xec\x2d\xed\xd8\xff\x4f\x43\xef\xc8\x1c\x2c\xcf\x81\xfe\x41\x1f\xc2\xba\x47\xc8\xfe\x1d\x00\x00\xff\xff\xe0\x3f\xf8\xa3\x9c\x12\x00\x00") +var _templateDialectSqlCreateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x7b\x6f\xe3\xb8\x11\xff\x5b\xfa\x14\x73\x46\xba\x90\x52\x47\xce\x2e\x8a\x02\xcd\xd6\x07\xdc\xc5\xd9\xd6\xc0\x5d\xd0\x22\xd9\xc3\xa2\x81\x11\xd0\xd2\xc8\x26\x2c\x93\x5a\x92\x4a\x13\x18\xfa\xee\xc5\x8c\x44\x59\x7e\xc4\x49\x5f\xff\x6c\xe4\xe1\xbc\x38\xf3\x9b\x07\x77\xb3\x19\x9d\x87\xd7\xba\x7c\x31\x72\xb1\x74\xf0\xe9\xf2\xe3\x9f\x2e\x4a\x83\x16\x95\x83\x2f\x22\xc5\xb9\xd6\x2b\x98\xaa\x34\x81\x9f\x8a\x02\x98\xc9\x02\x9d\x9b\x27\xcc\x92\xf0\x7e\x29\x2d\x58\x5d\x99\x14\x21\xd5\x19\x82\xb4\x50\xc8\x14\x95\xc5\x0c\x2a\x95\xa1\x01\xb7\x44\xf8\xa9\x14\xe9\x12\xe1\x53\x72\xe9\x4f\x21\xd7\x95\xca\x42\xa9\xf8\xfc\x97\xe9\xf5\xcd\xed\xdd\x0d\xe4\xb2\x40\x68\x69\x46\x6b\x07\x99\x34\x98\x3a\x6d\x5e\x40\xe7\xe0\x7a\xc6\x9c\x41\x4c\xc2\xf3\x51\x5d\x87\xe1\x66\x03\x19\xe6\x52\x21\x0c\x32\x29\x0a\x4c\xdd\xc8\x7e\x2f\x46\xa9\x41\xe1\x70\x00\x75\x4d\x1c\x67\xf3\x4a\x16\xe4\xcf\xd5\x18\x4a\x61\x53\x51\xc0\x59\x72\x97\xea\x12\x93\x9f\xdb\x93\x96\xd1\x60\x8a\xf2\xa9\xe1\xec\xbe\x3b\xf1\x96\x69\x5d\x39\xe1\xa4\x56\xac\xce\x48\xe5\x7a\x72\x83\xc4\x9f\x0e\x80\xf8\xc3\xbc\x52\x29\x44\x3b\xba\xeb\x1a\xce\xfb\x5e\xd5\x75\x0c\xf6\x7b\x71\x27\x9e\x30\x4a\xdd\x33\xa4\x5a\x39\x7c\x76\xc9\x75\xf3\x37\x86\x88\xd9\x93\x5b\xb1\x46\xa8\xeb\x21\xa0\x31\xda\xc4\xb0\x09\x83\x47\xa5\x33\x1c\xc2\xa3\x2d\x31\x25\x77\xf6\xec\x24\x4d\x1c\xee\x4a\x4c\xa3\x38\x0c\x64\x4e\xa2\xc4\x67\xbf\x17\x0b\x23\xca\x65\x72\xcd\x0c\xb7\x3a\x63\xd3\xc3\x03\x05\x99\xa1\xaf\xd6\x42\xfc\x99\xe5\x7f\x18\x83\x92\x05\x99\x27\x8d\x29\x1a\x33\x04\xbd\x22\xb5\xd2\xde\xfd\xfd\x97\x6b\xad\xac\x33\x42\x2a\x77\x43\x7e\x46\x68\x4c\xfc\x99\x18\x48\x20\x20\x05\x63\x16\x0a\x83\xa0\x0e\x83\xc0\xa0\xab\x8c\x22\x8d\x7c\xb1\x90\x88\x9b\xcd\x05\xc8\x1c\x84\xca\xe0\x2c\x99\x4e\x92\xaf\x16\xcd\x84\xd3\x9c\x41\xa4\x4d\x43\x9c\xda\x3b\x67\xa4\x5a\xf8\x5f\x5f\xbf\x4e\x27\x31\xc5\x3c\x60\xf9\xd1\x39\x4c\x34\x28\xed\x96\x52\x2d\x86\x30\xc7\x54\x54\x16\x09\x5e\x16\xe1\x13\xb8\x97\x12\x2d\xac\x2b\xeb\x60\x8e\x60\xab\xb2\x2c\x24\x66\x30\x7f\x61\x00\x56\x16\x4d\x02\xe7\x23\xb8\xa8\x5b\x77\xb0\xb0\xb8\x55\x2e\xf3\x43\xc7\xf8\x90\x22\xc2\x49\x49\xa6\x13\x18\x8f\xe1\x92\x6f\xcd\x0a\x54\xc7\x92\x51\xac\x38\xa2\xa4\xe3\x37\x51\x54\x98\x44\x52\xb9\x3f\xfe\x21\xa6\xf3\xad\x3c\xa7\x83\x78\xee\x5f\x4a\xb2\x1e\xc9\x2c\x7e\xd3\x83\x7a\xcf\x60\xff\xbb\x0d\x76\x0b\x1b\x25\x8b\xf0\xfd\x10\xed\x63\xe9\x00\x92\xe7\x7b\x88\x22\x36\x46\xe8\x93\x30\x10\x85\xed\xa5\x60\x0c\x1f\xfa\x72\x9b\x54\xab\x5c\x2e\xae\x0e\x71\xcb\x74\xba\x49\x03\xed\x31\x7c\x38\x62\x80\x01\x75\x2f\xe6\x05\x36\x1a\x92\xbf\x89\x74\x25\x16\xa4\x39\x61\xf2\x90\x18\xa6\x93\xab\x9e\xf4\x17\x89\x45\xd6\x09\x07\x14\xd8\x2b\xc8\x89\x98\xf4\x83\x9d\x30\x8a\xfd\xf5\x98\xf5\x5a\x17\xd5\x5a\x1d\x5a\xf2\x62\x2c\x21\x94\xf3\x02\xfc\x6f\x1d\x06\x71\x78\x3a\x61\x32\x07\x99\xf9\x0a\xda\xe9\x2f\x3d\xe5\xbf\xb6\xb4\xbf\x20\xe9\x8f\x7a\x05\xd5\x43\x8b\xcc\x98\xb0\x03\x2c\x4f\xde\x03\x02\x7d\x1b\xa1\x16\x08\x67\x39\xd9\x3d\x6b\x02\x63\x3b\x97\x9e\x48\xf8\x94\x57\xf9\x29\x9f\xd8\x85\x56\xe3\x18\x44\x59\xa2\xca\xa2\x3e\x75\xf8\xfe\x94\xe4\xaf\x25\x84\xef\x77\xd5\x7a\xfa\x66\x8a\xf2\xc3\x04\xf5\xaa\xad\xe1\xb8\x73\xa6\x4a\x1d\xfb\x43\x25\xc0\x17\xa7\xbc\xe5\xc9\xad\x2c\x0a\x42\x14\xd4\x35\x21\xb8\x09\x23\x5b\x3e\x19\x5b\x6c\x62\x7b\x93\x2d\x70\x1b\x5a\x32\x68\x5f\x0b\x2b\xee\x39\x31\x9d\x58\x8a\x6c\x81\x2a\x62\xb9\x18\x7e\x6c\x9b\x0a\xdb\xf9\xa7\x74\x4b\xc0\x67\x47\xb6\xcf\x60\x40\x86\x06\x64\x76\x40\x2d\xdd\x0e\xc0\x99\x0a\x61\xf0\x0f\x34\x7a\x00\x03\x25\x8b\x41\xdb\x24\x82\xcd\x06\x1c\xae\xcb\x42\xb8\xbd\xd1\x99\x61\x8e\xac\x25\xa1\x02\xdd\x8c\xce\xdb\x01\x9b\xd1\x70\x26\x86\xaa\xcc\x84\xc3\xc4\xad\xcb\x02\x78\x08\x07\xfb\x0d\xae\x49\x74\x73\xe9\xbd\xec\x33\x71\x08\x64\x21\x3e\x8c\xdc\x6e\x7b\x62\x89\xb0\x19\xf2\x2d\xc7\xe9\x79\xff\x38\xaf\x8a\xd5\xff\x61\xe8\x87\xa3\x11\xd0\x74\x6e\x5b\xa0\xe5\x11\xd1\xef\x63\x80\xca\x49\x27\xd1\xfa\x05\x26\x13\x4e\xcc\x85\xc5\xe4\xbd\xcd\xf5\xc4\xf0\x7f\x98\xbd\x3a\xfe\x29\x40\x8c\xa4\xb5\x58\x21\x31\x1e\x69\x92\x43\xc6\xce\x7e\x83\x6d\x6d\xdb\x38\x0e\x83\x0e\x8f\x5e\xcb\xae\xb9\xb7\xc4\x19\xc1\xda\xf4\x35\xfc\xda\x90\xde\x96\xcd\xb5\x01\xc9\x71\xe7\x7a\x79\x8d\x95\xf1\x4e\x91\x8c\x24\x48\xe5\x86\xcd\x82\x78\x10\x2a\xae\x8a\x5e\xda\x5f\x53\xf7\x20\x67\x1e\xb4\xdc\x95\xff\x2a\xec\x04\x73\x51\x15\xce\x57\x47\xcb\x99\x64\x0d\xd9\x46\xf1\x21\xca\x69\xb2\xad\x2b\x07\xed\x65\x61\xdc\x7c\xe1\x17\xf2\x93\x9d\x3d\x92\xcf\x21\xac\xc1\xf7\xcd\x18\xa2\xdf\x9a\x2e\xbb\xcd\x68\x10\x04\xbe\x23\xf8\xe6\xbb\x4e\xda\x61\xeb\xe5\xda\xcc\xb0\x4b\xd4\x4f\x7e\xf0\x6d\x77\x77\x99\xca\xd7\x2e\xe1\x0d\x2c\x8f\x06\x95\xc2\xe7\x12\x53\x87\x19\x74\x0d\x87\x36\x20\xf8\xdd\xfd\x60\x08\xeb\x46\x55\xed\x15\xb6\x4b\xa2\x0f\x42\xba\xc4\x74\x15\x1d\x2e\x7f\xc1\x91\xe5\xad\x53\xe3\x85\x3b\x73\xe3\xce\x32\x9f\x33\xe8\x1e\xe4\x6c\x08\x0c\xe2\x07\x39\x83\x9e\xc5\x9d\xb5\xb5\x8d\x35\x59\xe7\x40\x79\x37\x25\xfc\x99\x01\xe6\x01\x18\x5f\x7c\xf4\x7e\x3d\xb2\x3b\xde\xa6\xa6\x94\xff\xfe\xe3\xac\x89\x20\x46\x84\x9e\xc3\x55\x77\x8b\x0e\x62\xf5\xce\xb6\xa1\x69\xf6\xbf\x56\xfb\x68\x04\x53\xf5\xa4\x57\xbc\x4d\x82\x48\x5d\x25\x0a\xd0\x25\x9a\xe6\xa6\xba\xe9\x01\xd4\x5a\xad\xdb\xc6\xbb\x6d\x0d\xe9\x52\x48\x95\x34\x8a\xda\x58\xf7\xf6\xf1\x9f\x85\x4b\x97\x4d\xf1\x9e\x5e\xc8\x3f\x1c\x13\xe1\x21\xca\x9d\xff\xaa\x09\x6b\x7d\x34\x6b\xff\xc1\xda\x1e\xec\xaf\xee\xdb\x4c\xb7\x7f\xea\x1d\xf0\x26\x99\x56\xb4\x7b\xd0\xfc\xe9\xc3\xea\xbd\xf0\xf9\x6f\x5f\x00\xc1\xff\xfc\x11\xe0\xeb\xbf\x7b\x07\x04\x6f\x2d\xe2\xc1\x76\xda\x3f\xc8\xd9\xce\x83\xe0\xa0\x99\x74\xcf\x02\x5f\x0d\x47\x5f\x06\xbd\xba\x39\xf5\x3e\x78\x8f\x67\xf5\x51\x2f\xf6\x7e\xfa\xfc\x74\xb5\x4a\x2f\x86\x6e\x73\xea\x9a\x37\x15\xa1\x2f\xdd\xa5\xd6\x2b\x1b\xc3\x05\x7c\xfc\x0c\x12\x7e\x1c\xc3\xe5\x67\x90\x17\x17\xdb\xde\xd6\x2b\x73\xe6\x7d\x90\x33\xaa\xe0\xd8\x3f\x5d\x82\x6d\xc9\xce\x9a\x02\xa6\x3d\x21\x92\x43\x48\xdd\x73\xcc\xcf\x43\x99\xef\xd6\x7d\xb7\x12\xd1\xe3\x6b\xe8\xdb\x57\xa7\xe7\xb2\x2b\xfc\xa3\x15\xd5\xd5\xfd\x65\xaf\xea\x0f\xcb\xe6\x10\xab\x35\x3b\xd3\x8f\x51\xf7\xa4\x6a\x17\x86\x6f\x90\x8a\xa2\xb0\xcd\xf2\x40\x58\x2e\x85\x92\xa9\xa5\xcc\x30\xa9\x91\xb5\x20\x54\xd3\xd9\xfe\xad\x75\xe1\xdb\xf1\x7d\x61\x6f\x7e\xf3\x1b\xac\x8b\xc9\xfe\xdd\xfd\xda\xb1\xfd\xcf\x81\xde\x95\xd9\x59\xee\x03\xfd\x8b\x3e\x85\x75\x6f\x21\xfb\x57\x00\x00\x00\xff\xff\x7a\xf4\x62\x3b\x44\x12\x00\x00") func templateDialectSqlCreateTmplBytes() ([]byte, error) { return bindataRead( @@ -621,7 +621,7 @@ func templateDialectSqlCreateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/create.tmpl", size: 4764, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/create.tmpl", size: 4676, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -846,7 +846,7 @@ func templateDialectSqlTxTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\x5f\x4f\x1b\xbb\x12\x7f\xce\x7e\x8a\xe9\x0a\xa1\x04\xa5\x0b\xb7\x6f\x37\x55\xae\x44\x81\x5e\x45\xb7\xa5\xbd\x84\xf6\xe1\x54\x15\x32\xeb\xd9\x60\xe1\x78\x17\xdb\xcb\xa1\x27\xda\xef\x7e\x34\xfe\xb3\xd9\x64\x03\x94\x9e\x3e\x10\xbc\xf3\xcf\xe3\xdf\x8c\xc7\x33\xab\xd5\xe1\x41\x72\x52\x56\x3f\xb4\x58\xdc\x58\x78\x73\xf4\xaf\x7f\xbf\xae\x34\x1a\x54\x16\xde\xb3\x1c\xaf\xcb\xf2\x16\x66\x2a\xcf\xe0\x58\x4a\x70\x42\x06\x88\xaf\xef\x91\x67\xc9\xe5\x8d\x30\x60\xca\x5a\xe7\x08\x79\xc9\x11\x84\x01\x29\x72\x54\x06\x39\xd4\x8a\xa3\x06\x7b\x83\x70\x5c\xb1\xfc\x06\xe1\x4d\x76\x14\xb9\x50\x94\xb5\xe2\x89\x50\x8e\xff\x61\x76\x72\x76\x3e\x3f\x83\x42\x48\x84\x40\xd3\x65\x69\x81\x0b\x8d\xb9\x2d\xf5\x0f\x28\x0b\xb0\x9d\xcd\xac\x46\xcc\x92\x83\xc3\xa6\x49\x92\xd5\x0a\x38\x16\x42\x21\xa4\x5c\x30\x89\xb9\x3d\x34\x77\xf2\xb0\xae\x38\xb3\x98\x42\xd3\x90\xc4\x5e\x75\xbb\x80\xc9\x14\xf6\xb2\x79\x5e\x56\x98\x7d\x66\xf9\x2d\x5b\x60\xe4\x5e\xd7\x42\x92\xb7\x93\x29\x54\xcc\xe4\x4c\xb6\x82\xef\x02\x27\x08\x6a\xcc\x51\xdc\x7b\xc9\x76\xdd\xaa\x07\xa1\x65\x6d\x99\x15\xa5\x72\xe6\xb4\x50\xb6\xa3\x97\x66\x91\xdb\xba\x56\x2a\x24\xc9\x1b\x66\xe6\x75\x51\x88\x87\xb5\xbd\xf4\x93\x8a\x27\x78\x0d\x7b\x7f\xa1\x2e\x49\xf0\x08\x9a\x66\xb5\x02\x51\x78\x55\xf7\xe1\x99\x53\x48\x95\x90\xa9\x27\xa1\xe2\xad\xaa\x46\x4b\x9a\xa9\x4a\x77\xe9\x12\x97\xa0\xb9\x88\x4e\x76\xf5\x93\xa2\x56\x39\x0c\x37\x0e\xdf\x34\x70\xd0\x85\xad\x69\x46\x60\xee\xe4\x9c\xdd\xe3\x30\xb7\x0f\x90\x97\xca\xe2\x83\xcd\x4e\xfc\xff\x51\x54\xb7\xa4\xb9\xb1\xbd\x33\x93\x9d\xb3\x65\xf0\x05\xa5\xa1\x95\x50\xb6\xf5\x60\x0c\xa8\x35\xfd\x95\x7a\x04\xab\x64\x70\x65\x2a\xcc\xe9\x34\xfb\xe6\x4e\x2e\x34\xab\x6e\xb2\x2f\x2e\xd6\xf3\x0a\xf3\x55\x32\x18\x9c\x97\x1c\x27\x1d\x2e\x7d\x47\xde\xe0\x92\x5d\x4b\x9c\x80\xdb\x76\x9d\x04\x99\x23\x8f\x49\xe0\xa4\x94\xf5\x52\x99\xbe\x48\x60\x38\xa1\xd9\x69\x77\x83\xf7\x02\x25\x6f\x77\x18\x5c\xfe\xa8\x70\x02\x05\x11\x33\x67\x64\x76\x9a\x11\x8d\xe0\x30\x36\x9c\xd5\x99\x09\x9b\xf5\xf7\x8a\x6a\x4e\x83\x29\x1b\x15\xdc\x2f\xfd\x34\xc9\x80\x02\xbb\x06\x32\x19\x0c\x04\x1f\x43\x79\x4b\xc8\x6c\x24\x61\xc7\xdc\xc7\x40\xfb\xaf\x8b\xc4\x70\x44\x4a\x05\xbc\x2a\x6f\xc1\x79\xae\xd1\xd6\x5a\x41\x9b\x4e\x84\xfd\xfe\x57\x26\x05\x77\x5a\x67\x14\x82\x15\xf9\x3f\x81\x74\x76\x9a\xba\xc0\x4c\xa0\x58\xda\xcc\xb1\x8a\x61\xba\x14\xc6\x08\xb5\x80\x6e\x54\xb3\xd9\x29\x14\xa5\x86\x70\x21\x47\xe4\x2a\xfd\xb9\x38\xba\xe0\x90\x6b\x5f\x99\xac\x11\xa6\x20\xb8\x3f\x59\x48\x04\xef\x61\x65\xe2\xa9\x3a\x29\x98\x55\x1a\xb9\xc8\x99\x45\xf3\x16\x24\xaa\x61\x65\x46\xf0\x1f\x38\xf2\x67\xf1\xd6\x3f\x47\x11\x98\x02\xe5\xf1\xd0\xa0\x74\x15\x05\x0e\xcc\x9d\xcc\xe6\xe1\x6b\xe4\x75\x06\xe4\xa6\x70\x57\x9b\xa9\x05\xd2\xb6\x9e\x3e\xa8\xcc\x37\xf1\xbd\x55\x1e\x39\x62\x93\x84\x9f\x10\x8b\x70\x5f\xdc\xda\xeb\xef\x15\xbe\xe4\xb8\xfc\x30\xfe\x34\x31\x6c\xa5\x86\xa1\x2a\x2d\xec\x15\xd9\x6c\x49\xb1\xba\x96\x38\xa2\x2f\x9f\xcb\xa7\x58\xb0\x5a\xda\xa0\x43\x18\xdc\x13\x40\x4f\x05\xb8\xe8\x85\xf7\x2d\xc4\xc8\x46\x3c\xbc\x27\xd9\xdc\x5d\x78\x56\x55\xa8\xf8\x70\x9b\x33\x7e\x3c\xb3\xfb\xb9\x5d\x3c\x96\xd9\x83\x81\x8b\xe8\x24\xf8\x1d\x68\x4f\xe5\x7b\xd1\xcb\xf6\xc1\xa0\xe9\x40\x1d\x91\x63\x8a\xb7\xfb\x9e\xd7\x4b\xd4\x22\x0f\xca\xf7\xa8\x2d\xf2\xcb\xf2\x1d\x33\x22\x8f\xd0\x3d\x8b\xdd\x31\xe7\xc8\xbd\x03\x73\xab\xeb\xdc\xba\x43\xf7\x00\xdc\x44\xf0\x98\xf3\x47\x10\x3c\xe6\xfc\x49\x04\x5f\x02\xe1\x4e\x0c\x5f\x0c\x62\x44\xb1\x03\x63\xcc\xd5\x5d\x5f\x54\x53\x8a\xec\x53\x45\xf8\x30\xd9\xc9\xc0\xdd\x49\xb7\x89\xd9\x89\x44\xa6\x91\x0f\x47\x3b\xf3\xce\x71\x1f\xc1\xcd\xf1\x7e\x57\xee\xfd\x93\x3c\xdb\xbe\xcb\x3b\xee\xf5\xd5\x18\xf6\xd0\xdf\xed\x33\xbe\x40\xd3\x16\xaa\x5d\x10\x61\x7b\x2f\x03\x38\x2e\xb5\x3c\x3e\x64\xf3\x4f\x61\x6f\x00\x1f\x2c\xed\xb3\x07\x29\x19\x4c\xc9\x7c\x13\xc3\x05\x16\x97\x95\xa4\x22\xb6\xd1\xe0\x70\x2c\xd0\xc9\x66\x3b\x43\xe9\xc1\x75\xee\xed\xc6\xbd\xc3\x1a\x03\x59\x1a\x85\xc2\x1c\x92\xc0\x55\x27\xcc\xbe\x28\x71\x57\x47\x6f\x1c\x99\xa3\xd9\x75\x8f\x2e\x70\x59\xde\xfb\x9b\x84\x5b\x59\x31\x3b\x35\x74\x99\xa8\x48\x3b\x75\x5f\xa7\xf7\xf7\xe1\xd5\x4b\x01\x7b\x12\xb1\x94\x1e\x13\x93\x82\xd5\x35\x42\xfa\x07\xea\x32\x6d\x5f\x32\x1f\xe7\x9f\x07\x73\x0b\xcd\x5f\x84\xb3\xc5\xb3\xb5\xf4\x14\x82\x3f\x0f\xdd\xb3\xc9\xf3\x2c\x14\xbf\x23\xad\x76\x14\xc1\x96\xb1\x91\x52\xdb\xd7\x68\xa3\x6d\xe9\xb4\x86\x53\xd8\xdf\xe8\x07\xf3\x52\x15\x62\x31\xe9\xbd\xfc\x9e\xbe\x6e\x22\x8e\x8d\x11\x0b\x05\xb1\x45\x20\x5b\x19\x73\x34\x57\x40\x4d\x2b\x38\xcf\x59\x20\x6d\x0a\x9b\x96\x4e\x4d\xd1\x93\xee\x8a\xc2\xf5\xa3\x53\xd8\xea\x3e\x09\x70\x6a\x7e\xc7\x3d\x6f\xb9\xa6\xd5\x18\x9c\x0b\xa3\xb7\x4e\xfd\xd5\x14\x94\x90\x14\xc7\x5e\xb3\xb3\x76\x6b\xfc\xf8\x4e\xe6\x97\xb7\xea\x24\xe2\x55\x7c\x12\x51\xeb\x6c\x78\xd0\x69\x98\xed\x7b\x9a\xcf\x5c\x57\xd7\x79\x04\xbd\x37\xfb\x1b\xec\x55\xaf\xc6\x7e\x60\xd7\x28\x5d\x5f\xe4\xcf\x25\x0a\xc8\x51\xeb\xb8\x97\x30\xf3\xff\x7f\x70\x15\x58\x33\xa1\xac\x33\x32\x44\xdd\xdf\x87\x94\x42\x45\xda\xd5\x98\x3a\x6e\x93\x74\x79\x11\x35\x25\x64\xe2\x46\xab\x38\xc2\x3c\x32\x22\xb6\xa9\x1e\x03\x1d\x8b\xba\x1f\xfd\x28\x97\xe1\x35\xf1\x48\x6a\x73\xe2\x20\x5e\x7c\x9b\x2e\x50\x4e\xd6\x31\xf2\x97\xf8\x02\xa5\x7b\x9d\xc2\x13\x33\xa3\xde\xc4\x84\xb9\x03\xb3\x99\x09\x84\xc0\x7e\x64\x28\xf1\xc2\x8e\xb9\xf5\x64\x75\x87\x14\xca\x4e\xcc\x3e\xbe\xf9\x18\xa6\xb9\xbe\x85\xcf\xff\xeb\xa8\xaf\x87\xac\x6f\xdf\x8d\xd5\x42\x2d\xfa\x21\xf4\x6a\x7e\x93\x8e\x2a\xac\xc7\x42\x72\xe2\x9d\xe0\x22\x9e\x88\xd6\xed\x61\xf4\x02\xed\x64\x0b\x2c\x4f\x5d\xf9\xe1\x89\x90\x7b\xc1\x00\x85\xfe\xa1\xff\xb9\x31\x2a\x08\xf7\x61\x0c\x26\x9e\x1b\xa9\x5c\x45\x8d\x29\xe0\xae\x9a\xbf\x2f\x34\x1b\x5c\x8d\xe1\x76\x3d\x1e\xf8\x3a\xee\x33\x96\x2f\x28\x50\x74\xc4\xa0\xd3\xd6\xc5\x1e\x6b\x0c\xb7\xfd\xb2\xd8\x59\xfe\x1d\x00\x00\xff\xff\xea\x87\x2a\x76\x94\x11\x00\x00") +var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x57\xdf\x4f\x1b\xb9\x13\x7f\xce\xfe\x15\xd3\x15\x42\x09\x4a\x17\xbe\x7d\xfb\xa6\xca\x49\x14\xe8\x29\xba\x96\xf6\x1a\xda\x87\xab\x2a\x64\xd6\xb3\xc1\xc2\xf1\x2e\xb6\x97\xa3\x17\xed\xff\x7e\x1a\xff\xd8\x6c\xb2\x01\x4a\xaf\x0f\x04\xef\xfc\xf2\xf8\x33\xe3\xf1\xcc\x6a\x75\x78\x90\x9c\x94\xd5\x77\x2d\x16\xd7\x16\x5e\x1d\xfd\xef\xff\x2f\x2b\x8d\x06\x95\x85\xb7\x2c\xc7\xab\xb2\xbc\x81\x99\xca\x33\x38\x96\x12\x9c\x90\x01\xe2\xeb\x3b\xe4\x59\x72\x71\x2d\x0c\x98\xb2\xd6\x39\x42\x5e\x72\x04\x61\x40\x8a\x1c\x95\x41\x0e\xb5\xe2\xa8\xc1\x5e\x23\x1c\x57\x2c\xbf\x46\x78\x95\x1d\x45\x2e\x14\x65\xad\x78\x22\x94\xe3\xbf\x9b\x9d\x9c\x9d\xcf\xcf\xa0\x10\x12\x21\xd0\x74\x59\x5a\xe0\x42\x63\x6e\x4b\xfd\x1d\xca\x02\x6c\x67\x33\xab\x11\xb3\xe4\xe0\xb0\x69\x92\x64\xb5\x02\x8e\x85\x50\x08\x29\x17\x4c\x62\x6e\x0f\xcd\xad\x3c\xac\x2b\xce\x2c\xa6\xd0\x34\x24\xb1\x57\xdd\x2c\x60\x32\x85\xbd\x6c\x9e\x97\x15\x66\x1f\x59\x7e\xc3\x16\x18\xb9\x57\xb5\x90\xe4\xed\x64\x0a\x15\x33\x39\x93\xad\xe0\x9b\xc0\x09\x82\x1a\x73\x14\x77\x5e\xb2\x5d\xb7\xea\x41\x68\x59\x5b\x66\x45\xa9\x9c\x39\x2d\x94\xed\xe8\xa5\x59\xe4\xb6\xae\x95\x0a\x49\xf2\x9a\x99\x79\x5d\x14\xe2\x7e\x6d\x2f\xfd\xa0\xe2\x09\x5e\xc2\xde\x3f\xa8\x4b\x12\x3c\x82\xa6\x59\xad\x40\x14\x5e\xd5\x7d\x78\xe6\x14\x52\x25\x64\xea\x49\xa8\x78\xab\xaa\xd1\x92\x66\xaa\xd2\x5d\xba\xc4\x9d\x42\x7a\xa9\x4a\x8e\x9b\xca\x49\x51\xab\x1c\x86\x1b\x27\x6f\x1a\x38\xe8\x62\xd6\x34\x23\x30\xb7\x72\xce\xee\x70\x98\xdb\x7b\xc8\x4b\x65\xf1\xde\x66\x27\xfe\xff\x28\xaa\x5b\xd2\xdc\xd8\xdb\x99\xc9\xce\xd9\x32\x38\x82\xd2\xd0\x4a\x28\xdb\x7a\x30\x06\xd4\x9a\xfe\x4a\x3d\x82\x55\x32\xb8\x34\x15\xe6\x74\x94\x7d\x73\x2b\x17\x9a\x55\xd7\xd9\x67\x17\xe8\x79\x85\xf9\x2a\x19\x0c\xce\x4b\x8e\x93\x0e\x97\xbe\x23\x6f\x70\xc1\xae\x24\x4e\xc0\x6d\xbb\xce\x80\xcc\x91\xc7\x24\x70\x52\xca\x7a\xa9\x4c\x5f\x24\x30\x9c\xd0\xec\xb4\xbb\xc1\x5b\x81\x92\xb7\x3b\x0c\x2e\xbe\x57\x38\x81\x82\x88\x99\x33\x32\x3b\xcd\x88\x46\x70\x18\x1b\xce\xea\xcc\x84\xcd\xfa\x7b\x45\x35\xa7\xc1\x94\x8d\x0a\xee\x97\x7e\x9a\x64\x40\x51\x5d\x03\x99\x0c\x06\x82\x8f\xa1\xbc\x21\x64\x36\x32\xb0\x63\xee\x7d\xa0\xfd\xee\x22\x31\x1c\x91\x52\x01\x2f\xca\x1b\x70\x9e\x6b\xb4\xb5\x56\xd0\xe6\x12\x61\xbf\xff\x85\x49\xc1\x9d\xd6\x19\x85\x60\x45\xfe\x4f\x20\x9d\x9d\xa6\x2e\x30\x13\x28\x96\x36\x73\xac\x62\x98\x2e\x85\x31\x42\x2d\xa0\x1b\xd5\x6c\x76\x0a\x45\xa9\x21\xdc\xc6\x11\xb9\x4a\x7f\x2e\x8e\x2e\x38\xe4\xda\x17\x26\x6b\x84\x29\x08\xee\x4f\x16\x12\xc1\x7b\x58\x99\x78\xaa\x4e\x0a\x66\x95\x46\x2e\x72\x66\xd1\xbc\x06\x89\x6a\x58\x99\x11\xfc\x06\x47\xfe\x2c\xde\xfa\xc7\x28\x02\x53\xa0\x3c\x1e\x1a\x94\xae\x9c\xc0\x81\xb9\x95\xd9\x3c\x7c\x8d\xbc\xce\x80\xdc\x14\xee\x5e\x33\xb5\x40\xda\xd6\xd3\x07\x95\xf9\x2a\xbe\xb5\xca\x23\x47\x6c\x92\xf0\x13\x62\x11\xee\x8b\x5b\x7b\xfd\xbd\xc2\xd7\x1b\x97\x1f\xc6\x9f\x26\x86\xad\xd4\x30\x54\xa5\x85\xbd\x22\x9b\x2d\x29\x56\x57\x12\x47\xf4\xe5\x73\xf9\x14\x0b\x56\x4b\x1b\x74\x08\x83\x3b\x02\xe8\xb1\x00\x17\xbd\xf0\xbe\x86\x18\xd9\x88\x87\xf7\x24\x9b\xbb\xdb\xce\xaa\x0a\x15\x1f\x6e\x73\xc6\x0f\x67\x76\x3f\xb7\x8b\x87\x32\x7b\x30\x70\x11\x9d\x04\xbf\x03\xed\xb1\x7c\x2f\x7a\xd9\x3e\x18\x34\x1d\xa8\x23\x72\x4c\xf1\x76\xdf\xf3\x7a\x89\x5a\xe4\x41\xf9\x0e\xb5\x45\x7e\x51\xbe\x61\x46\xe4\x11\xba\x27\xb1\x3b\xe6\x1c\xb9\x77\x60\x6e\x75\x9d\x5b\x77\xe8\x1e\x80\x9b\x08\x1e\x73\xfe\x00\x82\xc7\x9c\x3f\x8a\xe0\x73\x20\xdc\x89\xe1\xb3\x41\x8c\x28\x76\x60\x8c\xb9\xba\xeb\x8b\x6a\x4a\x91\x7d\xa8\x08\x1f\x26\x3b\x19\xb8\x3b\xe9\x36\x31\x3b\x91\xc8\x34\xf2\xe1\x68\x67\xde\x39\xee\x03\xb8\x39\xde\xaf\xca\xbd\xff\x92\x67\xdb\x77\x79\xc7\xbd\xbe\x1c\xc3\x1e\xfa\xbb\x7d\xc6\x17\x68\xda\x42\xb5\x0b\x22\x6c\xef\x65\x00\xc7\xa5\x96\xc7\x87\x6c\xfe\x2d\xec\x35\xe0\xbd\xa5\x7d\xf6\x20\x25\x83\x29\x99\x6f\x62\xb8\xc0\xe2\xb2\x92\x54\xc4\x36\xba\x1b\x8e\x05\x3a\xd9\x6c\x67\x28\x3d\xb8\xce\xbd\xdd\xb8\x77\x58\x63\x20\x4b\xa3\x50\x98\x43\x12\xb8\xea\x84\xd9\x67\x25\x6e\xeb\xe8\x8d\x23\x73\x34\xbb\xee\xd1\x27\x5c\x96\x77\xfe\x26\xe1\x56\x56\xcc\x4e\x0d\x5d\x26\x2a\xd2\x4e\xdd\xd7\xe9\xfd\x7d\x78\xf1\x5c\xc0\x1e\x45\x2c\xa5\xc7\xc4\xa4\x60\x75\x8d\x90\xfe\x85\xba\x4c\xdb\x97\xcc\xc7\xf9\xc7\xc1\xdc\x42\xf3\x27\xe1\x6c\xf1\x6c\x2d\x3d\x86\xe0\x8f\x43\xf7\x64\xf2\x3c\x09\xc5\xaf\x48\xab\x1d\x45\xb0\x65\x6c\xa4\xd4\xf6\x35\xda\x68\x5b\x3a\xad\xe1\x14\xf6\x37\xfa\xc1\xbc\x54\x85\x58\x4c\x7a\x2f\xbf\xa7\xaf\x9b\x88\x63\x63\xc4\x42\x41\x6c\x11\xc8\x56\xc6\x1c\xcd\x15\x50\xd3\x0a\xce\x73\x16\x48\x9b\xc2\xa6\xa5\x53\x53\xf4\xa8\xbb\xa2\x70\xfd\xe8\x14\xb6\xba\x4f\x02\x9c\x9a\xdf\x71\xcf\x5b\xae\x69\x35\x06\xe7\xc2\xe8\xb5\x53\x7f\x31\x05\x25\x24\xc5\xb1\xd7\xec\xac\xdd\x1a\x3f\xbc\x93\xf9\xe9\xad\x3a\x89\x78\x19\x9f\x44\xd4\x3a\x1b\x1e\x74\x1a\x66\xfb\x96\x86\x33\xd7\xd5\x75\x1e\x41\xef\xcd\xfe\x06\x7b\xd5\xab\xb1\xef\xd8\x15\x4a\xd7\x17\xf9\x73\x89\x02\x72\xd4\x3a\xee\x25\xcc\xfc\xcf\x77\xae\x02\x6b\x26\x94\x75\x46\x86\xa8\xfb\xfb\x90\x52\xa8\x48\xbb\x1a\x53\xc7\x6d\x92\x2e\x2f\xa2\xa6\x84\x4c\xdc\x5c\x15\x47\x98\x07\xe6\xc3\x36\xd5\x63\xa0\x63\x51\xf7\x73\x1f\xe5\x32\xbc\x24\x1e\x49\x6d\x4e\x1c\xc4\x8b\x6f\xd3\x27\x94\x93\x75\x8c\xfc\x25\xfe\x84\xd2\xbd\x4e\xe1\x89\x99\x51\x6f\x62\xc2\xdc\x81\xd9\xcc\x04\x42\x60\x3f\x30\x94\x78\x61\xc7\xdc\x7a\xb2\xba\x43\x0a\x65\x27\x66\xef\x5f\xbd\x0f\xa3\x5c\xdf\xc2\xc7\x3f\x3a\xea\xeb\x21\xeb\xeb\x37\x63\xb5\x50\x8b\x7e\x08\xbd\x9a\xdf\xa4\xa3\x0a\xeb\xb1\x90\x9c\x78\x23\xb8\x88\x27\xa2\x75\x7b\x18\xbd\x40\x3b\xd9\x02\xcb\x53\x57\x7e\x78\x22\xe4\x9e\x31\x40\xa1\x7f\xe8\x7f\x6c\x8c\x0a\xc2\x7d\x18\x83\x89\xa7\x46\x2a\x57\x51\x63\x0a\xb8\xab\xe6\xef\x0b\xcd\x06\x97\x63\xb8\x59\x8f\x07\xbe\x8e\xfb\x8c\xe5\x0b\x0a\x14\x1d\x31\xe8\xb4\x75\xb1\xc7\x1a\xc3\x4d\xbf\x2c\x76\x96\xff\x06\x00\x00\xff\xff\x85\x4a\xda\x98\x91\x11\x00\x00") func templateDialectSqlUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -861,12 +861,12 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 4500, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 4497, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } -var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x58\x5f\x6f\xe3\xb8\x11\x7f\xb6\x3e\xc5\x9c\xe0\xbd\xb3\x0d\x87\xda\xde\x5b\xd3\xa6\x40\x2e\xc9\xb6\x01\x16\xb9\xb6\xc9\xa2\x0f\x8b\xc5\x86\x96\x46\x16\x1b\x99\xf4\x92\x94\x93\x40\xd0\x77\x2f\x86\x94\x64\xca\x56\xd2\xec\xed\x93\x2d\x72\xfe\xfe\x66\x38\x9c\x61\x5d\x27\x8b\xe8\x42\x6d\x9f\xb5\x58\x17\x16\x7e\x7d\xff\xa7\x3f\x9f\x6c\x35\x1a\x94\x16\x3e\xf0\x14\x57\x4a\x3d\xc0\xb5\x4c\x19\x9c\x97\x25\x38\x22\x03\xb4\xaf\x77\x98\xb1\xe8\xae\x10\x06\x8c\xaa\x74\x8a\x90\xaa\x0c\x41\x18\x28\x45\x8a\xd2\x60\x06\x95\xcc\x50\x83\x2d\x10\xce\xb7\x3c\x2d\x10\x7e\x65\xef\xbb\x5d\xc8\x55\x25\xb3\x48\x48\xb7\xff\xf1\xfa\xe2\xea\xe6\xf6\x0a\x72\x51\x22\xb4\x6b\x5a\x29\x0b\x99\xd0\x98\x5a\xa5\x9f\x41\xe5\x60\x03\x65\x56\x23\xb2\x68\x91\x34\x4d\x14\xd5\x35\x64\x98\x0b\x89\x10\x6f\x54\x86\x65\x0c\xed\xea\x74\xfb\xb0\x86\xd3\x33\x58\x71\x83\x30\x65\x17\x4a\xe6\x62\xcd\xfe\xc9\xd3\x07\xbe\x46\x22\xaa\x6b\xb0\xb8\xd9\x96\xdc\x22\xc4\x05\xf2\x0c\x75\x0c\xd3\x8e\x7d\xbf\x25\x36\x5b\xa5\x6d\xb7\xe5\xbf\x60\x16\x4d\xea\xfa\x04\x34\x97\x6b\x84\xe9\x96\xdb\x82\x74\x4d\xd9\xad\x58\x95\x42\xae\xaf\x1d\x95\x21\x8e\xc9\x24\x76\xd6\x10\x49\xd3\xc4\x9e\x0f\x65\x46\x7b\xf3\x28\x4a\x12\xa0\x6d\x76\xc3\x37\x64\x15\x61\x48\x00\x38\x5f\x00\xa5\x15\xf6\x19\x72\xe5\x91\x1c\x10\x9a\xb4\xc0\x0d\x67\x91\x7d\xde\x1e\xee\x58\x5d\xa5\x16\xea\x68\x92\x3a\xa7\x61\xe0\x8e\x93\x9c\xa8\x8d\xb0\x96\xaf\x4d\xeb\xd6\x24\x49\xe0\xfa\xd2\xe3\x8c\xa4\x96\x45\x93\xeb\x4b\x2f\xf6\xfa\x92\xdd\x91\x8e\xa6\x81\xfb\x6e\xe1\xd6\xa9\xb8\xe3\x6b\x68\x9a\xfb\x01\x14\x5f\x97\x30\xcd\x3d\x16\x1f\x04\x96\x59\x8b\x41\xeb\x66\xde\x72\xba\x2d\x92\x58\x28\x22\x21\xa5\x3b\x5e\x56\xd8\x59\x10\x7b\xe2\xd6\xa3\x18\x72\xa2\x67\x11\x00\xc0\x64\x54\x4e\x5d\x83\xc8\x1d\x8b\x28\x4b\xbe\x2a\x89\x6d\x51\xd7\x2d\xd0\x9e\xa5\xf3\xc2\xd3\x4a\x65\x9d\x1c\x94\x46\x58\xb1\xa3\x9d\xfb\x50\x74\xeb\x1c\xc9\x28\x0d\x7a\x21\xaf\xa3\xd8\xab\x1b\xc4\xd8\xfd\x7f\x14\xb6\x80\x29\xbb\xca\xd6\xb8\x07\xc4\x7f\xed\x11\xd0\x58\x72\x2b\x94\x34\x09\xba\x1d\x0a\xbb\xb2\x05\x6a\x90\x2a\x43\xd3\x9d\x8d\xb5\xe6\xdb\x82\x79\x11\x77\x1d\x70\x06\xb8\x46\x58\xa1\x90\x6b\xd8\xaa\x6d\x45\x56\x66\xb0\x7a\x3e\xca\x9b\x7f\x55\xa8\x9f\xe1\xb1\x40\x09\xc8\xd7\xa8\x4f\x4a\xc5\x33\xe2\xa2\xe3\x85\x14\xf7\x89\xb7\x2b\x64\xf2\x2b\xf7\xff\x35\x4a\x9e\xc6\xce\xb8\xf8\x7e\xef\xe4\x49\xe7\x65\xb2\x80\xf3\x2c\x13\xe4\x03\x2f\x7d\xcc\x0c\x58\x05\x3c\xeb\x4d\x31\x56\x69\x3a\x7f\x99\x16\x3b\xd4\x0c\xdc\x21\x76\xcc\x53\xbb\xd9\x96\x94\x38\x5b\x2d\xa4\xcd\x21\xce\x04\x2f\x31\xb5\xc9\x3b\x93\x78\xb4\xbd\xc0\x98\x4e\x59\x2b\xa5\xe3\x15\x39\x14\xdc\xdc\x75\xd1\xf1\xa2\x1c\xcc\xb4\xfb\x64\x87\x1b\x6c\x34\x44\x6f\x30\xbe\x32\xa1\xc9\x47\xd9\xe0\x79\x12\xde\x4b\x69\x0f\x97\x2b\x28\xc7\x39\x70\x70\xf2\x7f\x2c\x1b\x8e\xaa\x80\x17\xb7\x2f\x05\xc1\x11\x45\x42\x99\x0d\xce\x25\xbe\xf1\x5c\x7a\xda\xae\xd0\x90\x61\xcc\x81\x3c\x22\x21\x38\x65\xc8\x3e\x49\xf1\xad\x22\x9e\xcf\x5f\xfa\x53\xb2\xf0\x6c\x74\x2a\x7b\x89\x75\xdd\xc2\x84\x47\xa7\x90\x75\xa7\x71\xe4\x88\x25\x09\x50\x1a\x63\x46\xc2\x42\x10\x85\xcc\x95\xde\x38\x1c\x1d\x80\x1a\xa9\x2e\xbb\x74\xcf\x81\x3b\x46\x87\xdc\x23\x37\xad\x04\x98\x39\xb2\x6f\x15\x1a\x8b\xd9\x9c\x60\x1e\x9e\x13\x45\x01\xa0\x73\x12\x6a\xfc\x5c\xd7\x50\xa2\x74\x46\x7e\x59\x29\x55\x76\x41\x6f\x21\x17\xcb\x01\xec\x2f\xa0\xfe\xbb\xbe\xd2\xa4\xdc\x56\x5a\x9a\x00\xef\x03\x64\xdb\x88\x68\xe0\x12\x50\x6b\xa5\xc9\x19\x57\xb7\xb3\x35\x3a\xe1\xe4\x0e\x21\xdf\xba\x74\xe8\x43\x5b\x2c\x83\xb0\x2c\x49\x5c\x4b\xbd\xaa\x6c\x2f\xc0\x5d\xd4\x3d\xe8\x2c\x9a\xe4\x95\x4c\x61\x36\x92\x6a\xf3\x97\x3d\x9a\xcd\x61\xf6\x47\xb2\x61\xe9\xbd\x9b\x53\xfa\x4e\x44\x0e\xc8\x02\xc8\x09\xf1\xa9\x20\xb8\xdd\x76\x57\x06\x42\xe9\xb4\xec\xf9\x46\x61\x3c\x3b\x03\x29\x4a\xcf\xdd\x17\x53\x82\xf0\x20\xcb\x83\xdc\x38\x04\x72\xd9\xf3\x1e\x81\xc6\xfc\x96\x0f\x26\x29\x5a\xc2\xcf\x37\xca\x7e\xa0\xbd\x2b\x72\xab\x2e\xf9\x0a\xcb\x53\x08\xfc\xde\x37\x27\xec\x23\x6d\x7a\x0f\x9a\xce\xbd\x2e\xdb\x7b\xa9\xe3\x8e\x2d\x49\x5b\xe4\xf9\x0e\xd5\x7f\x74\x7e\x78\xfd\xe4\xea\xa9\xbf\x69\x7b\x67\xe3\x26\x9a\x34\x51\xa0\x2c\xf8\xeb\x9a\x2a\x57\x40\x47\x6b\x74\x86\xd4\x03\x26\x4a\xe2\x41\x85\xae\xeb\xa3\x0a\xdc\x77\x59\x53\x8d\x29\xd2\x4d\xe0\x3b\x86\x7f\x77\x5f\xed\x76\xd0\x53\xa0\xa7\xd8\xdf\xa0\xee\xae\xa6\x6c\xec\xae\x0c\x88\xdd\xdd\x16\x1f\x23\xd2\x1f\x38\x47\xdf\x34\xf0\xad\x42\x2d\xd0\xbc\x50\xd2\xc2\x62\xd7\x6d\xf4\xa9\x3f\x30\xba\x69\x60\x11\x52\xcd\x43\x2d\xb3\x39\x84\x49\xed\x8c\xeb\xeb\xdc\x3e\x36\xb3\x9f\x43\x09\x17\xa5\x40\x69\x6b\xdf\xb8\xf9\xe4\x08\xb4\x31\xbf\xde\xcc\x59\xa8\xe7\x80\x68\xee\x43\xd8\x87\x2d\x49\xe0\xd3\x36\x23\xf0\xbb\xca\xc2\x61\x55\x89\x92\xfa\x73\xaa\x89\x15\x6d\x52\x65\x73\x2d\xf6\xd0\xe9\x24\x81\x1b\x65\x11\x6c\xc1\xed\x12\x9e\x55\x05\x12\x31\xa3\x6b\x31\xe5\x65\x39\x24\xfe\x24\x1f\x35\xdf\xce\xe6\xb0\xc2\x5c\x69\x74\x14\xbd\xd8\x0d\xda\x42\x65\x4b\x5f\xa9\x0e\xd4\x44\x6d\xc5\xf2\xe6\x61\x06\xb9\x56\x1b\xe0\x60\x35\x97\x86\xa7\x54\xbc\x97\xc0\x65\xe6\x82\x12\x2c\x3a\xa6\x54\x6d\xa8\x09\xc3\x8c\x2a\x98\x56\x65\x49\x15\x8c\xa7\x0f\x2c\x7a\x53\xbc\x3c\x32\x5d\xa8\x98\xff\xfc\x5d\x62\x10\xa8\x1f\x8a\x53\x2f\xf0\x38\x4a\x6d\x68\x1c\x6a\x50\xb9\x1f\xd3\xb5\xdf\xd4\xf5\x13\xe6\xff\x0f\x17\xe0\xb9\x45\x0d\xc2\x13\xa6\xa5\x32\x98\x2d\x49\xac\x51\x9e\x9f\xa2\x24\xf1\xc9\xf6\x29\xff\x28\xca\x12\x56\x08\xf8\x84\x69\x45\xb0\xd9\x42\xab\x6a\x5d\x38\xcd\xbe\x2b\x83\xc7\x42\xa4\x05\xa4\x1a\xb9\x27\x18\xa0\xfe\x56\x60\xbb\x6c\x18\xac\x13\x9e\xf6\x69\x09\xea\x81\x8e\xed\x38\x6a\xac\xed\x0d\x67\x0b\xfb\x74\xe9\xfe\xce\x23\x2a\xe3\x3f\xa9\x07\x77\x6e\xb6\x5c\x8a\x74\x16\x77\x23\x5e\xd3\x9c\x1e\x4d\x50\x54\x85\x07\x38\xf1\x6e\x96\x8a\xdd\xe9\x98\xbc\xaa\x19\xce\xc0\x3e\xb1\x4c\xef\xfa\xd8\x1f\x90\xb7\xa1\xbb\xb5\xda\x75\x12\x9b\x6d\x89\x1b\x94\xd6\x47\x2f\xdf\x58\xe6\x77\x50\xbf\x11\x2b\x4f\x3e\x9b\x53\xbb\x46\x12\xeb\x68\xb2\xe3\xba\x3f\xa4\x7e\xd5\xb0\xdf\xfc\x77\x34\x69\x37\xd8\x7f\xb4\xb0\xd8\x32\xc7\xa1\xc8\x19\xb9\x39\x46\xe5\x8c\xf3\xc5\x7b\x16\x8b\xec\xec\xdd\x2e\x5e\x1e\x85\xe1\xfa\x72\x3e\x1f\x34\x8c\x62\x7c\xa6\xeb\xae\xdc\xe1\x10\x45\xf7\xd3\xa8\x81\x4b\x18\x0c\x75\x67\x7f\x35\x1d\xd7\xdf\xc8\x5c\x7f\xc5\xf9\x51\xab\xbb\xf1\xa6\x26\x0f\x27\x82\x77\x86\xbd\xa3\xfe\xbf\x37\xf6\x68\x0e\x0c\x3b\x81\xc1\x2c\xd8\xf5\x02\xbb\x2e\xef\x4c\x0e\x4d\xf3\x17\xd8\xc1\x4f\x83\x36\xe0\x4d\x96\x3b\x73\xf7\x9a\xa8\x34\x4d\x73\x76\x6d\xee\xc4\x06\x61\xd6\x0e\x96\xff\xe0\xe6\xef\x8a\x2a\xff\xbc\x53\x3f\x2e\x7d\xc7\x3e\xb8\x16\x75\x66\xc5\x06\xd9\xf9\xcd\xed\xf5\xc5\x3c\x90\xef\x10\x09\x95\xb4\x59\xf7\xbd\x6a\x16\xbb\x43\xa1\xaf\x92\x0f\x12\xc5\x65\xc9\x62\x37\x30\xab\xef\x45\x82\xfe\x24\x90\xfa\x3d\x38\x7e\x2f\x8c\x63\xb2\xfb\x90\xbe\x88\xe6\x1f\x04\xf3\x55\x65\x07\x92\x5f\xe3\x39\x06\x74\x2f\x25\x10\x23\xc3\x2c\xee\xbf\x0e\x67\xd5\xee\xff\x40\xd1\x6f\xcf\x16\x67\xbf\xcc\x7f\x99\xf7\x65\xab\xdb\xee\xea\x4b\xd4\x36\x5d\xa6\x14\xa9\xeb\xa7\xb6\x65\xa5\x79\x39\xbc\x89\xf7\x04\xbe\x96\x72\xd8\x72\x6d\xdc\x31\xf2\xcb\x2a\x3f\x68\x12\xfa\xd9\xb3\x67\xfb\xfc\x65\x50\xe1\x9c\x56\x37\xd7\xe1\x93\x25\xdb\xa7\x10\xdf\x12\x6d\xbc\xe7\xf1\x35\xf9\x95\x37\x80\xb6\xbf\xdc\x70\xf9\x7c\xfc\x04\x30\x3e\xe3\x07\x4d\xd0\x78\x1d\x0e\x8d\x9e\x83\xbf\x04\x66\x69\xbe\x6e\xff\xba\xc9\x83\x5a\xa4\xaf\x82\x8c\xf2\xd5\xf0\x48\x46\x3b\x00\x07\x6b\x9f\xbf\x8a\x2f\xed\x95\x02\x67\x90\xe6\x6b\xba\x73\x06\xe6\xd4\x75\xb2\x80\xf3\xfd\x0b\x82\x1b\xee\xa9\x8f\xa1\x6c\xf4\x43\xfb\x89\xe5\x6b\xd3\xbe\x36\x1c\x3e\x72\x06\x0f\x4f\xee\xd9\xa9\x7d\x5a\xb8\xe3\x6b\x3f\x8e\xfa\x49\x39\xa8\xde\xb6\x9b\x3d\xdb\x39\x8c\x96\xe1\x7d\x0b\xc1\xfe\x8d\xcc\xd2\x6d\x1a\x9f\xc4\xfd\xe2\x7d\xb8\xfd\x92\xf1\xae\xd1\x48\xb9\xa4\xb6\x42\xed\x50\x6b\xd1\xce\x4a\x4a\xbb\x37\x60\xff\x86\xc2\xc7\x1e\x57\x5c\xbb\xc3\xd3\xc2\x4d\xe1\x6c\xdc\xd7\x91\x67\x15\x32\x07\x65\xd6\x34\xd1\xff\x02\x00\x00\xff\xff\x44\xff\xc1\x0e\xc3\x16\x00\x00") +var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x58\x5f\x6f\xe3\xb8\x11\x7f\xb6\x3e\xc5\x9c\xe0\xbd\xb3\x0d\x87\xda\xde\x5b\xd3\xa6\x40\x2e\xc9\xb6\x01\x16\xb9\xb6\xc9\xa2\x0f\x8b\xc5\x86\x96\x46\x16\x1b\x99\xf4\x92\x94\x93\x40\xd0\x77\x2f\x86\x94\x64\xca\x56\xd2\xec\xed\x53\x62\x72\xfe\xfe\xe6\x0f\x67\x54\xd7\xc9\x22\xba\x50\xdb\x67\x2d\xd6\x85\x85\x5f\xdf\xff\xe9\xcf\x27\x5b\x8d\x06\xa5\x85\x0f\x3c\xc5\x95\x52\x0f\x70\x2d\x53\x06\xe7\x65\x09\x8e\xc8\x00\xdd\xeb\x1d\x66\x2c\xba\x2b\x84\x01\xa3\x2a\x9d\x22\xa4\x2a\x43\x10\x06\x4a\x91\xa2\x34\x98\x41\x25\x33\xd4\x60\x0b\x84\xf3\x2d\x4f\x0b\x84\x5f\xd9\xfb\xee\x16\x72\x55\xc9\x2c\x12\xd2\xdd\x7f\xbc\xbe\xb8\xba\xb9\xbd\x82\x5c\x94\x08\xed\x99\x56\xca\x42\x26\x34\xa6\x56\xe9\x67\x50\x39\xd8\x40\x99\xd5\x88\x2c\x5a\x24\x4d\x13\x45\x75\x0d\x19\xe6\x42\x22\xc4\x1b\x95\x61\x19\x43\x7b\x3a\xdd\x3e\xac\xe1\xf4\x0c\x56\xdc\x20\x4c\xd9\x85\x92\xb9\x58\xb3\x7f\xf2\xf4\x81\xaf\x91\x88\xea\x1a\x2c\x6e\xb6\x25\xb7\x08\x71\x81\x3c\x43\x1d\xc3\xb4\x63\xdf\x5f\x89\xcd\x56\x69\xdb\x5d\xf9\x5f\x30\x8b\x26\x75\x7d\x02\x9a\xcb\x35\xc2\x74\xcb\x6d\x41\xba\xa6\xec\x56\xac\x4a\x21\xd7\xd7\x8e\xca\x10\xc7\x64\x12\x3b\x6b\x88\xa4\x69\x62\xcf\x87\x32\xa3\xbb\x79\x14\x25\x09\xd0\x35\xbb\xe1\x1b\xb2\x8a\x30\x24\x00\x9c\x2f\x80\xd2\x0a\xfb\x0c\xb9\xf2\x48\x0e\x08\x4d\x5a\xe0\x86\xb3\xc8\x3e\x6f\x0f\x6f\xac\xae\x52\x0b\x75\x34\x49\x9d\xd3\x30\x70\xc7\x49\x4e\xd4\x46\x58\xcb\xd7\xa6\x75\x6b\x92\x24\x70\x7d\xe9\x71\x46\x52\xcb\xa2\xc9\xf5\xa5\x17\x7b\x7d\xc9\xee\x48\x47\xd3\xc0\x7d\x77\x70\xeb\x54\xdc\xf1\x35\x34\xcd\xfd\x00\x8a\xaf\x4b\x98\xe6\x1e\x8b\x0f\x02\xcb\xac\xc5\xa0\x75\x33\x6f\x39\xdd\x15\x49\x2c\x14\x91\x90\xd2\x1d\x2f\x2b\xec\x2c\x88\x3d\x71\xeb\x51\x0c\x39\xd1\xb3\x08\x00\x60\x32\x2a\xa7\xae\x41\xe4\x8e\x45\x94\x25\x5f\x95\xc4\xb6\xa8\xeb\x16\x68\xcf\xd2\x79\xe1\x69\xa5\xb2\x4e\x0e\x4a\x23\xac\xd8\xd1\xcd\x7d\x28\xba\x75\x8e\x64\x94\x06\xbd\x90\xd7\x51\xec\xd5\x0d\x62\xec\xfe\x7f\x14\xb6\x80\x29\xbb\xca\xd6\xb8\x07\xc4\xff\xda\x23\xa0\xb1\xe4\x56\x28\x69\x12\x74\x37\x14\x76\x65\x0b\xd4\x20\x55\x86\xa6\xab\x8d\xb5\xe6\xdb\x82\x79\x11\x77\x1d\x70\x06\xb8\x46\x58\xa1\x90\x6b\xd8\xaa\x6d\x45\x56\x66\xb0\x7a\x3e\xca\x9b\x7f\x55\xa8\x9f\xe1\xb1\x40\x09\xc8\xd7\xa8\x4f\x4a\xc5\x33\xe2\xa2\xf2\x42\x8a\xfb\xc4\xdb\x15\x32\xf9\x93\xfb\xff\x1a\x25\x4f\x63\x67\x5c\x7c\xbf\x77\xf2\xa4\xf3\x32\x59\xc0\x79\x96\x09\xf2\x81\x97\x3e\x66\x06\xac\x02\x9e\xf5\xa6\x18\xab\x34\xd5\x5f\xa6\xc5\x0e\x35\x03\x57\xc4\x8e\x79\x6a\x37\xdb\x92\x12\x67\xab\x85\xb4\x39\xc4\x99\xe0\x25\xa6\x36\x79\x67\x12\x8f\xb6\x17\x18\x53\x95\xb5\x52\x3a\x5e\x91\x43\xc1\xcd\x5d\x17\x1d\x2f\xca\xc1\x4c\xb7\x4f\x76\x78\xc1\x46\x43\xf4\x06\xe3\x2b\x13\x9a\x7c\x94\x0d\x9e\x27\xe1\xbd\x94\xb6\xb8\x5c\x43\x39\xce\x81\x83\xca\xff\xb1\x6c\x38\xea\x02\x5e\xdc\xbe\x15\x04\x25\x8a\x84\x32\x1b\xd4\x25\xbe\xb1\x2e\x3d\x6d\xd7\x68\xc8\x30\xe6\x40\x1e\x91\x10\x54\x19\xb2\x4f\x52\x7c\xab\x88\xe7\xf3\x97\xbe\x4a\x16\x9e\x8d\xaa\xb2\x97\x58\xd7\x2d\x4c\x78\x54\x85\xac\xab\xc6\x91\x12\x4b\x12\xa0\x34\xc6\x8c\x84\x85\x20\x0a\x99\x2b\xbd\x71\x38\x3a\x00\x35\x52\x5f\x76\xe9\x9e\x03\x77\x8c\x0e\xb9\x47\x6e\x5a\x09\x30\x73\x64\xdf\x2a\x34\x16\xb3\x39\xc1\x3c\xac\x13\x45\x01\xa0\x3a\x09\x35\x7e\xae\x6b\x28\x51\x3a\x23\xbf\xac\x94\x2a\xbb\xa0\xb7\x90\x8b\xe5\x00\xf6\x17\x50\xff\x5d\x5f\x69\x52\x6e\x2b\x2d\x4d\x80\xf7\x01\xb2\x6d\x44\x34\x70\x09\xa8\xb5\xd2\xe4\x8c\xeb\xdb\xd9\x1a\x9d\x70\x72\x87\x90\x6f\x5d\x3a\xf4\xa1\x6d\x96\x41\x58\x96\x24\xae\xa5\x5e\x55\xb6\x17\xe0\x1e\xea\x1e\x74\x16\x4d\xf2\x4a\xa6\x30\x1b\x49\xb5\xf9\xcb\x1e\xcd\xe6\x30\xfb\x23\xd9\xb0\xf4\xde\xcd\x29\x7d\x27\x22\x07\x64\x01\xe4\x84\xf8\x54\x10\xdc\xee\xba\x6b\x03\xa1\x74\x3a\xf6\x7c\xa3\x30\x9e\x9d\x81\x14\xa5\xe7\xee\x9b\x29\x41\x78\x90\xe5\x41\x6e\x1c\x02\xb9\xec\x79\x8f\x40\x63\xfe\xca\x07\x93\x14\x2d\xe1\xe7\x1b\x65\x3f\xd0\xdd\x15\xb9\x55\x97\x7c\x85\xe5\x29\x04\x7e\xef\x87\x13\xf6\x91\x2e\xbd\x07\x4d\xe7\x5e\x97\xed\xbd\xd4\x71\xc7\x96\xa4\x2d\xf2\x7c\x87\xea\x3f\x3a\x3f\xbc\x7e\x72\xf5\xd4\xbf\xb4\xbd\xb3\x71\x13\x4d\x9a\x28\x50\x16\xfc\xeb\x86\x2a\xd7\x40\x47\x7b\x74\x86\x34\x03\x26\x4a\xe2\x41\x87\xae\xeb\xa3\x0e\xdc\x4f\x59\x53\x8d\x29\xd2\x4b\xe0\x27\x86\x7f\x77\xbf\xda\xeb\xb0\x61\x85\xaf\xa7\x7b\xa7\x29\x13\xbb\xe7\x02\x62\xf7\xae\xc5\xc7\x68\xf4\xc5\xe6\xe8\x9b\x06\xbe\x55\xa8\x05\x9a\x17\xda\x59\xd8\xe8\xba\x8b\x3e\xed\x07\x06\x37\x0d\x2c\x42\xaa\x79\xa8\x65\x36\x87\x30\xa1\x9d\x71\x7d\x8f\xdb\xc7\x65\xf6\x73\x28\xe1\xa2\x14\x28\x6d\xed\x87\x36\x9f\x18\x81\x36\xe6\xcf\x9b\x39\x0b\xf5\x1c\x10\xcd\x7d\xf8\xfa\x90\x25\x09\x7c\xda\x66\x04\x7c\xd7\x55\x38\xac\x2a\x51\xd2\x6c\x4e\xfd\xb0\xa2\x4b\xea\x6a\x6e\xbc\x1e\x3a\x9d\x24\x70\xa3\x2c\x82\x2d\xb8\x5d\xc2\xb3\xaa\x40\x22\x66\xf4\x24\xa6\xbc\x2c\x87\xc4\x9f\xe4\xa3\xe6\xdb\xd9\x1c\x56\x98\x2b\x8d\x8e\xa2\x17\xbb\x41\x5b\xa8\x6c\xe9\xbb\xd4\x81\x9a\xa8\xed\x56\xde\x3c\xcc\x20\xd7\x6a\x03\x1c\xac\xe6\xd2\xf0\x94\x1a\xf7\x12\xb8\xcc\x5c\x50\x82\x43\xc7\x94\xaa\x0d\x0d\x60\x98\x51\xf7\xd2\xaa\x2c\xa9\x7b\xf1\xf4\x81\x45\x6f\x8a\x97\x47\xa6\x0b\x15\xf3\x3f\x7f\x97\x18\x04\xea\x87\xe2\xd4\x0b\x3c\x8e\x52\x1b\x1a\x87\x1a\x54\xee\x8f\xe9\x46\x6f\x9a\xf8\x09\xf3\xff\x87\x0b\xf0\xdc\xa2\x06\xe1\x09\xd3\x52\x19\xcc\x96\x24\xd6\x28\xcf\x4f\x51\x92\xf8\x64\xfb\x94\x7f\x14\x65\x09\x2b\x04\x7c\xc2\xb4\x22\xd8\x6c\xa1\x55\xb5\x2e\x9c\x66\x3f\x91\xc1\x63\x21\xd2\x02\x52\x8d\xdc\x13\x0c\x50\x7f\x2b\xb0\x5d\x36\x0c\xce\x09\x4f\xfb\xb4\x04\xf5\x40\x65\x3b\x8e\x1a\x6b\xe7\xc2\xd9\xc2\x3e\x5d\xba\x7f\xe7\x11\xb5\xf0\x9f\xd4\x83\xab\x9b\x2d\x97\x22\x9d\xc5\xdd\x7a\xd7\x34\xa7\x47\xdb\x13\x75\xe0\x01\x4e\xbc\xdb\xa3\x62\x57\x1d\x93\x57\x35\xc3\x19\xd8\x27\x96\xe9\x5d\x1f\xfb\x03\xf2\x36\x74\xb7\x56\xbb\x29\x62\xb3\x2d\x71\x83\xd2\xfa\xe8\xe5\x1b\xcb\xfc\x0d\xea\x37\x62\xe5\xc9\x67\x73\x1a\xd5\x48\x62\x1d\x4d\x76\x5c\xf7\x45\xea\x4f\x0d\xfb\xcd\xff\x8e\x26\xed\x05\xfb\x8f\x16\x16\x5b\xe6\x38\x14\x39\x23\x37\xc7\xa8\x9c\x71\xbe\x71\xcf\x62\x91\x9d\xbd\xdb\xc5\xcb\xa3\x30\x5c\x5f\xce\xe7\x83\x61\x51\x8c\xef\x73\xdd\x73\x3b\x5c\xa0\xe8\x6d\x1a\x35\x70\x09\x83\x85\xee\xec\xaf\xa6\xe3\xfa\x1b\x99\xeb\x9f\x37\xbf\x66\x75\xaf\xdd\xd4\xe4\xe1\x36\xf0\xce\xb0\x77\x34\xfb\xf7\xc6\x1e\xed\x80\xe1\x14\x30\xd8\x03\xbb\x39\x60\xd7\xe5\x9d\xc9\xa1\x69\xfe\x02\x3b\xf8\x69\x30\x02\xbc\xc9\x72\x67\xee\x5e\x13\xb5\xa6\x69\xce\xae\xcd\x9d\xd8\x20\xcc\xda\xa5\xf2\x1f\xdc\xfc\x5d\x51\xe7\x9f\x77\xea\xc7\xa5\xef\xd8\x07\x37\x9e\xce\xac\xd8\x20\x3b\xbf\xb9\xbd\xbe\x98\x07\xf2\x1d\x22\xa1\x92\x36\xeb\xbe\x57\xcd\x62\x77\x28\xf4\x55\xf2\x41\xa2\xb8\x2c\x59\xec\x06\x66\xf5\x73\x48\x30\x9b\x04\x52\xbf\x07\xc7\xef\x85\x71\x4c\x76\x1f\xd2\x17\xd1\xfc\x83\x60\xbe\xaa\xec\x40\xf2\x6b\x3c\xc7\x80\xee\xa5\x04\x62\x64\x98\xc5\xfd\xaf\xc3\x3d\xb5\xfb\x7f\xa0\xe8\xb7\x67\x8b\xb3\x5f\xe6\xbf\xcc\xfb\xb6\xd5\x5d\x77\xfd\x25\x6a\x07\x2e\x53\x8a\xd4\xcd\x53\xdb\xb2\xd2\xbc\x1c\xbe\xc4\x7b\x02\xdf\x4b\x39\x6c\xb9\x36\xae\x8c\xfc\xb1\xca\x0f\x86\x84\x7e\xef\xec\xd9\x3e\x7f\x19\x74\x38\xa7\xd5\xed\x74\xf8\x64\xc9\xf6\x29\xc4\xb7\x44\x1b\xef\x79\x7c\x4f\x7e\x65\xff\x6f\x67\xcb\x0d\x97\xcf\xc7\xeb\xff\xf8\x7e\x1f\x0c\x41\xe3\x7d\x38\x34\x7a\x0e\xfe\x11\x98\xa5\xf9\xba\xfd\xd7\x6d\x1d\x34\x22\x7d\x15\x64\x94\xef\x86\x47\x32\xda\xe5\x37\x38\xfb\xfc\x55\x7c\x69\x9f\x14\x38\x83\x34\x5f\xd3\x9b\x33\x30\xa7\xae\x93\x05\x9c\xef\xbf\x1e\xb8\xc5\x9e\xe6\x18\xca\x46\xbf\xb0\x9f\x58\xbe\x36\xed\x97\x86\xc3\x0f\x9c\xc1\x47\x27\xf7\xc9\xa9\xfd\xac\x70\xc7\xd7\x7e\x15\xf5\x5b\x72\xd0\xbd\x6d\xb7\x77\xb6\x3b\x18\x1d\xc3\xfb\x16\x82\xfd\xf7\x31\x4b\xaf\x69\x7c\x12\xf7\x87\xf7\xe1\xf5\x4b\xc6\xbb\x41\x23\xe5\x92\xc6\x0a\xb5\x43\xad\x45\xbb\x27\x29\xed\xbe\xff\xfa\xef\x27\x7c\xec\xc3\x8a\x1b\x77\x78\x5a\xb8\x0d\x9c\x8d\xfb\x3a\xf2\x49\x85\xcc\x41\x99\x35\x4d\xf4\xbf\x00\x00\x00\xff\xff\x69\x25\x94\x20\xbf\x16\x00\x00") func templateEntTmplBytes() ([]byte, error) { return bindataRead( @@ -881,7 +881,7 @@ func templateEntTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/ent.tmpl", size: 5827, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/ent.tmpl", size: 5823, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/builder/query.tmpl b/entc/gen/template/builder/query.tmpl index ab5f1d36c..6425ac6c9 100644 --- a/entc/gen/template/builder/query.tmpl +++ b/entc/gen/template/builder/query.tmpl @@ -91,23 +91,23 @@ func ({{ $receiver }} *{{ $builder }}) Order(o ...OrderFunc) *{{ $builder }} { // First returns the first {{ $.Name }} entity in the query. Returns *NotFoundError when no {{ lower $.Name }} was found. func ({{ $receiver }} *{{ $builder }}) First(ctx context.Context) (*{{ $.Name }}, error) { - {{ plural $.Receiver }}, err := {{ $receiver }}.Limit(1).All(ctx) + nodes, err := {{ $receiver }}.Limit(1).All(ctx) if err != nil { return nil, err } - if len({{ plural $.Receiver }}) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{ {{ $.Package }}.Label} } - return {{ plural $.Receiver }}[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func ({{ $receiver }} *{{ $builder }}) FirstX(ctx context.Context) *{{ $.Name }} { - {{ $.Receiver }}, err := {{ $receiver }}.First(ctx) + node, err := {{ $receiver }}.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return {{ $.Receiver }} + return node } // FirstID returns the first {{ $.Name }} id in the query. Returns *NotFoundError when no id was found. @@ -134,13 +134,13 @@ func ({{ $receiver }} *{{ $builder }}) FirstXID(ctx context.Context) {{ $.ID.Typ // Only returns the only {{ $.Name }} entity in the query, returns an error if not exactly one entity was returned. func ({{ $receiver }} *{{ $builder }}) Only(ctx context.Context) (*{{ $.Name }}, error) { - {{ plural $.Receiver }}, err := {{ $receiver }}.Limit(2).All(ctx) + nodes, err := {{ $receiver }}.Limit(2).All(ctx) if err != nil { return nil, err } - switch len({{ plural $.Receiver }}) { + switch len(nodes) { case 1: - return {{ plural $.Receiver }}[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{ {{ $.Package }}.Label} default: @@ -150,11 +150,11 @@ func ({{ $receiver }} *{{ $builder }}) Only(ctx context.Context) (*{{ $.Name }}, // OnlyX is like Only, but panics if an error occurs. func ({{ $receiver }} *{{ $builder }}) OnlyX(ctx context.Context) *{{ $.Name }} { - {{ $.Receiver }}, err := {{ $receiver }}.Only(ctx) + node, err := {{ $receiver }}.Only(ctx) if err != nil { panic(err) } - return {{ $.Receiver }} + return node } // OnlyID returns the only {{ $.Name }} id in the query, returns an error if not exactly one id was returned. @@ -193,11 +193,11 @@ func ({{ $receiver }} *{{ $builder }}) All(ctx context.Context) ([]*{{ $.Name }} // AllX is like All, but panics if an error occurs. func ({{ $receiver }} *{{ $builder }}) AllX(ctx context.Context) []*{{ $.Name }} { - {{ plural $.Receiver }}, err := {{ $receiver }}.All(ctx) + nodes, err := {{ $receiver }}.All(ctx) if err != nil { panic(err) } - return {{ plural $.Receiver }} + return nodes } // IDs executes the query and returns a list of {{ $.Name }} ids. diff --git a/entc/gen/template/builder/update.tmpl b/entc/gen/template/builder/update.tmpl index fc0f9a577..5af9dd1e6 100644 --- a/entc/gen/template/builder/update.tmpl +++ b/entc/gen/template/builder/update.tmpl @@ -179,11 +179,11 @@ func ({{ $receiver }} *{{ $onebuilder }} ) Save(ctx context.Context) (*{{ $.Name // SaveX is like Save, but panics if an error occurs. func ({{ $receiver }} *{{ $onebuilder }}) SaveX(ctx context.Context) *{{ $.Name }} { - {{ $.Receiver }}, err := {{ $receiver }}.Save(ctx) + node, err := {{ $receiver }}.Save(ctx) if err != nil { panic(err) } - return {{ $.Receiver }} + return node } // Exec executes the query on the entity. diff --git a/entc/gen/template/dialect/sql/create.tmpl b/entc/gen/template/dialect/sql/create.tmpl index 7ea985a63..5b3cce45c 100644 --- a/entc/gen/template/dialect/sql/create.tmpl +++ b/entc/gen/template/dialect/sql/create.tmpl @@ -10,7 +10,7 @@ in the LICENSE file in the root directory of this source tree. {{ $mutation := print $receiver ".mutation" }} func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) (*{{ $.Name }}, error) { - {{ $.Receiver }}, _spec := {{ $receiver }}.createSpec() + _node, _spec := {{ $receiver }}.createSpec() if err := sqlgraph.CreateNode(ctx, {{ $receiver }}.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -21,20 +21,20 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) (*{{ $.Name {{- /* Do nothing, because these 2 types must be supplied by the user. */ -}} {{- else }} {{- if $.ID.UserDefined }} - if {{ $.Receiver }}.ID == 0 { + if _node.ID == 0 { {{- end }} id := _spec.ID.Value.(int64) - {{ $.Receiver }}.ID = {{ $.ID.Type }}(id) + _node.ID = {{ $.ID.Type }}(id) {{- if $.ID.UserDefined }} } {{- end }} {{- end }} - return {{ $.Receiver }}, nil + return _node, nil } func ({{ $receiver }} *{{ $builder }}) createSpec() (*{{ $.Name }}, *sqlgraph.CreateSpec) { var ( - {{ $.Receiver }} = &{{ $.Name }}{config: {{ $receiver }}.config} + _node = &{{ $.Name }}{config: {{ $receiver }}.config} _spec = &sqlgraph.CreateSpec{ Table: {{ $.Package }}.Table, ID: &sqlgraph.FieldSpec{ @@ -45,7 +45,7 @@ func ({{ $receiver }} *{{ $builder }}) createSpec() (*{{ $.Name }}, *sqlgraph.Cr ) {{- if $.ID.UserDefined }} if id, ok := {{ $mutation }}.{{ $.ID.MutationGet }}(); ok { - {{ $.Receiver }}.ID = id + _node.ID = id _spec.ID.Value = id } {{- end }} @@ -56,7 +56,7 @@ func ({{ $receiver }} *{{ $builder }}) createSpec() (*{{ $.Name }}, *sqlgraph.Cr Value: value, Column: {{ $.Package }}.{{ $f.Constant }}, }) - {{ $.Receiver }}.{{ $f.StructField }} = {{ if $f.Nillable }}&{{ end }}value + _node.{{ $f.StructField }} = {{ if $f.Nillable }}&{{ end }}value } {{- end }} {{- range $e := $.Edges }} @@ -67,7 +67,7 @@ func ({{ $receiver }} *{{ $builder }}) createSpec() (*{{ $.Name }}, *sqlgraph.Cr _spec.Edges = append(_spec.Edges, edge) } {{- end }} - return {{ $.Receiver }}, _spec + return _node, _spec } {{ end }} diff --git a/entc/gen/template/dialect/sql/update.tmpl b/entc/gen/template/dialect/sql/update.tmpl index 60243a6ee..3f3099272 100644 --- a/entc/gen/template/dialect/sql/update.tmpl +++ b/entc/gen/template/dialect/sql/update.tmpl @@ -11,7 +11,7 @@ in the LICENSE file in the root directory of this source tree. {{ $mutation := print $receiver ".mutation" }} {{ $one := hasSuffix $builder "One" }} {{- $zero := 0 }}{{ if $one }}{{ $zero = "nil" }}{{ end }} -{{- $ret := "n" }}{{ if $one }}{{ $ret = $.Receiver }}{{ end }} +{{- $ret := "n" }}{{ if $one }}{{ $ret = "_node" }}{{ end }} func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) ({{ $ret }} {{ if $one }}*{{ $.Name }}{{ else }}int{{ end }}, err error) { _spec := &sqlgraph.UpdateSpec{ diff --git a/entc/gen/template/ent.tmpl b/entc/gen/template/ent.tmpl index 82d7cdbdc..16e8e9be3 100644 --- a/entc/gen/template/ent.tmpl +++ b/entc/gen/template/ent.tmpl @@ -76,7 +76,7 @@ type {{ $.Name }}Edges struct { {{ $receiver := $.Receiver }} -{{ range $_, $e := $.Edges }} +{{ range $e := $.Edges }} {{ $func := print "Query" $e.StructField }} // {{ $func }} queries the {{ $e.Name }} edge of the {{ $.Name }}. func ({{ $receiver }} *{{ $.Name }}) {{ $func }}() *{{ $e.Type.QueryName }} { diff --git a/entc/integration/config/ent/user_create.go b/entc/integration/config/ent/user_create.go index aea2c7670..5bfa2919b 100644 --- a/entc/integration/config/ent/user_create.go +++ b/entc/integration/config/ent/user_create.go @@ -77,7 +77,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -85,13 +85,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -100,7 +100,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { }, } ) - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/config/ent/user_query.go b/entc/integration/config/ent/user_query.go index 7a94c4aba..b789c0078 100644 --- a/entc/integration/config/ent/user_query.go +++ b/entc/integration/config/ent/user_query.go @@ -58,23 +58,23 @@ func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -117,11 +117,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/config/ent/user_update.go b/entc/integration/config/ent/user_update.go index 83054cf9a..6d4d31972 100644 --- a/entc/integration/config/ent/user_update.go +++ b/entc/integration/config/ent/user_update.go @@ -159,11 +159,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -179,7 +179,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -195,9 +195,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -206,5 +206,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/customid/ent/blob_create.go b/entc/integration/customid/ent/blob_create.go index 4eaa7b15b..fb5692d88 100644 --- a/entc/integration/customid/ent/blob_create.go +++ b/entc/integration/customid/ent/blob_create.go @@ -141,19 +141,19 @@ func (bc *BlobCreate) check() error { } func (bc *BlobCreate) sqlSave(ctx context.Context) (*Blob, error) { - b, _spec := bc.createSpec() + _node, _spec := bc.createSpec() if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - return b, nil + return _node, nil } func (bc *BlobCreate) createSpec() (*Blob, *sqlgraph.CreateSpec) { var ( - b = &Blob{config: bc.config} + _node = &Blob{config: bc.config} _spec = &sqlgraph.CreateSpec{ Table: blob.Table, ID: &sqlgraph.FieldSpec{ @@ -163,7 +163,7 @@ func (bc *BlobCreate) createSpec() (*Blob, *sqlgraph.CreateSpec) { } ) if id, ok := bc.mutation.ID(); ok { - b.ID = id + _node.ID = id _spec.ID.Value = id } if value, ok := bc.mutation.UUID(); ok { @@ -172,7 +172,7 @@ func (bc *BlobCreate) createSpec() (*Blob, *sqlgraph.CreateSpec) { Value: value, Column: blob.FieldUUID, }) - b.UUID = value + _node.UUID = value } if nodes := bc.mutation.ParentIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -212,7 +212,7 @@ func (bc *BlobCreate) createSpec() (*Blob, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return b, _spec + return _node, _spec } // BlobCreateBulk is the builder for creating a bulk of Blob entities. diff --git a/entc/integration/customid/ent/blob_query.go b/entc/integration/customid/ent/blob_query.go index 10a4f1338..732851be7 100644 --- a/entc/integration/customid/ent/blob_query.go +++ b/entc/integration/customid/ent/blob_query.go @@ -108,23 +108,23 @@ func (bq *BlobQuery) QueryLinks() *BlobQuery { // First returns the first Blob entity in the query. Returns *NotFoundError when no blob was found. func (bq *BlobQuery) First(ctx context.Context) (*Blob, error) { - bs, err := bq.Limit(1).All(ctx) + nodes, err := bq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(bs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{blob.Label} } - return bs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (bq *BlobQuery) FirstX(ctx context.Context) *Blob { - b, err := bq.First(ctx) + node, err := bq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return b + return node } // FirstID returns the first Blob id in the query. Returns *NotFoundError when no id was found. @@ -151,13 +151,13 @@ func (bq *BlobQuery) FirstXID(ctx context.Context) uuid.UUID { // Only returns the only Blob entity in the query, returns an error if not exactly one entity was returned. func (bq *BlobQuery) Only(ctx context.Context) (*Blob, error) { - bs, err := bq.Limit(2).All(ctx) + nodes, err := bq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(bs) { + switch len(nodes) { case 1: - return bs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{blob.Label} default: @@ -167,11 +167,11 @@ func (bq *BlobQuery) Only(ctx context.Context) (*Blob, error) { // OnlyX is like Only, but panics if an error occurs. func (bq *BlobQuery) OnlyX(ctx context.Context) *Blob { - b, err := bq.Only(ctx) + node, err := bq.Only(ctx) if err != nil { panic(err) } - return b + return node } // OnlyID returns the only Blob id in the query, returns an error if not exactly one id was returned. @@ -210,11 +210,11 @@ func (bq *BlobQuery) All(ctx context.Context) ([]*Blob, error) { // AllX is like All, but panics if an error occurs. func (bq *BlobQuery) AllX(ctx context.Context) []*Blob { - bs, err := bq.All(ctx) + nodes, err := bq.All(ctx) if err != nil { panic(err) } - return bs + return nodes } // IDs executes the query and returns a list of Blob ids. diff --git a/entc/integration/customid/ent/blob_update.go b/entc/integration/customid/ent/blob_update.go index a8364e550..d8561b070 100644 --- a/entc/integration/customid/ent/blob_update.go +++ b/entc/integration/customid/ent/blob_update.go @@ -390,11 +390,11 @@ func (buo *BlobUpdateOne) Save(ctx context.Context) (*Blob, error) { // SaveX is like Save, but panics if an error occurs. func (buo *BlobUpdateOne) SaveX(ctx context.Context) *Blob { - b, err := buo.Save(ctx) + node, err := buo.Save(ctx) if err != nil { panic(err) } - return b + return node } // Exec executes the query on the entity. @@ -410,7 +410,7 @@ func (buo *BlobUpdateOne) ExecX(ctx context.Context) { } } -func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (b *Blob, err error) { +func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (_node *Blob, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: blob.Table, @@ -522,9 +522,9 @@ func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (b *Blob, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - b = &Blob{config: buo.config} - _spec.Assign = b.assignValues - _spec.ScanValues = b.scanValues() + _node = &Blob{config: buo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, buo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{blob.Label} @@ -533,5 +533,5 @@ func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (b *Blob, err error) { } return nil, err } - return b, nil + return _node, nil } diff --git a/entc/integration/customid/ent/car_create.go b/entc/integration/customid/ent/car_create.go index cc60eda93..c6268a858 100644 --- a/entc/integration/customid/ent/car_create.go +++ b/entc/integration/customid/ent/car_create.go @@ -156,23 +156,23 @@ func (cc *CarCreate) check() error { } func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - if c.ID == 0 { + if _node.ID == 0 { id := _spec.ID.Value.(int64) - c.ID = int(id) + _node.ID = int(id) } - return c, nil + return _node, nil } func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { var ( - c = &Car{config: cc.config} + _node = &Car{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: car.Table, ID: &sqlgraph.FieldSpec{ @@ -182,7 +182,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { } ) if id, ok := cc.mutation.ID(); ok { - c.ID = id + _node.ID = id _spec.ID.Value = id } if value, ok := cc.mutation.BeforeID(); ok { @@ -191,7 +191,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { Value: value, Column: car.FieldBeforeID, }) - c.BeforeID = value + _node.BeforeID = value } if value, ok := cc.mutation.AfterID(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -199,7 +199,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { Value: value, Column: car.FieldAfterID, }) - c.AfterID = value + _node.AfterID = value } if value, ok := cc.mutation.Model(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -207,7 +207,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { Value: value, Column: car.FieldModel, }) - c.Model = value + _node.Model = value } if nodes := cc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -228,7 +228,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CarCreateBulk is the builder for creating a bulk of Car entities. diff --git a/entc/integration/customid/ent/car_query.go b/entc/integration/customid/ent/car_query.go index 3c01cabd2..767a4999f 100644 --- a/entc/integration/customid/ent/car_query.go +++ b/entc/integration/customid/ent/car_query.go @@ -84,23 +84,23 @@ func (cq *CarQuery) QueryOwner() *PetQuery { // First returns the first Car entity in the query. Returns *NotFoundError when no car was found. func (cq *CarQuery) First(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{car.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CarQuery) FirstX(ctx context.Context) *Car { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Car id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CarQuery) FirstXID(ctx context.Context) int { // Only returns the only Car entity in the query, returns an error if not exactly one entity was returned. func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{car.Label} default: @@ -143,11 +143,11 @@ func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CarQuery) OnlyX(ctx context.Context) *Car { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Car id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CarQuery) All(ctx context.Context) ([]*Car, error) { // AllX is like All, but panics if an error occurs. func (cq *CarQuery) AllX(ctx context.Context) []*Car { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Car ids. diff --git a/entc/integration/customid/ent/car_update.go b/entc/integration/customid/ent/car_update.go index 04aba5ed1..1f0a6a240 100644 --- a/entc/integration/customid/ent/car_update.go +++ b/entc/integration/customid/ent/car_update.go @@ -439,11 +439,11 @@ func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CarUpdateOne) SaveX(ctx context.Context) *Car { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -474,7 +474,7 @@ func (cuo *CarUpdateOne) check() error { return nil } -func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { +func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: car.Table, @@ -572,9 +572,9 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Car{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Car{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{car.Label} @@ -583,5 +583,5 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/customid/ent/group_create.go b/entc/integration/customid/ent/group_create.go index 8fdf81f5b..462900649 100644 --- a/entc/integration/customid/ent/group_create.go +++ b/entc/integration/customid/ent/group_create.go @@ -99,23 +99,23 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - if gr.ID == 0 { + if _node.ID == 0 { id := _spec.ID.Value.(int64) - gr.ID = int(id) + _node.ID = int(id) } - return gr, nil + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -125,7 +125,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } ) if id, ok := gc.mutation.ID(); ok { - gr.ID = id + _node.ID = id _spec.ID.Value = id } if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 { @@ -147,7 +147,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/entc/integration/customid/ent/group_query.go b/entc/integration/customid/ent/group_query.go index 72cc978ff..48dbdabe5 100644 --- a/entc/integration/customid/ent/group_query.go +++ b/entc/integration/customid/ent/group_query.go @@ -84,23 +84,23 @@ func (gq *GroupQuery) QueryUsers() *UserQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -143,11 +143,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/entc/integration/customid/ent/group_update.go b/entc/integration/customid/ent/group_update.go index c0a124d9b..41cb5b49b 100644 --- a/entc/integration/customid/ent/group_update.go +++ b/entc/integration/customid/ent/group_update.go @@ -286,11 +286,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -306,7 +306,7 @@ func (guo *GroupUpdateOne) ExecX(ctx context.Context) { } } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -376,9 +376,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -387,5 +387,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/entc/integration/customid/ent/pet_create.go b/entc/integration/customid/ent/pet_create.go index b31d8af1c..b6fcca643 100644 --- a/entc/integration/customid/ent/pet_create.go +++ b/entc/integration/customid/ent/pet_create.go @@ -158,19 +158,19 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - return pe, nil + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -180,7 +180,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } ) if id, ok := pc.mutation.ID(); ok { - pe.ID = id + _node.ID = id _spec.ID.Value = id } if nodes := pc.mutation.OwnerIDs(); len(nodes) > 0 { @@ -259,7 +259,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/entc/integration/customid/ent/pet_query.go b/entc/integration/customid/ent/pet_query.go index 1aefc4414..912cd9866 100644 --- a/entc/integration/customid/ent/pet_query.go +++ b/entc/integration/customid/ent/pet_query.go @@ -155,23 +155,23 @@ func (pq *PetQuery) QueryBestFriend() *PetQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -198,13 +198,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) string { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -214,11 +214,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -257,11 +257,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/entc/integration/customid/ent/pet_update.go b/entc/integration/customid/ent/pet_update.go index 095cb028a..e45aa85eb 100644 --- a/entc/integration/customid/ent/pet_update.go +++ b/entc/integration/customid/ent/pet_update.go @@ -583,11 +583,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -603,7 +603,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -797,9 +797,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -808,5 +808,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/entc/integration/customid/ent/user_create.go b/entc/integration/customid/ent/user_create.go index b803b2bc0..dd5f3fbaa 100644 --- a/entc/integration/customid/ent/user_create.go +++ b/entc/integration/customid/ent/user_create.go @@ -149,23 +149,23 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - if u.ID == 0 { + if _node.ID == 0 { id := _spec.ID.Value.(int64) - u.ID = int(id) + _node.ID = int(id) } - return u, nil + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -175,7 +175,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } ) if id, ok := uc.mutation.ID(); ok { - u.ID = id + _node.ID = id _spec.ID.Value = id } if nodes := uc.mutation.GroupsIDs(); len(nodes) > 0 { @@ -254,7 +254,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/customid/ent/user_query.go b/entc/integration/customid/ent/user_query.go index e37b5dbcd..0ee939744 100644 --- a/entc/integration/customid/ent/user_query.go +++ b/entc/integration/customid/ent/user_query.go @@ -155,23 +155,23 @@ func (uq *UserQuery) QueryPets() *PetQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -198,13 +198,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -214,11 +214,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -257,11 +257,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/customid/ent/user_update.go b/entc/integration/customid/ent/user_update.go index 35d9d4123..7cf950672 100644 --- a/entc/integration/customid/ent/user_update.go +++ b/entc/integration/customid/ent/user_update.go @@ -624,11 +624,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -644,7 +644,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -857,9 +857,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -868,5 +868,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/ent/card_create.go b/entc/integration/ent/card_create.go index 59aef809f..d2378f3b4 100644 --- a/entc/integration/ent/card_create.go +++ b/entc/integration/ent/card_create.go @@ -195,7 +195,7 @@ func (cc *CardCreate) check() error { } func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -203,13 +203,13 @@ func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { var ( - c = &Card{config: cc.config} + _node = &Card{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: card.Table, ID: &sqlgraph.FieldSpec{ @@ -224,7 +224,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldCreateTime, }) - c.CreateTime = value + _node.CreateTime = value } if value, ok := cc.mutation.UpdateTime(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -232,7 +232,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldUpdateTime, }) - c.UpdateTime = value + _node.UpdateTime = value } if value, ok := cc.mutation.Number(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -240,7 +240,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldNumber, }) - c.Number = value + _node.Number = value } if value, ok := cc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -248,7 +248,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldName, }) - c.Name = value + _node.Name = value } if nodes := cc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -288,7 +288,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CardCreateBulk is the builder for creating a bulk of Card entities. diff --git a/entc/integration/ent/card_query.go b/entc/integration/ent/card_query.go index a98f224da..e924c10ee 100644 --- a/entc/integration/ent/card_query.go +++ b/entc/integration/ent/card_query.go @@ -109,23 +109,23 @@ func (cq *CardQuery) QuerySpec() *SpecQuery { // First returns the first Card entity in the query. Returns *NotFoundError when no card was found. func (cq *CardQuery) First(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{card.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CardQuery) FirstX(ctx context.Context) *Card { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Card id in the query. Returns *NotFoundError when no id was found. @@ -152,13 +152,13 @@ func (cq *CardQuery) FirstXID(ctx context.Context) int { // Only returns the only Card entity in the query, returns an error if not exactly one entity was returned. func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{card.Label} default: @@ -168,11 +168,11 @@ func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CardQuery) OnlyX(ctx context.Context) *Card { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Card id in the query, returns an error if not exactly one id was returned. @@ -211,11 +211,11 @@ func (cq *CardQuery) All(ctx context.Context) ([]*Card, error) { // AllX is like All, but panics if an error occurs. func (cq *CardQuery) AllX(ctx context.Context) []*Card { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Card ids. diff --git a/entc/integration/ent/card_update.go b/entc/integration/ent/card_update.go index 83691e9a9..798c1dde9 100644 --- a/entc/integration/ent/card_update.go +++ b/entc/integration/ent/card_update.go @@ -464,11 +464,11 @@ func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -502,7 +502,7 @@ func (cuo *CardUpdateOne) check() error { return nil } -func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { +func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: card.Table, @@ -627,9 +627,9 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Card{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Card{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{card.Label} @@ -638,5 +638,5 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/ent/client.go b/entc/integration/ent/client.go index a6240ac20..d134dd959 100644 --- a/entc/integration/ent/client.go +++ b/entc/integration/ent/client.go @@ -18,6 +18,7 @@ import ( "github.com/facebook/ent/entc/integration/ent/fieldtype" "github.com/facebook/ent/entc/integration/ent/file" "github.com/facebook/ent/entc/integration/ent/filetype" + "github.com/facebook/ent/entc/integration/ent/goods" "github.com/facebook/ent/entc/integration/ent/group" "github.com/facebook/ent/entc/integration/ent/groupinfo" "github.com/facebook/ent/entc/integration/ent/item" @@ -47,6 +48,8 @@ type Client struct { File *FileClient // FileType is the client for interacting with the FileType builders. FileType *FileTypeClient + // Goods is the client for interacting with the Goods builders. + Goods *GoodsClient // Group is the client for interacting with the Group builders. Group *GroupClient // GroupInfo is the client for interacting with the GroupInfo builders. @@ -81,6 +84,7 @@ func (c *Client) init() { c.FieldType = NewFieldTypeClient(c.config) c.File = NewFileClient(c.config) c.FileType = NewFileTypeClient(c.config) + c.Goods = NewGoodsClient(c.config) c.Group = NewGroupClient(c.config) c.GroupInfo = NewGroupInfoClient(c.config) c.Item = NewItemClient(c.config) @@ -126,6 +130,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { FieldType: NewFieldTypeClient(cfg), File: NewFileClient(cfg), FileType: NewFileTypeClient(cfg), + Goods: NewGoodsClient(cfg), Group: NewGroupClient(cfg), GroupInfo: NewGroupInfoClient(cfg), Item: NewItemClient(cfg), @@ -154,6 +159,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) FieldType: NewFieldTypeClient(cfg), File: NewFileClient(cfg), FileType: NewFileTypeClient(cfg), + Goods: NewGoodsClient(cfg), Group: NewGroupClient(cfg), GroupInfo: NewGroupInfoClient(cfg), Item: NewItemClient(cfg), @@ -195,6 +201,7 @@ func (c *Client) Use(hooks ...Hook) { c.FieldType.Use(hooks...) c.File.Use(hooks...) c.FileType.Use(hooks...) + c.Goods.Use(hooks...) c.Group.Use(hooks...) c.GroupInfo.Use(hooks...) c.Item.Use(hooks...) @@ -741,6 +748,94 @@ func (c *FileTypeClient) Hooks() []Hook { return c.hooks.FileType } +// GoodsClient is a client for the Goods schema. +type GoodsClient struct { + config +} + +// NewGoodsClient returns a client for the Goods from the given config. +func NewGoodsClient(c config) *GoodsClient { + return &GoodsClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `goods.Hooks(f(g(h())))`. +func (c *GoodsClient) Use(hooks ...Hook) { + c.hooks.Goods = append(c.hooks.Goods, hooks...) +} + +// Create returns a create builder for Goods. +func (c *GoodsClient) Create() *GoodsCreate { + mutation := newGoodsMutation(c.config, OpCreate) + return &GoodsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// BulkCreate returns a builder for creating a bulk of Goods entities. +func (c *GoodsClient) CreateBulk(builders ...*GoodsCreate) *GoodsCreateBulk { + return &GoodsCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for Goods. +func (c *GoodsClient) Update() *GoodsUpdate { + mutation := newGoodsMutation(c.config, OpUpdate) + return &GoodsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *GoodsClient) UpdateOne(_go *Goods) *GoodsUpdateOne { + mutation := newGoodsMutation(c.config, OpUpdateOne, withGoods(_go)) + return &GoodsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *GoodsClient) UpdateOneID(id int) *GoodsUpdateOne { + mutation := newGoodsMutation(c.config, OpUpdateOne, withGoodsID(id)) + return &GoodsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for Goods. +func (c *GoodsClient) Delete() *GoodsDelete { + mutation := newGoodsMutation(c.config, OpDelete) + return &GoodsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a delete builder for the given entity. +func (c *GoodsClient) DeleteOne(_go *Goods) *GoodsDeleteOne { + return c.DeleteOneID(_go.ID) +} + +// DeleteOneID returns a delete builder for the given id. +func (c *GoodsClient) DeleteOneID(id int) *GoodsDeleteOne { + builder := c.Delete().Where(goods.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &GoodsDeleteOne{builder} +} + +// Query returns a query builder for Goods. +func (c *GoodsClient) Query() *GoodsQuery { + return &GoodsQuery{config: c.config} +} + +// Get returns a Goods entity by its id. +func (c *GoodsClient) Get(ctx context.Context, id int) (*Goods, error) { + return c.Query().Where(goods.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *GoodsClient) GetX(ctx context.Context, id int) *Goods { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// Hooks returns the client hooks. +func (c *GoodsClient) Hooks() []Hook { + return c.hooks.Goods +} + // GroupClient is a client for the Group schema. type GroupClient struct { config diff --git a/entc/integration/ent/comment_create.go b/entc/integration/ent/comment_create.go index 64eb5c7f3..52124965a 100644 --- a/entc/integration/ent/comment_create.go +++ b/entc/integration/ent/comment_create.go @@ -110,7 +110,7 @@ func (cc *CommentCreate) check() error { } func (cc *CommentCreate) sqlSave(ctx context.Context) (*Comment, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -118,13 +118,13 @@ func (cc *CommentCreate) sqlSave(ctx context.Context) (*Comment, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CommentCreate) createSpec() (*Comment, *sqlgraph.CreateSpec) { var ( - c = &Comment{config: cc.config} + _node = &Comment{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: comment.Table, ID: &sqlgraph.FieldSpec{ @@ -139,7 +139,7 @@ func (cc *CommentCreate) createSpec() (*Comment, *sqlgraph.CreateSpec) { Value: value, Column: comment.FieldUniqueInt, }) - c.UniqueInt = value + _node.UniqueInt = value } if value, ok := cc.mutation.UniqueFloat(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -147,7 +147,7 @@ func (cc *CommentCreate) createSpec() (*Comment, *sqlgraph.CreateSpec) { Value: value, Column: comment.FieldUniqueFloat, }) - c.UniqueFloat = value + _node.UniqueFloat = value } if value, ok := cc.mutation.NillableInt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -155,9 +155,9 @@ func (cc *CommentCreate) createSpec() (*Comment, *sqlgraph.CreateSpec) { Value: value, Column: comment.FieldNillableInt, }) - c.NillableInt = &value + _node.NillableInt = &value } - return c, _spec + return _node, _spec } // CommentCreateBulk is the builder for creating a bulk of Comment entities. diff --git a/entc/integration/ent/comment_query.go b/entc/integration/ent/comment_query.go index ad13a38b1..de8c697a8 100644 --- a/entc/integration/ent/comment_query.go +++ b/entc/integration/ent/comment_query.go @@ -58,23 +58,23 @@ func (cq *CommentQuery) Order(o ...OrderFunc) *CommentQuery { // First returns the first Comment entity in the query. Returns *NotFoundError when no comment was found. func (cq *CommentQuery) First(ctx context.Context) (*Comment, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{comment.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CommentQuery) FirstX(ctx context.Context) *Comment { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Comment id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (cq *CommentQuery) FirstXID(ctx context.Context) int { // Only returns the only Comment entity in the query, returns an error if not exactly one entity was returned. func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{comment.Label} default: @@ -117,11 +117,11 @@ func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Comment id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error) { // AllX is like All, but panics if an error occurs. func (cq *CommentQuery) AllX(ctx context.Context) []*Comment { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Comment ids. diff --git a/entc/integration/ent/comment_update.go b/entc/integration/ent/comment_update.go index 91b28608a..aefeb70c8 100644 --- a/entc/integration/ent/comment_update.go +++ b/entc/integration/ent/comment_update.go @@ -313,11 +313,11 @@ func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -333,7 +333,7 @@ func (cuo *CommentUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CommentUpdateOne) sqlSave(ctx context.Context) (c *Comment, err error) { +func (cuo *CommentUpdateOne) sqlSave(ctx context.Context) (_node *Comment, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: comment.Table, @@ -397,9 +397,9 @@ func (cuo *CommentUpdateOne) sqlSave(ctx context.Context) (c *Comment, err error Column: comment.FieldNillableInt, }) } - c = &Comment{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Comment{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{comment.Label} @@ -408,5 +408,5 @@ func (cuo *CommentUpdateOne) sqlSave(ctx context.Context) (c *Comment, err error } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/ent/config.go b/entc/integration/ent/config.go index 87ce741f2..c80f23ede 100644 --- a/entc/integration/ent/config.go +++ b/entc/integration/ent/config.go @@ -33,6 +33,7 @@ type hooks struct { FieldType []ent.Hook File []ent.Hook FileType []ent.Hook + Goods []ent.Hook Group []ent.Hook GroupInfo []ent.Hook Item []ent.Hook diff --git a/entc/integration/ent/fieldtype_create.go b/entc/integration/ent/fieldtype_create.go index 462a8bed1..68101c14a 100644 --- a/entc/integration/ent/fieldtype_create.go +++ b/entc/integration/ent/fieldtype_create.go @@ -654,7 +654,7 @@ func (ftc *FieldTypeCreate) check() error { } func (ftc *FieldTypeCreate) sqlSave(ctx context.Context) (*FieldType, error) { - ft, _spec := ftc.createSpec() + _node, _spec := ftc.createSpec() if err := sqlgraph.CreateNode(ctx, ftc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -662,13 +662,13 @@ func (ftc *FieldTypeCreate) sqlSave(ctx context.Context) (*FieldType, error) { return nil, err } id := _spec.ID.Value.(int64) - ft.ID = int(id) - return ft, nil + _node.ID = int(id) + return _node, nil } func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { var ( - ft = &FieldType{config: ftc.config} + _node = &FieldType{config: ftc.config} _spec = &sqlgraph.CreateSpec{ Table: fieldtype.Table, ID: &sqlgraph.FieldSpec{ @@ -683,7 +683,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldInt, }) - ft.Int = value + _node.Int = value } if value, ok := ftc.mutation.Int8(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -691,7 +691,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldInt8, }) - ft.Int8 = value + _node.Int8 = value } if value, ok := ftc.mutation.Int16(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -699,7 +699,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldInt16, }) - ft.Int16 = value + _node.Int16 = value } if value, ok := ftc.mutation.Int32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -707,7 +707,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldInt32, }) - ft.Int32 = value + _node.Int32 = value } if value, ok := ftc.mutation.Int64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -715,7 +715,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldInt64, }) - ft.Int64 = value + _node.Int64 = value } if value, ok := ftc.mutation.OptionalInt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -723,7 +723,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalInt, }) - ft.OptionalInt = value + _node.OptionalInt = value } if value, ok := ftc.mutation.OptionalInt8(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -731,7 +731,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalInt8, }) - ft.OptionalInt8 = value + _node.OptionalInt8 = value } if value, ok := ftc.mutation.OptionalInt16(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -739,7 +739,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalInt16, }) - ft.OptionalInt16 = value + _node.OptionalInt16 = value } if value, ok := ftc.mutation.OptionalInt32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -747,7 +747,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalInt32, }) - ft.OptionalInt32 = value + _node.OptionalInt32 = value } if value, ok := ftc.mutation.OptionalInt64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -755,7 +755,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalInt64, }) - ft.OptionalInt64 = value + _node.OptionalInt64 = value } if value, ok := ftc.mutation.NillableInt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -763,7 +763,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNillableInt, }) - ft.NillableInt = &value + _node.NillableInt = &value } if value, ok := ftc.mutation.NillableInt8(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -771,7 +771,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNillableInt8, }) - ft.NillableInt8 = &value + _node.NillableInt8 = &value } if value, ok := ftc.mutation.NillableInt16(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -779,7 +779,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNillableInt16, }) - ft.NillableInt16 = &value + _node.NillableInt16 = &value } if value, ok := ftc.mutation.NillableInt32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -787,7 +787,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNillableInt32, }) - ft.NillableInt32 = &value + _node.NillableInt32 = &value } if value, ok := ftc.mutation.NillableInt64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -795,7 +795,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNillableInt64, }) - ft.NillableInt64 = &value + _node.NillableInt64 = &value } if value, ok := ftc.mutation.ValidateOptionalInt32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -803,7 +803,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldValidateOptionalInt32, }) - ft.ValidateOptionalInt32 = value + _node.ValidateOptionalInt32 = value } if value, ok := ftc.mutation.OptionalUint(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -811,7 +811,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalUint, }) - ft.OptionalUint = value + _node.OptionalUint = value } if value, ok := ftc.mutation.OptionalUint8(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -819,7 +819,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalUint8, }) - ft.OptionalUint8 = value + _node.OptionalUint8 = value } if value, ok := ftc.mutation.OptionalUint16(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -827,7 +827,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalUint16, }) - ft.OptionalUint16 = value + _node.OptionalUint16 = value } if value, ok := ftc.mutation.OptionalUint32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -835,7 +835,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalUint32, }) - ft.OptionalUint32 = value + _node.OptionalUint32 = value } if value, ok := ftc.mutation.OptionalUint64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -843,7 +843,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalUint64, }) - ft.OptionalUint64 = value + _node.OptionalUint64 = value } if value, ok := ftc.mutation.State(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -851,7 +851,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldState, }) - ft.State = value + _node.State = value } if value, ok := ftc.mutation.OptionalFloat(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -859,7 +859,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalFloat, }) - ft.OptionalFloat = value + _node.OptionalFloat = value } if value, ok := ftc.mutation.OptionalFloat32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -867,7 +867,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldOptionalFloat32, }) - ft.OptionalFloat32 = value + _node.OptionalFloat32 = value } if value, ok := ftc.mutation.Datetime(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -875,7 +875,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldDatetime, }) - ft.Datetime = value + _node.Datetime = value } if value, ok := ftc.mutation.Decimal(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -883,7 +883,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldDecimal, }) - ft.Decimal = value + _node.Decimal = value } if value, ok := ftc.mutation.Dir(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -891,7 +891,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldDir, }) - ft.Dir = value + _node.Dir = value } if value, ok := ftc.mutation.Ndir(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -899,7 +899,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNdir, }) - ft.Ndir = &value + _node.Ndir = &value } if value, ok := ftc.mutation.Str(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -907,7 +907,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldStr, }) - ft.Str = value + _node.Str = value } if value, ok := ftc.mutation.NullStr(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -915,7 +915,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNullStr, }) - ft.NullStr = &value + _node.NullStr = &value } if value, ok := ftc.mutation.Link(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -923,7 +923,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldLink, }) - ft.Link = value + _node.Link = value } if value, ok := ftc.mutation.NullLink(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -931,7 +931,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNullLink, }) - ft.NullLink = &value + _node.NullLink = &value } if value, ok := ftc.mutation.Active(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -939,7 +939,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldActive, }) - ft.Active = value + _node.Active = value } if value, ok := ftc.mutation.NullActive(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -947,7 +947,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNullActive, }) - ft.NullActive = &value + _node.NullActive = &value } if value, ok := ftc.mutation.Deleted(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -955,7 +955,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldDeleted, }) - ft.Deleted = value + _node.Deleted = value } if value, ok := ftc.mutation.DeletedAt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -963,7 +963,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldDeletedAt, }) - ft.DeletedAt = value + _node.DeletedAt = value } if value, ok := ftc.mutation.IP(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -971,7 +971,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldIP, }) - ft.IP = value + _node.IP = value } if value, ok := ftc.mutation.NullInt64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -979,7 +979,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNullInt64, }) - ft.NullInt64 = value + _node.NullInt64 = value } if value, ok := ftc.mutation.SchemaInt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -987,7 +987,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldSchemaInt, }) - ft.SchemaInt = value + _node.SchemaInt = value } if value, ok := ftc.mutation.SchemaInt8(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -995,7 +995,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldSchemaInt8, }) - ft.SchemaInt8 = value + _node.SchemaInt8 = value } if value, ok := ftc.mutation.SchemaInt64(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -1003,7 +1003,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldSchemaInt64, }) - ft.SchemaInt64 = value + _node.SchemaInt64 = value } if value, ok := ftc.mutation.SchemaFloat(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -1011,7 +1011,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldSchemaFloat, }) - ft.SchemaFloat = value + _node.SchemaFloat = value } if value, ok := ftc.mutation.SchemaFloat32(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -1019,7 +1019,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldSchemaFloat32, }) - ft.SchemaFloat32 = value + _node.SchemaFloat32 = value } if value, ok := ftc.mutation.NullFloat(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -1027,7 +1027,7 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldNullFloat, }) - ft.NullFloat = value + _node.NullFloat = value } if value, ok := ftc.mutation.Role(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -1035,9 +1035,9 @@ func (ftc *FieldTypeCreate) createSpec() (*FieldType, *sqlgraph.CreateSpec) { Value: value, Column: fieldtype.FieldRole, }) - ft.Role = value + _node.Role = value } - return ft, _spec + return _node, _spec } // FieldTypeCreateBulk is the builder for creating a bulk of FieldType entities. diff --git a/entc/integration/ent/fieldtype_query.go b/entc/integration/ent/fieldtype_query.go index 3cf6dc863..d7a68babb 100644 --- a/entc/integration/ent/fieldtype_query.go +++ b/entc/integration/ent/fieldtype_query.go @@ -59,23 +59,23 @@ func (ftq *FieldTypeQuery) Order(o ...OrderFunc) *FieldTypeQuery { // First returns the first FieldType entity in the query. Returns *NotFoundError when no fieldtype was found. func (ftq *FieldTypeQuery) First(ctx context.Context) (*FieldType, error) { - fts, err := ftq.Limit(1).All(ctx) + nodes, err := ftq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{fieldtype.Label} } - return fts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (ftq *FieldTypeQuery) FirstX(ctx context.Context) *FieldType { - ft, err := ftq.First(ctx) + node, err := ftq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return ft + return node } // FirstID returns the first FieldType id in the query. Returns *NotFoundError when no id was found. @@ -102,13 +102,13 @@ func (ftq *FieldTypeQuery) FirstXID(ctx context.Context) int { // Only returns the only FieldType entity in the query, returns an error if not exactly one entity was returned. func (ftq *FieldTypeQuery) Only(ctx context.Context) (*FieldType, error) { - fts, err := ftq.Limit(2).All(ctx) + nodes, err := ftq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fts) { + switch len(nodes) { case 1: - return fts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{fieldtype.Label} default: @@ -118,11 +118,11 @@ func (ftq *FieldTypeQuery) Only(ctx context.Context) (*FieldType, error) { // OnlyX is like Only, but panics if an error occurs. func (ftq *FieldTypeQuery) OnlyX(ctx context.Context) *FieldType { - ft, err := ftq.Only(ctx) + node, err := ftq.Only(ctx) if err != nil { panic(err) } - return ft + return node } // OnlyID returns the only FieldType id in the query, returns an error if not exactly one id was returned. @@ -161,11 +161,11 @@ func (ftq *FieldTypeQuery) All(ctx context.Context) ([]*FieldType, error) { // AllX is like All, but panics if an error occurs. func (ftq *FieldTypeQuery) AllX(ctx context.Context) []*FieldType { - fts, err := ftq.All(ctx) + nodes, err := ftq.All(ctx) if err != nil { panic(err) } - return fts + return nodes } // IDs executes the query and returns a list of FieldType ids. diff --git a/entc/integration/ent/fieldtype_update.go b/entc/integration/ent/fieldtype_update.go index d9351adc8..a55a27f3b 100644 --- a/entc/integration/ent/fieldtype_update.go +++ b/entc/integration/ent/fieldtype_update.go @@ -2872,11 +2872,11 @@ func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error) { // SaveX is like Save, but panics if an error occurs. func (ftuo *FieldTypeUpdateOne) SaveX(ctx context.Context) *FieldType { - ft, err := ftuo.Save(ctx) + node, err := ftuo.Save(ctx) if err != nil { panic(err) } - return ft + return node } // Exec executes the query on the entity. @@ -2922,7 +2922,7 @@ func (ftuo *FieldTypeUpdateOne) check() error { return nil } -func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (ft *FieldType, err error) { +func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (_node *FieldType, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: fieldtype.Table, @@ -3690,9 +3690,9 @@ func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (ft *FieldType, err Column: fieldtype.FieldRole, }) } - ft = &FieldType{config: ftuo.config} - _spec.Assign = ft.assignValues - _spec.ScanValues = ft.scanValues() + _node = &FieldType{config: ftuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, ftuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{fieldtype.Label} @@ -3701,5 +3701,5 @@ func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (ft *FieldType, err } return nil, err } - return ft, nil + return _node, nil } diff --git a/entc/integration/ent/file_create.go b/entc/integration/ent/file_create.go index be250cb77..85562a5d1 100644 --- a/entc/integration/ent/file_create.go +++ b/entc/integration/ent/file_create.go @@ -216,7 +216,7 @@ func (fc *FileCreate) check() error { } func (fc *FileCreate) sqlSave(ctx context.Context) (*File, error) { - f, _spec := fc.createSpec() + _node, _spec := fc.createSpec() if err := sqlgraph.CreateNode(ctx, fc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -224,13 +224,13 @@ func (fc *FileCreate) sqlSave(ctx context.Context) (*File, error) { return nil, err } id := _spec.ID.Value.(int64) - f.ID = int(id) - return f, nil + _node.ID = int(id) + return _node, nil } func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { var ( - f = &File{config: fc.config} + _node = &File{config: fc.config} _spec = &sqlgraph.CreateSpec{ Table: file.Table, ID: &sqlgraph.FieldSpec{ @@ -245,7 +245,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { Value: value, Column: file.FieldSize, }) - f.Size = value + _node.Size = value } if value, ok := fc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -253,7 +253,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { Value: value, Column: file.FieldName, }) - f.Name = value + _node.Name = value } if value, ok := fc.mutation.User(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -261,7 +261,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { Value: value, Column: file.FieldUser, }) - f.User = &value + _node.User = &value } if value, ok := fc.mutation.Group(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -269,7 +269,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { Value: value, Column: file.FieldGroup, }) - f.Group = value + _node.Group = value } if value, ok := fc.mutation.GetOp(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -277,7 +277,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { Value: value, Column: file.FieldOp, }) - f.Op = value + _node.Op = value } if nodes := fc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -336,7 +336,7 @@ func (fc *FileCreate) createSpec() (*File, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return f, _spec + return _node, _spec } // FileCreateBulk is the builder for creating a bulk of File entities. diff --git a/entc/integration/ent/file_query.go b/entc/integration/ent/file_query.go index 03dd22dd2..fd454e279 100644 --- a/entc/integration/ent/file_query.go +++ b/entc/integration/ent/file_query.go @@ -133,23 +133,23 @@ func (fq *FileQuery) QueryField() *FieldTypeQuery { // First returns the first File entity in the query. Returns *NotFoundError when no file was found. func (fq *FileQuery) First(ctx context.Context) (*File, error) { - fs, err := fq.Limit(1).All(ctx) + nodes, err := fq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{file.Label} } - return fs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (fq *FileQuery) FirstX(ctx context.Context) *File { - f, err := fq.First(ctx) + node, err := fq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return f + return node } // FirstID returns the first File id in the query. Returns *NotFoundError when no id was found. @@ -176,13 +176,13 @@ func (fq *FileQuery) FirstXID(ctx context.Context) int { // Only returns the only File entity in the query, returns an error if not exactly one entity was returned. func (fq *FileQuery) Only(ctx context.Context) (*File, error) { - fs, err := fq.Limit(2).All(ctx) + nodes, err := fq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fs) { + switch len(nodes) { case 1: - return fs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{file.Label} default: @@ -192,11 +192,11 @@ func (fq *FileQuery) Only(ctx context.Context) (*File, error) { // OnlyX is like Only, but panics if an error occurs. func (fq *FileQuery) OnlyX(ctx context.Context) *File { - f, err := fq.Only(ctx) + node, err := fq.Only(ctx) if err != nil { panic(err) } - return f + return node } // OnlyID returns the only File id in the query, returns an error if not exactly one id was returned. @@ -235,11 +235,11 @@ func (fq *FileQuery) All(ctx context.Context) ([]*File, error) { // AllX is like All, but panics if an error occurs. func (fq *FileQuery) AllX(ctx context.Context) []*File { - fs, err := fq.All(ctx) + nodes, err := fq.All(ctx) if err != nil { panic(err) } - return fs + return nodes } // IDs executes the query and returns a list of File ids. diff --git a/entc/integration/ent/file_update.go b/entc/integration/ent/file_update.go index d2d82b331..bef7a49e5 100644 --- a/entc/integration/ent/file_update.go +++ b/entc/integration/ent/file_update.go @@ -714,11 +714,11 @@ func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { // SaveX is like Save, but panics if an error occurs. func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File { - f, err := fuo.Save(ctx) + node, err := fuo.Save(ctx) if err != nil { panic(err) } - return f + return node } // Exec executes the query on the entity. @@ -744,7 +744,7 @@ func (fuo *FileUpdateOne) check() error { return nil } -func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (f *File, err error) { +func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (_node *File, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: file.Table, @@ -944,9 +944,9 @@ func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (f *File, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - f = &File{config: fuo.config} - _spec.Assign = f.assignValues - _spec.ScanValues = f.scanValues() + _node = &File{config: fuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, fuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{file.Label} @@ -955,5 +955,5 @@ func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (f *File, err error) { } return nil, err } - return f, nil + return _node, nil } diff --git a/entc/integration/ent/filetype_create.go b/entc/integration/ent/filetype_create.go index 5bd010683..d61152225 100644 --- a/entc/integration/ent/filetype_create.go +++ b/entc/integration/ent/filetype_create.go @@ -160,7 +160,7 @@ func (ftc *FileTypeCreate) check() error { } func (ftc *FileTypeCreate) sqlSave(ctx context.Context) (*FileType, error) { - ft, _spec := ftc.createSpec() + _node, _spec := ftc.createSpec() if err := sqlgraph.CreateNode(ctx, ftc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -168,13 +168,13 @@ func (ftc *FileTypeCreate) sqlSave(ctx context.Context) (*FileType, error) { return nil, err } id := _spec.ID.Value.(int64) - ft.ID = int(id) - return ft, nil + _node.ID = int(id) + return _node, nil } func (ftc *FileTypeCreate) createSpec() (*FileType, *sqlgraph.CreateSpec) { var ( - ft = &FileType{config: ftc.config} + _node = &FileType{config: ftc.config} _spec = &sqlgraph.CreateSpec{ Table: filetype.Table, ID: &sqlgraph.FieldSpec{ @@ -189,7 +189,7 @@ func (ftc *FileTypeCreate) createSpec() (*FileType, *sqlgraph.CreateSpec) { Value: value, Column: filetype.FieldName, }) - ft.Name = value + _node.Name = value } if value, ok := ftc.mutation.GetType(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -197,7 +197,7 @@ func (ftc *FileTypeCreate) createSpec() (*FileType, *sqlgraph.CreateSpec) { Value: value, Column: filetype.FieldType, }) - ft.Type = value + _node.Type = value } if value, ok := ftc.mutation.State(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -205,7 +205,7 @@ func (ftc *FileTypeCreate) createSpec() (*FileType, *sqlgraph.CreateSpec) { Value: value, Column: filetype.FieldState, }) - ft.State = value + _node.State = value } if nodes := ftc.mutation.FilesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -226,7 +226,7 @@ func (ftc *FileTypeCreate) createSpec() (*FileType, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return ft, _spec + return _node, _spec } // FileTypeCreateBulk is the builder for creating a bulk of FileType entities. diff --git a/entc/integration/ent/filetype_query.go b/entc/integration/ent/filetype_query.go index cf9cfbc1d..636ea6220 100644 --- a/entc/integration/ent/filetype_query.go +++ b/entc/integration/ent/filetype_query.go @@ -84,23 +84,23 @@ func (ftq *FileTypeQuery) QueryFiles() *FileQuery { // First returns the first FileType entity in the query. Returns *NotFoundError when no filetype was found. func (ftq *FileTypeQuery) First(ctx context.Context) (*FileType, error) { - fts, err := ftq.Limit(1).All(ctx) + nodes, err := ftq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{filetype.Label} } - return fts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (ftq *FileTypeQuery) FirstX(ctx context.Context) *FileType { - ft, err := ftq.First(ctx) + node, err := ftq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return ft + return node } // FirstID returns the first FileType id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (ftq *FileTypeQuery) FirstXID(ctx context.Context) int { // Only returns the only FileType entity in the query, returns an error if not exactly one entity was returned. func (ftq *FileTypeQuery) Only(ctx context.Context) (*FileType, error) { - fts, err := ftq.Limit(2).All(ctx) + nodes, err := ftq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fts) { + switch len(nodes) { case 1: - return fts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{filetype.Label} default: @@ -143,11 +143,11 @@ func (ftq *FileTypeQuery) Only(ctx context.Context) (*FileType, error) { // OnlyX is like Only, but panics if an error occurs. func (ftq *FileTypeQuery) OnlyX(ctx context.Context) *FileType { - ft, err := ftq.Only(ctx) + node, err := ftq.Only(ctx) if err != nil { panic(err) } - return ft + return node } // OnlyID returns the only FileType id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (ftq *FileTypeQuery) All(ctx context.Context) ([]*FileType, error) { // AllX is like All, but panics if an error occurs. func (ftq *FileTypeQuery) AllX(ctx context.Context) []*FileType { - fts, err := ftq.All(ctx) + nodes, err := ftq.All(ctx) if err != nil { panic(err) } - return fts + return nodes } // IDs executes the query and returns a list of FileType ids. diff --git a/entc/integration/ent/filetype_update.go b/entc/integration/ent/filetype_update.go index 3b717372b..fd8792e58 100644 --- a/entc/integration/ent/filetype_update.go +++ b/entc/integration/ent/filetype_update.go @@ -402,11 +402,11 @@ func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error) { // SaveX is like Save, but panics if an error occurs. func (ftuo *FileTypeUpdateOne) SaveX(ctx context.Context) *FileType { - ft, err := ftuo.Save(ctx) + node, err := ftuo.Save(ctx) if err != nil { panic(err) } - return ft + return node } // Exec executes the query on the entity. @@ -437,7 +437,7 @@ func (ftuo *FileTypeUpdateOne) check() error { return nil } -func (ftuo *FileTypeUpdateOne) sqlSave(ctx context.Context) (ft *FileType, err error) { +func (ftuo *FileTypeUpdateOne) sqlSave(ctx context.Context) (_node *FileType, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: filetype.Table, @@ -528,9 +528,9 @@ func (ftuo *FileTypeUpdateOne) sqlSave(ctx context.Context) (ft *FileType, err e } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - ft = &FileType{config: ftuo.config} - _spec.Assign = ft.assignValues - _spec.ScanValues = ft.scanValues() + _node = &FileType{config: ftuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, ftuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{filetype.Label} @@ -539,5 +539,5 @@ func (ftuo *FileTypeUpdateOne) sqlSave(ctx context.Context) (ft *FileType, err e } return nil, err } - return ft, nil + return _node, nil } diff --git a/entc/integration/ent/goods.go b/entc/integration/ent/goods.go new file mode 100644 index 000000000..ebc91bceb --- /dev/null +++ b/entc/integration/ent/goods.go @@ -0,0 +1,80 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "fmt" + "strings" + + "github.com/facebook/ent/dialect/sql" + "github.com/facebook/ent/entc/integration/ent/goods" +) + +// Goods is the model entity for the Goods schema. +type Goods struct { + config + // ID of the ent. + ID int `json:"id,omitempty"` +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*Goods) scanValues() []interface{} { + return []interface{}{ + &sql.NullInt64{}, // id + } +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the Goods fields. +func (_go *Goods) assignValues(values ...interface{}) error { + if m, n := len(values), len(goods.Columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + value, ok := values[0].(*sql.NullInt64) + if !ok { + return fmt.Errorf("unexpected type %T for field id", value) + } + _go.ID = int(value.Int64) + values = values[1:] + return nil +} + +// Update returns a builder for updating this Goods. +// Note that, you need to call Goods.Unwrap() before calling this method, if this Goods +// was returned from a transaction, and the transaction was committed or rolled back. +func (_go *Goods) Update() *GoodsUpdateOne { + return (&GoodsClient{config: _go.config}).UpdateOne(_go) +} + +// Unwrap unwraps the entity that was returned from a transaction after it was closed, +// so that all next queries will be executed through the driver which created the transaction. +func (_go *Goods) Unwrap() *Goods { + tx, ok := _go.config.driver.(*txDriver) + if !ok { + panic("ent: Goods is not a transactional entity") + } + _go.config.driver = tx.drv + return _go +} + +// String implements the fmt.Stringer. +func (_go *Goods) String() string { + var builder strings.Builder + builder.WriteString("Goods(") + builder.WriteString(fmt.Sprintf("id=%v", _go.ID)) + builder.WriteByte(')') + return builder.String() +} + +// GoodsSlice is a parsable slice of Goods. +type GoodsSlice []*Goods + +func (_go GoodsSlice) config(cfg config) { + for _i := range _go { + _go[_i].config = cfg + } +} diff --git a/entc/integration/ent/goods/goods.go b/entc/integration/ent/goods/goods.go new file mode 100644 index 000000000..a67052c6d --- /dev/null +++ b/entc/integration/ent/goods/goods.go @@ -0,0 +1,34 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package goods + +const ( + // Label holds the string label denoting the goods type in the database. + Label = "goods" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + + // Table holds the table name of the goods in the database. + Table = "goods" +) + +// Columns holds all SQL columns for goods fields. +var Columns = []string{ + FieldID, +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + return false +} + +// comment from another template. diff --git a/entc/integration/ent/goods/where.go b/entc/integration/ent/goods/where.go new file mode 100644 index 000000000..73a12715b --- /dev/null +++ b/entc/integration/ent/goods/where.go @@ -0,0 +1,127 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package goods + +import ( + "github.com/facebook/ent/dialect/sql" + "github.com/facebook/ent/entc/integration/ent/predicate" +) + +// ID filters vertices based on their identifier. +func ID(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldID), id)) + }) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldID), id)) + }) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldID), id)) + }) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(ids) == 0 { + s.Where(sql.False()) + return + } + v := make([]interface{}, len(ids)) + for i := range v { + v[i] = ids[i] + } + s.Where(sql.In(s.C(FieldID), v...)) + }) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + // if not arguments were provided, append the FALSE constants, + // since we can't apply "IN ()". This will make this predicate falsy. + if len(ids) == 0 { + s.Where(sql.False()) + return + } + v := make([]interface{}, len(ids)) + for i := range v { + v[i] = ids[i] + } + s.Where(sql.NotIn(s.C(FieldID), v...)) + }) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.GT(s.C(FieldID), id)) + }) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.GTE(s.C(FieldID), id)) + }) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.LT(s.C(FieldID), id)) + }) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id int) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s.Where(sql.LTE(s.C(FieldID), id)) + }) +} + +// And groups list of predicates with the AND operator between them. +func And(predicates ...predicate.Goods) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s1 := s.Clone().SetP(nil) + for _, p := range predicates { + p(s1) + } + s.Where(s1.P()) + }) +} + +// Or groups list of predicates with the OR operator between them. +func Or(predicates ...predicate.Goods) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + s1 := s.Clone().SetP(nil) + for i, p := range predicates { + if i > 0 { + s1.Or() + } + p(s1) + } + s.Where(s1.P()) + }) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.Goods) predicate.Goods { + return predicate.Goods(func(s *sql.Selector) { + p(s.Not()) + }) +} diff --git a/entc/integration/ent/goods_create.go b/entc/integration/ent/goods_create.go new file mode 100644 index 000000000..a11f0dc3e --- /dev/null +++ b/entc/integration/ent/goods_create.go @@ -0,0 +1,170 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/sql/sqlgraph" + "github.com/facebook/ent/entc/integration/ent/goods" + "github.com/facebook/ent/schema/field" +) + +// GoodsCreate is the builder for creating a Goods entity. +type GoodsCreate struct { + config + mutation *GoodsMutation + hooks []Hook +} + +// Mutation returns the GoodsMutation object of the builder. +func (gc *GoodsCreate) Mutation() *GoodsMutation { + return gc.mutation +} + +// Save creates the Goods in the database. +func (gc *GoodsCreate) Save(ctx context.Context) (*Goods, error) { + var ( + err error + node *Goods + ) + if len(gc.hooks) == 0 { + if err = gc.check(); err != nil { + return nil, err + } + node, err = gc.sqlSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err = gc.check(); err != nil { + return nil, err + } + gc.mutation = mutation + node, err = gc.sqlSave(ctx) + mutation.done = true + return node, err + }) + for i := len(gc.hooks) - 1; i >= 0; i-- { + mut = gc.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gc.mutation); err != nil { + return nil, err + } + } + return node, err +} + +// SaveX calls Save and panics if Save returns an error. +func (gc *GoodsCreate) SaveX(ctx context.Context) *Goods { + v, err := gc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// check runs all checks and user-defined validators on the builder. +func (gc *GoodsCreate) check() error { + return nil +} + +func (gc *GoodsCreate) sqlSave(ctx context.Context) (*Goods, error) { + _node, _spec := gc.createSpec() + if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { + if cerr, ok := isSQLConstraintError(err); ok { + err = cerr + } + return nil, err + } + id := _spec.ID.Value.(int64) + _node.ID = int(id) + return _node, nil +} + +func (gc *GoodsCreate) createSpec() (*Goods, *sqlgraph.CreateSpec) { + var ( + _node = &Goods{config: gc.config} + _spec = &sqlgraph.CreateSpec{ + Table: goods.Table, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: goods.FieldID, + }, + } + ) + return _node, _spec +} + +// GoodsCreateBulk is the builder for creating a bulk of Goods entities. +type GoodsCreateBulk struct { + config + builders []*GoodsCreate +} + +// Save creates the Goods entities in the database. +func (gcb *GoodsCreateBulk) Save(ctx context.Context) ([]*Goods, error) { + specs := make([]*sqlgraph.CreateSpec, len(gcb.builders)) + nodes := make([]*Goods, len(gcb.builders)) + mutators := make([]Mutator, len(gcb.builders)) + for i := range gcb.builders { + func(i int, root context.Context) { + builder := gcb.builders[i] + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + nodes[i], specs[i] = builder.createSpec() + var err error + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, gcb.builders[i+1].mutation) + } else { + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, gcb.driver, &sqlgraph.BatchCreateSpec{Nodes: specs}); err != nil { + if cerr, ok := isSQLConstraintError(err); ok { + err = cerr + } + } + } + mutation.done = true + if err != nil { + return nil, err + } + id := specs[i].ID.Value.(int64) + nodes[i].ID = int(id) + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, gcb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX calls Save and panics if Save returns an error. +func (gcb *GoodsCreateBulk) SaveX(ctx context.Context) []*Goods { + v, err := gcb.Save(ctx) + if err != nil { + panic(err) + } + return v +} diff --git a/entc/integration/ent/goods_delete.go b/entc/integration/ent/goods_delete.go new file mode 100644 index 000000000..452eeb2a8 --- /dev/null +++ b/entc/integration/ent/goods_delete.go @@ -0,0 +1,113 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/sql" + "github.com/facebook/ent/dialect/sql/sqlgraph" + "github.com/facebook/ent/entc/integration/ent/goods" + "github.com/facebook/ent/entc/integration/ent/predicate" + "github.com/facebook/ent/schema/field" +) + +// GoodsDelete is the builder for deleting a Goods entity. +type GoodsDelete struct { + config + hooks []Hook + mutation *GoodsMutation + predicates []predicate.Goods +} + +// Where adds a new predicate to the delete builder. +func (gd *GoodsDelete) Where(ps ...predicate.Goods) *GoodsDelete { + gd.predicates = append(gd.predicates, ps...) + return gd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (gd *GoodsDelete) Exec(ctx context.Context) (int, error) { + var ( + err error + affected int + ) + if len(gd.hooks) == 0 { + affected, err = gd.sqlExec(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + gd.mutation = mutation + affected, err = gd.sqlExec(ctx) + mutation.done = true + return affected, err + }) + for i := len(gd.hooks) - 1; i >= 0; i-- { + mut = gd.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gd.mutation); err != nil { + return 0, err + } + } + return affected, err +} + +// ExecX is like Exec, but panics if an error occurs. +func (gd *GoodsDelete) ExecX(ctx context.Context) int { + n, err := gd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (gd *GoodsDelete) sqlExec(ctx context.Context) (int, error) { + _spec := &sqlgraph.DeleteSpec{ + Node: &sqlgraph.NodeSpec{ + Table: goods.Table, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: goods.FieldID, + }, + }, + } + if ps := gd.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return sqlgraph.DeleteNodes(ctx, gd.driver, _spec) +} + +// GoodsDeleteOne is the builder for deleting a single Goods entity. +type GoodsDeleteOne struct { + gd *GoodsDelete +} + +// Exec executes the deletion query. +func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { + n, err := gdo.gd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{goods.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (gdo *GoodsDeleteOne) ExecX(ctx context.Context) { + gdo.gd.ExecX(ctx) +} diff --git a/entc/integration/ent/goods_query.go b/entc/integration/ent/goods_query.go new file mode 100644 index 000000000..0eb9dd67e --- /dev/null +++ b/entc/integration/ent/goods_query.go @@ -0,0 +1,860 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "math" + + "github.com/facebook/ent/dialect/sql" + "github.com/facebook/ent/dialect/sql/sqlgraph" + "github.com/facebook/ent/entc/integration/ent/goods" + "github.com/facebook/ent/entc/integration/ent/predicate" + "github.com/facebook/ent/schema/field" +) + +// GoodsQuery is the builder for querying Goods entities. +type GoodsQuery struct { + config + limit *int + offset *int + order []OrderFunc + unique []string + predicates []predicate.Goods + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the builder. +func (gq *GoodsQuery) Where(ps ...predicate.Goods) *GoodsQuery { + gq.predicates = append(gq.predicates, ps...) + return gq +} + +// Limit adds a limit step to the query. +func (gq *GoodsQuery) Limit(limit int) *GoodsQuery { + gq.limit = &limit + return gq +} + +// Offset adds an offset step to the query. +func (gq *GoodsQuery) Offset(offset int) *GoodsQuery { + gq.offset = &offset + return gq +} + +// Order adds an order step to the query. +func (gq *GoodsQuery) Order(o ...OrderFunc) *GoodsQuery { + gq.order = append(gq.order, o...) + return gq +} + +// First returns the first Goods entity in the query. Returns *NotFoundError when no goods was found. +func (gq *GoodsQuery) First(ctx context.Context) (*Goods, error) { + nodes, err := gq.Limit(1).All(ctx) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{goods.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (gq *GoodsQuery) FirstX(ctx context.Context) *Goods { + node, err := gq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first Goods id in the query. Returns *NotFoundError when no id was found. +func (gq *GoodsQuery) FirstID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = gq.Limit(1).IDs(ctx); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{goods.Label} + return + } + return ids[0], nil +} + +// FirstXID is like FirstID, but panics if an error occurs. +func (gq *GoodsQuery) FirstXID(ctx context.Context) int { + id, err := gq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns the only Goods entity in the query, returns an error if not exactly one entity was returned. +func (gq *GoodsQuery) Only(ctx context.Context) (*Goods, error) { + nodes, err := gq.Limit(2).All(ctx) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{goods.Label} + default: + return nil, &NotSingularError{goods.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (gq *GoodsQuery) OnlyX(ctx context.Context) *Goods { + node, err := gq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID returns the only Goods id in the query, returns an error if not exactly one id was returned. +func (gq *GoodsQuery) OnlyID(ctx context.Context) (id int, err error) { + var ids []int + if ids, err = gq.Limit(2).IDs(ctx); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{goods.Label} + default: + err = &NotSingularError{goods.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (gq *GoodsQuery) OnlyIDX(ctx context.Context) int { + id, err := gq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of GoodsSlice. +func (gq *GoodsQuery) All(ctx context.Context) ([]*Goods, error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.sqlAll(ctx) +} + +// AllX is like All, but panics if an error occurs. +func (gq *GoodsQuery) AllX(ctx context.Context) []*Goods { + nodes, err := gq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of Goods ids. +func (gq *GoodsQuery) IDs(ctx context.Context) ([]int, error) { + var ids []int + if err := gq.Select(goods.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (gq *GoodsQuery) IDsX(ctx context.Context) []int { + ids, err := gq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (gq *GoodsQuery) Count(ctx context.Context) (int, error) { + if err := gq.prepareQuery(ctx); err != nil { + return 0, err + } + return gq.sqlCount(ctx) +} + +// CountX is like Count, but panics if an error occurs. +func (gq *GoodsQuery) CountX(ctx context.Context) int { + count, err := gq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (gq *GoodsQuery) Exist(ctx context.Context) (bool, error) { + if err := gq.prepareQuery(ctx); err != nil { + return false, err + } + return gq.sqlExist(ctx) +} + +// ExistX is like Exist, but panics if an error occurs. +func (gq *GoodsQuery) ExistX(ctx context.Context) bool { + exist, err := gq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the query builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (gq *GoodsQuery) Clone() *GoodsQuery { + return &GoodsQuery{ + config: gq.config, + limit: gq.limit, + offset: gq.offset, + order: append([]OrderFunc{}, gq.order...), + unique: append([]string{}, gq.unique...), + predicates: append([]predicate.Goods{}, gq.predicates...), + // clone intermediate query. + sql: gq.sql.Clone(), + path: gq.path, + } +} + +// GroupBy used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +func (gq *GoodsQuery) GroupBy(field string, fields ...string) *GoodsGroupBy { + group := &GoodsGroupBy{config: gq.config} + group.fields = append([]string{field}, fields...) + group.path = func(ctx context.Context) (prev *sql.Selector, err error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.sqlQuery(), nil + } + return group +} + +// Select one or more fields from the given query. +func (gq *GoodsQuery) Select(field string, fields ...string) *GoodsSelect { + selector := &GoodsSelect{config: gq.config} + selector.fields = append([]string{field}, fields...) + selector.path = func(ctx context.Context) (prev *sql.Selector, err error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.sqlQuery(), nil + } + return selector +} + +func (gq *GoodsQuery) prepareQuery(ctx context.Context) error { + if gq.path != nil { + prev, err := gq.path(ctx) + if err != nil { + return err + } + gq.sql = prev + } + return nil +} + +func (gq *GoodsQuery) sqlAll(ctx context.Context) ([]*Goods, error) { + var ( + nodes = []*Goods{} + _spec = gq.querySpec() + ) + _spec.ScanValues = func() []interface{} { + node := &Goods{config: gq.config} + nodes = append(nodes, node) + values := node.scanValues() + return values + } + _spec.Assign = func(values ...interface{}) error { + if len(nodes) == 0 { + return fmt.Errorf("ent: Assign called without calling ScanValues") + } + node := nodes[len(nodes)-1] + return node.assignValues(values...) + } + if err := sqlgraph.QueryNodes(ctx, gq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + return nodes, nil +} + +func (gq *GoodsQuery) sqlCount(ctx context.Context) (int, error) { + _spec := gq.querySpec() + return sqlgraph.CountNodes(ctx, gq.driver, _spec) +} + +func (gq *GoodsQuery) sqlExist(ctx context.Context) (bool, error) { + n, err := gq.sqlCount(ctx) + if err != nil { + return false, fmt.Errorf("ent: check existence: %v", err) + } + return n > 0, nil +} + +func (gq *GoodsQuery) querySpec() *sqlgraph.QuerySpec { + _spec := &sqlgraph.QuerySpec{ + Node: &sqlgraph.NodeSpec{ + Table: goods.Table, + Columns: goods.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: goods.FieldID, + }, + }, + From: gq.sql, + Unique: true, + } + if ps := gq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := gq.limit; limit != nil { + _spec.Limit = *limit + } + if offset := gq.offset; offset != nil { + _spec.Offset = *offset + } + if ps := gq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector, goods.ValidColumn) + } + } + } + return _spec +} + +func (gq *GoodsQuery) sqlQuery() *sql.Selector { + builder := sql.Dialect(gq.driver.Dialect()) + t1 := builder.Table(goods.Table) + selector := builder.Select(t1.Columns(goods.Columns...)...).From(t1) + if gq.sql != nil { + selector = gq.sql + selector.Select(selector.Columns(goods.Columns...)...) + } + for _, p := range gq.predicates { + p(selector) + } + for _, p := range gq.order { + p(selector, goods.ValidColumn) + } + if offset := gq.offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := gq.limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// GoodsGroupBy is the builder for group-by Goods entities. +type GoodsGroupBy struct { + config + fields []string + fns []AggregateFunc + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (ggb *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { + ggb.fns = append(ggb.fns, fns...) + return ggb +} + +// Scan applies the group-by query and scan the result into the given value. +func (ggb *GoodsGroupBy) Scan(ctx context.Context, v interface{}) error { + query, err := ggb.path(ctx) + if err != nil { + return err + } + ggb.sql = query + return ggb.sqlScan(ctx, v) +} + +// ScanX is like Scan, but panics if an error occurs. +func (ggb *GoodsGroupBy) ScanX(ctx context.Context, v interface{}) { + if err := ggb.Scan(ctx, v); err != nil { + panic(err) + } +} + +// Strings returns list of strings from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Strings(ctx context.Context) ([]string, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Strings is not achievable when grouping more than 1 field") + } + var v []string + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// StringsX is like Strings, but panics if an error occurs. +func (ggb *GoodsGroupBy) StringsX(ctx context.Context) []string { + v, err := ggb.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = ggb.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (ggb *GoodsGroupBy) StringX(ctx context.Context) string { + v, err := ggb.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Ints(ctx context.Context) ([]int, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Ints is not achievable when grouping more than 1 field") + } + var v []int + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (ggb *GoodsGroupBy) IntsX(ctx context.Context) []int { + v, err := ggb.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = ggb.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (ggb *GoodsGroupBy) IntX(ctx context.Context) int { + v, err := ggb.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Float64s(ctx context.Context) ([]float64, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Float64s is not achievable when grouping more than 1 field") + } + var v []float64 + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (ggb *GoodsGroupBy) Float64sX(ctx context.Context) []float64 { + v, err := ggb.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = ggb.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (ggb *GoodsGroupBy) Float64X(ctx context.Context) float64 { + v, err := ggb.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Bools(ctx context.Context) ([]bool, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Bools is not achievable when grouping more than 1 field") + } + var v []bool + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (ggb *GoodsGroupBy) BoolsX(ctx context.Context) []bool { + v, err := ggb.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = ggb.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (ggb *GoodsGroupBy) BoolX(ctx context.Context) bool { + v, err := ggb.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +func (ggb *GoodsGroupBy) sqlScan(ctx context.Context, v interface{}) error { + for _, f := range ggb.fields { + if !goods.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for group-by", f)} + } + } + selector := ggb.sqlQuery() + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := ggb.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +func (ggb *GoodsGroupBy) sqlQuery() *sql.Selector { + selector := ggb.sql + columns := make([]string, 0, len(ggb.fields)+len(ggb.fns)) + columns = append(columns, ggb.fields...) + for _, fn := range ggb.fns { + columns = append(columns, fn(selector, goods.ValidColumn)) + } + return selector.Select(columns...).GroupBy(ggb.fields...) +} + +// GoodsSelect is the builder for select fields of Goods entities. +type GoodsSelect struct { + config + fields []string + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Scan applies the selector query and scan the result into the given value. +func (gs *GoodsSelect) Scan(ctx context.Context, v interface{}) error { + query, err := gs.path(ctx) + if err != nil { + return err + } + gs.sql = query + return gs.sqlScan(ctx, v) +} + +// ScanX is like Scan, but panics if an error occurs. +func (gs *GoodsSelect) ScanX(ctx context.Context, v interface{}) { + if err := gs.Scan(ctx, v); err != nil { + panic(err) + } +} + +// Strings returns list of strings from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Strings(ctx context.Context) ([]string, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Strings is not achievable when selecting more than 1 field") + } + var v []string + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// StringsX is like Strings, but panics if an error occurs. +func (gs *GoodsSelect) StringsX(ctx context.Context) []string { + v, err := gs.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = gs.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (gs *GoodsSelect) StringX(ctx context.Context) string { + v, err := gs.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Ints(ctx context.Context) ([]int, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Ints is not achievable when selecting more than 1 field") + } + var v []int + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (gs *GoodsSelect) IntsX(ctx context.Context) []int { + v, err := gs.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = gs.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (gs *GoodsSelect) IntX(ctx context.Context) int { + v, err := gs.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Float64s(ctx context.Context) ([]float64, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Float64s is not achievable when selecting more than 1 field") + } + var v []float64 + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (gs *GoodsSelect) Float64sX(ctx context.Context) []float64 { + v, err := gs.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = gs.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (gs *GoodsSelect) Float64X(ctx context.Context) float64 { + v, err := gs.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Bools(ctx context.Context) ([]bool, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Bools is not achievable when selecting more than 1 field") + } + var v []bool + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (gs *GoodsSelect) BoolsX(ctx context.Context) []bool { + v, err := gs.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = gs.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (gs *GoodsSelect) BoolX(ctx context.Context) bool { + v, err := gs.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +func (gs *GoodsSelect) sqlScan(ctx context.Context, v interface{}) error { + for _, f := range gs.fields { + if !goods.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("invalid field %q for selection", f)} + } + } + rows := &sql.Rows{} + query, args := gs.sqlQuery().Query() + if err := gs.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +func (gs *GoodsSelect) sqlQuery() sql.Querier { + selector := gs.sql + selector.Select(selector.Columns(gs.fields...)...) + return selector +} diff --git a/entc/integration/ent/goods_update.go b/entc/integration/ent/goods_update.go new file mode 100644 index 000000000..2584398ea --- /dev/null +++ b/entc/integration/ent/goods_update.go @@ -0,0 +1,210 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/sql" + "github.com/facebook/ent/dialect/sql/sqlgraph" + "github.com/facebook/ent/entc/integration/ent/goods" + "github.com/facebook/ent/entc/integration/ent/predicate" + "github.com/facebook/ent/schema/field" +) + +// GoodsUpdate is the builder for updating Goods entities. +type GoodsUpdate struct { + config + hooks []Hook + mutation *GoodsMutation + predicates []predicate.Goods +} + +// Where adds a new predicate for the builder. +func (gu *GoodsUpdate) Where(ps ...predicate.Goods) *GoodsUpdate { + gu.predicates = append(gu.predicates, ps...) + return gu +} + +// Mutation returns the GoodsMutation object of the builder. +func (gu *GoodsUpdate) Mutation() *GoodsMutation { + return gu.mutation +} + +// Save executes the query and returns the number of rows/vertices matched by this operation. +func (gu *GoodsUpdate) Save(ctx context.Context) (int, error) { + var ( + err error + affected int + ) + if len(gu.hooks) == 0 { + affected, err = gu.sqlSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + gu.mutation = mutation + affected, err = gu.sqlSave(ctx) + mutation.done = true + return affected, err + }) + for i := len(gu.hooks) - 1; i >= 0; i-- { + mut = gu.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gu.mutation); err != nil { + return 0, err + } + } + return affected, err +} + +// SaveX is like Save, but panics if an error occurs. +func (gu *GoodsUpdate) SaveX(ctx context.Context) int { + affected, err := gu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (gu *GoodsUpdate) Exec(ctx context.Context) error { + _, err := gu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (gu *GoodsUpdate) ExecX(ctx context.Context) { + if err := gu.Exec(ctx); err != nil { + panic(err) + } +} + +func (gu *GoodsUpdate) sqlSave(ctx context.Context) (n int, err error) { + _spec := &sqlgraph.UpdateSpec{ + Node: &sqlgraph.NodeSpec{ + Table: goods.Table, + Columns: goods.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: goods.FieldID, + }, + }, + } + if ps := gu.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if n, err = sqlgraph.UpdateNodes(ctx, gu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{goods.Label} + } else if cerr, ok := isSQLConstraintError(err); ok { + err = cerr + } + return 0, err + } + return n, nil +} + +// GoodsUpdateOne is the builder for updating a single Goods entity. +type GoodsUpdateOne struct { + config + hooks []Hook + mutation *GoodsMutation +} + +// Mutation returns the GoodsMutation object of the builder. +func (guo *GoodsUpdateOne) Mutation() *GoodsMutation { + return guo.mutation +} + +// Save executes the query and returns the updated entity. +func (guo *GoodsUpdateOne) Save(ctx context.Context) (*Goods, error) { + var ( + err error + node *Goods + ) + if len(guo.hooks) == 0 { + node, err = guo.sqlSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + guo.mutation = mutation + node, err = guo.sqlSave(ctx) + mutation.done = true + return node, err + }) + for i := len(guo.hooks) - 1; i >= 0; i-- { + mut = guo.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, guo.mutation); err != nil { + return nil, err + } + } + return node, err +} + +// SaveX is like Save, but panics if an error occurs. +func (guo *GoodsUpdateOne) SaveX(ctx context.Context) *Goods { + node, err := guo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (guo *GoodsUpdateOne) Exec(ctx context.Context) error { + _, err := guo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (guo *GoodsUpdateOne) ExecX(ctx context.Context) { + if err := guo.Exec(ctx); err != nil { + panic(err) + } +} + +func (guo *GoodsUpdateOne) sqlSave(ctx context.Context) (_node *Goods, err error) { + _spec := &sqlgraph.UpdateSpec{ + Node: &sqlgraph.NodeSpec{ + Table: goods.Table, + Columns: goods.Columns, + ID: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: goods.FieldID, + }, + }, + } + id, ok := guo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Goods.ID for update")} + } + _spec.Node.ID.Value = id + _node = &Goods{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() + if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{goods.Label} + } else if cerr, ok := isSQLConstraintError(err); ok { + err = cerr + } + return nil, err + } + return _node, nil +} diff --git a/entc/integration/ent/group_create.go b/entc/integration/ent/group_create.go index f4e550ff4..b45321eb9 100644 --- a/entc/integration/ent/group_create.go +++ b/entc/integration/ent/group_create.go @@ -232,7 +232,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -240,13 +240,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -261,7 +261,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldActive, }) - gr.Active = value + _node.Active = value } if value, ok := gc.mutation.Expire(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -269,7 +269,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldExpire, }) - gr.Expire = value + _node.Expire = value } if value, ok := gc.mutation.GetType(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -277,7 +277,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldType, }) - gr.Type = &value + _node.Type = &value } if value, ok := gc.mutation.MaxUsers(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -285,7 +285,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldMaxUsers, }) - gr.MaxUsers = value + _node.MaxUsers = value } if value, ok := gc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -293,7 +293,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldName, }) - gr.Name = value + _node.Name = value } if nodes := gc.mutation.FilesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -371,7 +371,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/entc/integration/ent/group_query.go b/entc/integration/ent/group_query.go index eacd20ae2..f7af67a0e 100644 --- a/entc/integration/ent/group_query.go +++ b/entc/integration/ent/group_query.go @@ -156,23 +156,23 @@ func (gq *GroupQuery) QueryInfo() *GroupInfoQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -199,13 +199,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -215,11 +215,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -258,11 +258,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/entc/integration/ent/group_update.go b/entc/integration/ent/group_update.go index fd9024bad..9be03fdb0 100644 --- a/entc/integration/ent/group_update.go +++ b/entc/integration/ent/group_update.go @@ -846,11 +846,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -889,7 +889,7 @@ func (guo *GroupUpdateOne) check() error { return nil } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -1156,9 +1156,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -1167,5 +1167,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/entc/integration/ent/groupinfo_create.go b/entc/integration/ent/groupinfo_create.go index 3d3d9fdcb..07d9339ae 100644 --- a/entc/integration/ent/groupinfo_create.go +++ b/entc/integration/ent/groupinfo_create.go @@ -129,7 +129,7 @@ func (gic *GroupInfoCreate) check() error { } func (gic *GroupInfoCreate) sqlSave(ctx context.Context) (*GroupInfo, error) { - gi, _spec := gic.createSpec() + _node, _spec := gic.createSpec() if err := sqlgraph.CreateNode(ctx, gic.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -137,13 +137,13 @@ func (gic *GroupInfoCreate) sqlSave(ctx context.Context) (*GroupInfo, error) { return nil, err } id := _spec.ID.Value.(int64) - gi.ID = int(id) - return gi, nil + _node.ID = int(id) + return _node, nil } func (gic *GroupInfoCreate) createSpec() (*GroupInfo, *sqlgraph.CreateSpec) { var ( - gi = &GroupInfo{config: gic.config} + _node = &GroupInfo{config: gic.config} _spec = &sqlgraph.CreateSpec{ Table: groupinfo.Table, ID: &sqlgraph.FieldSpec{ @@ -158,7 +158,7 @@ func (gic *GroupInfoCreate) createSpec() (*GroupInfo, *sqlgraph.CreateSpec) { Value: value, Column: groupinfo.FieldDesc, }) - gi.Desc = value + _node.Desc = value } if value, ok := gic.mutation.MaxUsers(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -166,7 +166,7 @@ func (gic *GroupInfoCreate) createSpec() (*GroupInfo, *sqlgraph.CreateSpec) { Value: value, Column: groupinfo.FieldMaxUsers, }) - gi.MaxUsers = value + _node.MaxUsers = value } if nodes := gic.mutation.GroupsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -187,7 +187,7 @@ func (gic *GroupInfoCreate) createSpec() (*GroupInfo, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gi, _spec + return _node, _spec } // GroupInfoCreateBulk is the builder for creating a bulk of GroupInfo entities. diff --git a/entc/integration/ent/groupinfo_query.go b/entc/integration/ent/groupinfo_query.go index 3551bbe1b..3d8b62b2f 100644 --- a/entc/integration/ent/groupinfo_query.go +++ b/entc/integration/ent/groupinfo_query.go @@ -84,23 +84,23 @@ func (giq *GroupInfoQuery) QueryGroups() *GroupQuery { // First returns the first GroupInfo entity in the query. Returns *NotFoundError when no groupinfo was found. func (giq *GroupInfoQuery) First(ctx context.Context) (*GroupInfo, error) { - gis, err := giq.Limit(1).All(ctx) + nodes, err := giq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(gis) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{groupinfo.Label} } - return gis[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (giq *GroupInfoQuery) FirstX(ctx context.Context) *GroupInfo { - gi, err := giq.First(ctx) + node, err := giq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gi + return node } // FirstID returns the first GroupInfo id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (giq *GroupInfoQuery) FirstXID(ctx context.Context) int { // Only returns the only GroupInfo entity in the query, returns an error if not exactly one entity was returned. func (giq *GroupInfoQuery) Only(ctx context.Context) (*GroupInfo, error) { - gis, err := giq.Limit(2).All(ctx) + nodes, err := giq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(gis) { + switch len(nodes) { case 1: - return gis[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{groupinfo.Label} default: @@ -143,11 +143,11 @@ func (giq *GroupInfoQuery) Only(ctx context.Context) (*GroupInfo, error) { // OnlyX is like Only, but panics if an error occurs. func (giq *GroupInfoQuery) OnlyX(ctx context.Context) *GroupInfo { - gi, err := giq.Only(ctx) + node, err := giq.Only(ctx) if err != nil { panic(err) } - return gi + return node } // OnlyID returns the only GroupInfo id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (giq *GroupInfoQuery) All(ctx context.Context) ([]*GroupInfo, error) { // AllX is like All, but panics if an error occurs. func (giq *GroupInfoQuery) AllX(ctx context.Context) []*GroupInfo { - gis, err := giq.All(ctx) + nodes, err := giq.All(ctx) if err != nil { panic(err) } - return gis + return nodes } // IDs executes the query and returns a list of GroupInfo ids. diff --git a/entc/integration/ent/groupinfo_update.go b/entc/integration/ent/groupinfo_update.go index 263532bd6..3af75a562 100644 --- a/entc/integration/ent/groupinfo_update.go +++ b/entc/integration/ent/groupinfo_update.go @@ -361,11 +361,11 @@ func (giuo *GroupInfoUpdateOne) Save(ctx context.Context) (*GroupInfo, error) { // SaveX is like Save, but panics if an error occurs. func (giuo *GroupInfoUpdateOne) SaveX(ctx context.Context) *GroupInfo { - gi, err := giuo.Save(ctx) + node, err := giuo.Save(ctx) if err != nil { panic(err) } - return gi + return node } // Exec executes the query on the entity. @@ -381,7 +381,7 @@ func (giuo *GroupInfoUpdateOne) ExecX(ctx context.Context) { } } -func (giuo *GroupInfoUpdateOne) sqlSave(ctx context.Context) (gi *GroupInfo, err error) { +func (giuo *GroupInfoUpdateOne) sqlSave(ctx context.Context) (_node *GroupInfo, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: groupinfo.Table, @@ -472,9 +472,9 @@ func (giuo *GroupInfoUpdateOne) sqlSave(ctx context.Context) (gi *GroupInfo, err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gi = &GroupInfo{config: giuo.config} - _spec.Assign = gi.assignValues - _spec.ScanValues = gi.scanValues() + _node = &GroupInfo{config: giuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, giuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{groupinfo.Label} @@ -483,5 +483,5 @@ func (giuo *GroupInfoUpdateOne) sqlSave(ctx context.Context) (gi *GroupInfo, err } return nil, err } - return gi, nil + return _node, nil } diff --git a/entc/integration/ent/hook/hook.go b/entc/integration/ent/hook/hook.go index 55414623f..1d73ed22f 100644 --- a/entc/integration/ent/hook/hook.go +++ b/entc/integration/ent/hook/hook.go @@ -78,6 +78,19 @@ func (f FileTypeFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, er return f(ctx, mv) } +// The GoodsFunc type is an adapter to allow the use of ordinary +// function as Goods mutator. +type GoodsFunc func(context.Context, *ent.GoodsMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f GoodsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + mv, ok := m.(*ent.GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GoodsMutation", m) + } + return f(ctx, mv) +} + // The GroupFunc type is an adapter to allow the use of ordinary // function as Group mutator. type GroupFunc func(context.Context, *ent.GroupMutation) (ent.Value, error) diff --git a/entc/integration/ent/item_create.go b/entc/integration/ent/item_create.go index 01371ef4c..bc65d3643 100644 --- a/entc/integration/ent/item_create.go +++ b/entc/integration/ent/item_create.go @@ -77,7 +77,7 @@ func (ic *ItemCreate) check() error { } func (ic *ItemCreate) sqlSave(ctx context.Context) (*Item, error) { - i, _spec := ic.createSpec() + _node, _spec := ic.createSpec() if err := sqlgraph.CreateNode(ctx, ic.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -85,13 +85,13 @@ func (ic *ItemCreate) sqlSave(ctx context.Context) (*Item, error) { return nil, err } id := _spec.ID.Value.(int64) - i.ID = int(id) - return i, nil + _node.ID = int(id) + return _node, nil } func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { var ( - i = &Item{config: ic.config} + _node = &Item{config: ic.config} _spec = &sqlgraph.CreateSpec{ Table: item.Table, ID: &sqlgraph.FieldSpec{ @@ -100,7 +100,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { }, } ) - return i, _spec + return _node, _spec } // ItemCreateBulk is the builder for creating a bulk of Item entities. diff --git a/entc/integration/ent/item_query.go b/entc/integration/ent/item_query.go index d05059a2b..3f9bebdf6 100644 --- a/entc/integration/ent/item_query.go +++ b/entc/integration/ent/item_query.go @@ -58,23 +58,23 @@ func (iq *ItemQuery) Order(o ...OrderFunc) *ItemQuery { // First returns the first Item entity in the query. Returns *NotFoundError when no item was found. func (iq *ItemQuery) First(ctx context.Context) (*Item, error) { - is, err := iq.Limit(1).All(ctx) + nodes, err := iq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(is) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{item.Label} } - return is[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (iq *ItemQuery) FirstX(ctx context.Context) *Item { - i, err := iq.First(ctx) + node, err := iq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return i + return node } // FirstID returns the first Item id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (iq *ItemQuery) FirstXID(ctx context.Context) int { // Only returns the only Item entity in the query, returns an error if not exactly one entity was returned. func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) { - is, err := iq.Limit(2).All(ctx) + nodes, err := iq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(is) { + switch len(nodes) { case 1: - return is[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{item.Label} default: @@ -117,11 +117,11 @@ func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) { // OnlyX is like Only, but panics if an error occurs. func (iq *ItemQuery) OnlyX(ctx context.Context) *Item { - i, err := iq.Only(ctx) + node, err := iq.Only(ctx) if err != nil { panic(err) } - return i + return node } // OnlyID returns the only Item id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (iq *ItemQuery) All(ctx context.Context) ([]*Item, error) { // AllX is like All, but panics if an error occurs. func (iq *ItemQuery) AllX(ctx context.Context) []*Item { - is, err := iq.All(ctx) + nodes, err := iq.All(ctx) if err != nil { panic(err) } - return is + return nodes } // IDs executes the query and returns a list of Item ids. diff --git a/entc/integration/ent/item_update.go b/entc/integration/ent/item_update.go index d15fcf133..ac845e8db 100644 --- a/entc/integration/ent/item_update.go +++ b/entc/integration/ent/item_update.go @@ -159,11 +159,11 @@ func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) { // SaveX is like Save, but panics if an error occurs. func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item { - i, err := iuo.Save(ctx) + node, err := iuo.Save(ctx) if err != nil { panic(err) } - return i + return node } // Exec executes the query on the entity. @@ -179,7 +179,7 @@ func (iuo *ItemUpdateOne) ExecX(ctx context.Context) { } } -func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (i *Item, err error) { +func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: item.Table, @@ -195,9 +195,9 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (i *Item, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Item.ID for update")} } _spec.Node.ID.Value = id - i = &Item{config: iuo.config} - _spec.Assign = i.assignValues - _spec.ScanValues = i.scanValues() + _node = &Item{config: iuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, iuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{item.Label} @@ -206,5 +206,5 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (i *Item, err error) { } return nil, err } - return i, nil + return _node, nil } diff --git a/entc/integration/ent/migrate/schema.go b/entc/integration/ent/migrate/schema.go index 059b11999..55c50c650 100644 --- a/entc/integration/ent/migrate/schema.go +++ b/entc/integration/ent/migrate/schema.go @@ -197,6 +197,17 @@ var ( PrimaryKey: []*schema.Column{FileTypesColumns[0]}, ForeignKeys: []*schema.ForeignKey{}, } + // GoodsColumns holds the columns for the "goods" table. + GoodsColumns = []*schema.Column{ + {Name: "id", Type: field.TypeInt, Increment: true}, + } + // GoodsTable holds the schema information for the "goods" table. + GoodsTable = &schema.Table{ + Name: "goods", + Columns: GoodsColumns, + PrimaryKey: []*schema.Column{GoodsColumns[0]}, + ForeignKeys: []*schema.ForeignKey{}, + } // GroupsColumns holds the columns for the "groups" table. GroupsColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, @@ -486,6 +497,7 @@ var ( FieldTypesTable, FilesTable, FileTypesTable, + GoodsTable, GroupsTable, GroupInfosTable, ItemsTable, diff --git a/entc/integration/ent/mutation.go b/entc/integration/ent/mutation.go index c19aaf5d4..f811e10c5 100644 --- a/entc/integration/ent/mutation.go +++ b/entc/integration/ent/mutation.go @@ -47,6 +47,7 @@ const ( TypeFieldType = "FieldType" TypeFile = "File" TypeFileType = "FileType" + TypeGoods = "Goods" TypeGroup = "Group" TypeGroupInfo = "GroupInfo" TypeItem = "Item" @@ -6971,6 +6972,236 @@ func (m *FileTypeMutation) ResetEdge(name string) error { return fmt.Errorf("unknown FileType edge %s", name) } +// GoodsMutation represents an operation that mutate the GoodsSlice +// nodes in the graph. +type GoodsMutation struct { + config + op Op + typ string + id *int + clearedFields map[string]struct{} + done bool + oldValue func(context.Context) (*Goods, error) +} + +var _ ent.Mutation = (*GoodsMutation)(nil) + +// goodsOption allows to manage the mutation configuration using functional options. +type goodsOption func(*GoodsMutation) + +// newGoodsMutation creates new mutation for $n.Name. +func newGoodsMutation(c config, op Op, opts ...goodsOption) *GoodsMutation { + m := &GoodsMutation{ + config: c, + op: op, + typ: TypeGoods, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withGoodsID sets the id field of the mutation. +func withGoodsID(id int) goodsOption { + return func(m *GoodsMutation) { + var ( + err error + once sync.Once + value *Goods + ) + m.oldValue = func(ctx context.Context) (*Goods, error) { + once.Do(func() { + if m.done { + err = fmt.Errorf("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Goods.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withGoods sets the old Goods of the mutation. +func withGoods(node *Goods) goodsOption { + return func(m *GoodsMutation) { + m.oldValue = func(context.Context) (*Goods, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m GoodsMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m GoodsMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, fmt.Errorf("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the id value in the mutation. Note that, the id +// is available only if it was provided to the builder. +func (m *GoodsMutation) ID() (id int, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// Op returns the operation name. +func (m *GoodsMutation) Op() Op { + return m.op +} + +// Type returns the node type of this mutation (Goods). +func (m *GoodsMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during +// this mutation. Note that, in order to get all numeric +// fields that were in/decremented, call AddedFields(). +func (m *GoodsMutation) Fields() []string { + fields := make([]string, 0, 0) + return fields +} + +// Field returns the value of a field with the given name. +// The second boolean value indicates that this field was +// not set, or was not define in the schema. +func (m *GoodsMutation) Field(name string) (ent.Value, bool) { + return nil, false +} + +// OldField returns the old value of the field from the database. +// An error is returned if the mutation operation is not UpdateOne, +// or the query to the database was failed. +func (m *GoodsMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + return nil, fmt.Errorf("unknown Goods field %s", name) +} + +// SetField sets the value for the given name. It returns an +// error if the field is not defined in the schema, or if the +// type mismatch the field type. +func (m *GoodsMutation) SetField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown Goods field %s", name) +} + +// AddedFields returns all numeric fields that were incremented +// or decremented during this mutation. +func (m *GoodsMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was in/decremented +// from a field with the given name. The second value indicates +// that this field was not set, or was not define in the schema. +func (m *GoodsMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value for the given name. It returns an +// error if the field is not defined in the schema, or if the +// type mismatch the field type. +func (m *GoodsMutation) AddField(name string, value ent.Value) error { + return fmt.Errorf("unknown Goods numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared +// during this mutation. +func (m *GoodsMutation) ClearedFields() []string { + return nil +} + +// FieldCleared returns a boolean indicates if this field was +// cleared in this mutation. +func (m *GoodsMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value for the given name. It returns an +// error if the field is not defined in the schema. +func (m *GoodsMutation) ClearField(name string) error { + return fmt.Errorf("unknown Goods nullable field %s", name) +} + +// ResetField resets all changes in the mutation regarding the +// given field name. It returns an error if the field is not +// defined in the schema. +func (m *GoodsMutation) ResetField(name string) error { + return fmt.Errorf("unknown Goods field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this +// mutation. +func (m *GoodsMutation) AddedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// AddedIDs returns all ids (to other nodes) that were added for +// the given edge name. +func (m *GoodsMutation) AddedIDs(name string) []ent.Value { + return nil +} + +// RemovedEdges returns all edge names that were removed in this +// mutation. +func (m *GoodsMutation) RemovedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// RemovedIDs returns all ids (to other nodes) that were removed for +// the given edge name. +func (m *GoodsMutation) RemovedIDs(name string) []ent.Value { + return nil +} + +// ClearedEdges returns all edge names that were cleared in this +// mutation. +func (m *GoodsMutation) ClearedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// EdgeCleared returns a boolean indicates if this edge was +// cleared in this mutation. +func (m *GoodsMutation) EdgeCleared(name string) bool { + return false +} + +// ClearEdge clears the value for the given name. It returns an +// error if the edge name is not defined in the schema. +func (m *GoodsMutation) ClearEdge(name string) error { + return fmt.Errorf("unknown Goods unique edge %s", name) +} + +// ResetEdge resets all changes in the mutation regarding the +// given edge name. It returns an error if the edge is not +// defined in the schema. +func (m *GoodsMutation) ResetEdge(name string) error { + return fmt.Errorf("unknown Goods edge %s", name) +} + // GroupMutation represents an operation that mutate the Groups // nodes in the graph. type GroupMutation struct { diff --git a/entc/integration/ent/node_create.go b/entc/integration/ent/node_create.go index 23c68a489..d79dd0b8b 100644 --- a/entc/integration/ent/node_create.go +++ b/entc/integration/ent/node_create.go @@ -129,7 +129,7 @@ func (nc *NodeCreate) check() error { } func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { - n, _spec := nc.createSpec() + _node, _spec := nc.createSpec() if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -137,13 +137,13 @@ func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { return nil, err } id := _spec.ID.Value.(int64) - n.ID = int(id) - return n, nil + _node.ID = int(id) + return _node, nil } func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { var ( - n = &Node{config: nc.config} + _node = &Node{config: nc.config} _spec = &sqlgraph.CreateSpec{ Table: node.Table, ID: &sqlgraph.FieldSpec{ @@ -158,7 +158,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { Value: value, Column: node.FieldValue, }) - n.Value = value + _node.Value = value } if nodes := nc.mutation.PrevIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -198,7 +198,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return n, _spec + return _node, _spec } // NodeCreateBulk is the builder for creating a bulk of Node entities. diff --git a/entc/integration/ent/node_query.go b/entc/integration/ent/node_query.go index c55862b7e..95f15ef1d 100644 --- a/entc/integration/ent/node_query.go +++ b/entc/integration/ent/node_query.go @@ -107,23 +107,23 @@ func (nq *NodeQuery) QueryNext() *NodeQuery { // First returns the first Node entity in the query. Returns *NotFoundError when no node was found. func (nq *NodeQuery) First(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(1).All(ctx) + nodes, err := nq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ns) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{node.Label} } - return ns[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (nq *NodeQuery) FirstX(ctx context.Context) *Node { - n, err := nq.First(ctx) + node, err := nq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return n + return node } // FirstID returns the first Node id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (nq *NodeQuery) FirstXID(ctx context.Context) int { // Only returns the only Node entity in the query, returns an error if not exactly one entity was returned. func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(2).All(ctx) + nodes, err := nq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ns) { + switch len(nodes) { case 1: - return ns[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{node.Label} default: @@ -166,11 +166,11 @@ func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { // OnlyX is like Only, but panics if an error occurs. func (nq *NodeQuery) OnlyX(ctx context.Context) *Node { - n, err := nq.Only(ctx) + node, err := nq.Only(ctx) if err != nil { panic(err) } - return n + return node } // OnlyID returns the only Node id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { // AllX is like All, but panics if an error occurs. func (nq *NodeQuery) AllX(ctx context.Context) []*Node { - ns, err := nq.All(ctx) + nodes, err := nq.All(ctx) if err != nil { panic(err) } - return ns + return nodes } // IDs executes the query and returns a list of Node ids. diff --git a/entc/integration/ent/node_update.go b/entc/integration/ent/node_update.go index 825ffe9fa..e44b43c15 100644 --- a/entc/integration/ent/node_update.go +++ b/entc/integration/ent/node_update.go @@ -403,11 +403,11 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { // SaveX is like Save, but panics if an error occurs. func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node { - n, err := nuo.Save(ctx) + node, err := nuo.Save(ctx) if err != nil { panic(err) } - return n + return node } // Exec executes the query on the entity. @@ -423,7 +423,7 @@ func (nuo *NodeUpdateOne) ExecX(ctx context.Context) { } } -func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { +func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: node.Table, @@ -529,9 +529,9 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - n = &Node{config: nuo.config} - _spec.Assign = n.assignValues - _spec.ScanValues = n.scanValues() + _node = &Node{config: nuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{node.Label} @@ -540,5 +540,5 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } return nil, err } - return n, nil + return _node, nil } diff --git a/entc/integration/ent/pet_create.go b/entc/integration/ent/pet_create.go index 3ddb17c41..8273d672f 100644 --- a/entc/integration/ent/pet_create.go +++ b/entc/integration/ent/pet_create.go @@ -126,7 +126,7 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -134,13 +134,13 @@ func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { return nil, err } id := _spec.ID.Value.(int64) - pe.ID = int(id) - return pe, nil + _node.ID = int(id) + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -155,7 +155,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { Value: value, Column: pet.FieldName, }) - pe.Name = value + _node.Name = value } if nodes := pc.mutation.TeamIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -195,7 +195,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/entc/integration/ent/pet_query.go b/entc/integration/ent/pet_query.go index 3191586a9..a86c9f606 100644 --- a/entc/integration/ent/pet_query.go +++ b/entc/integration/ent/pet_query.go @@ -107,23 +107,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) int { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -166,11 +166,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/entc/integration/ent/pet_update.go b/entc/integration/ent/pet_update.go index dcc28ab29..419a56569 100644 --- a/entc/integration/ent/pet_update.go +++ b/entc/integration/ent/pet_update.go @@ -349,11 +349,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -369,7 +369,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -462,9 +462,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -473,5 +473,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/entc/integration/ent/predicate/predicate.go b/entc/integration/ent/predicate/predicate.go index 18b4a3085..b32d9bb5d 100644 --- a/entc/integration/ent/predicate/predicate.go +++ b/entc/integration/ent/predicate/predicate.go @@ -25,6 +25,9 @@ type File func(*sql.Selector) // FileType is the predicate function for filetype builders. type FileType func(*sql.Selector) +// Goods is the predicate function for goods builders. +type Goods func(*sql.Selector) + // Group is the predicate function for group builders. type Group func(*sql.Selector) diff --git a/entc/integration/ent/privacy/privacy.go b/entc/integration/ent/privacy/privacy.go index c2e69df18..4417b5c5c 100644 --- a/entc/integration/ent/privacy/privacy.go +++ b/entc/integration/ent/privacy/privacy.go @@ -334,6 +334,30 @@ func (f FileTypeMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutati return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.FileTypeMutation", m) } +// The GoodsQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type GoodsQueryRuleFunc func(context.Context, *ent.GoodsQuery) error + +// EvalQuery return f(ctx, q). +func (f GoodsQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.GoodsQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.GoodsQuery", q) +} + +// The GoodsMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type GoodsMutationRuleFunc func(context.Context, *ent.GoodsMutation) error + +// EvalMutation calls f(ctx, m). +func (f GoodsMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.GoodsMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.GoodsMutation", m) +} + // The GroupQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type GroupQueryRuleFunc func(context.Context, *ent.GroupQuery) error diff --git a/entc/integration/ent/schema/goods.go b/entc/integration/ent/schema/goods.go new file mode 100644 index 000000000..be5d53d89 --- /dev/null +++ b/entc/integration/ent/schema/goods.go @@ -0,0 +1,22 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +package schema + +import "github.com/facebook/ent" + +// Goods holds the schema definition for the Goods entity. +type Goods struct { + ent.Schema +} + +// Fields of the Goods. +func (Goods) Fields() []ent.Field { + return nil +} + +// Edges of the Goods. +func (Goods) Edges() []ent.Edge { + return nil +} diff --git a/entc/integration/ent/spec_create.go b/entc/integration/ent/spec_create.go index db164dcb9..1ff71bc88 100644 --- a/entc/integration/ent/spec_create.go +++ b/entc/integration/ent/spec_create.go @@ -93,7 +93,7 @@ func (sc *SpecCreate) check() error { } func (sc *SpecCreate) sqlSave(ctx context.Context) (*Spec, error) { - s, _spec := sc.createSpec() + _node, _spec := sc.createSpec() if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -101,13 +101,13 @@ func (sc *SpecCreate) sqlSave(ctx context.Context) (*Spec, error) { return nil, err } id := _spec.ID.Value.(int64) - s.ID = int(id) - return s, nil + _node.ID = int(id) + return _node, nil } func (sc *SpecCreate) createSpec() (*Spec, *sqlgraph.CreateSpec) { var ( - s = &Spec{config: sc.config} + _node = &Spec{config: sc.config} _spec = &sqlgraph.CreateSpec{ Table: spec.Table, ID: &sqlgraph.FieldSpec{ @@ -135,7 +135,7 @@ func (sc *SpecCreate) createSpec() (*Spec, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return s, _spec + return _node, _spec } // SpecCreateBulk is the builder for creating a bulk of Spec entities. diff --git a/entc/integration/ent/spec_query.go b/entc/integration/ent/spec_query.go index eff489581..b17a8302d 100644 --- a/entc/integration/ent/spec_query.go +++ b/entc/integration/ent/spec_query.go @@ -84,23 +84,23 @@ func (sq *SpecQuery) QueryCard() *CardQuery { // First returns the first Spec entity in the query. Returns *NotFoundError when no spec was found. func (sq *SpecQuery) First(ctx context.Context) (*Spec, error) { - sSlice, err := sq.Limit(1).All(ctx) + nodes, err := sq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(sSlice) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{spec.Label} } - return sSlice[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (sq *SpecQuery) FirstX(ctx context.Context) *Spec { - s, err := sq.First(ctx) + node, err := sq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return s + return node } // FirstID returns the first Spec id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (sq *SpecQuery) FirstXID(ctx context.Context) int { // Only returns the only Spec entity in the query, returns an error if not exactly one entity was returned. func (sq *SpecQuery) Only(ctx context.Context) (*Spec, error) { - sSlice, err := sq.Limit(2).All(ctx) + nodes, err := sq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(sSlice) { + switch len(nodes) { case 1: - return sSlice[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{spec.Label} default: @@ -143,11 +143,11 @@ func (sq *SpecQuery) Only(ctx context.Context) (*Spec, error) { // OnlyX is like Only, but panics if an error occurs. func (sq *SpecQuery) OnlyX(ctx context.Context) *Spec { - s, err := sq.Only(ctx) + node, err := sq.Only(ctx) if err != nil { panic(err) } - return s + return node } // OnlyID returns the only Spec id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (sq *SpecQuery) All(ctx context.Context) ([]*Spec, error) { // AllX is like All, but panics if an error occurs. func (sq *SpecQuery) AllX(ctx context.Context) []*Spec { - sSlice, err := sq.All(ctx) + nodes, err := sq.All(ctx) if err != nil { panic(err) } - return sSlice + return nodes } // IDs executes the query and returns a list of Spec ids. diff --git a/entc/integration/ent/spec_update.go b/entc/integration/ent/spec_update.go index 70264d50a..45d6e6dbb 100644 --- a/entc/integration/ent/spec_update.go +++ b/entc/integration/ent/spec_update.go @@ -286,11 +286,11 @@ func (suo *SpecUpdateOne) Save(ctx context.Context) (*Spec, error) { // SaveX is like Save, but panics if an error occurs. func (suo *SpecUpdateOne) SaveX(ctx context.Context) *Spec { - s, err := suo.Save(ctx) + node, err := suo.Save(ctx) if err != nil { panic(err) } - return s + return node } // Exec executes the query on the entity. @@ -306,7 +306,7 @@ func (suo *SpecUpdateOne) ExecX(ctx context.Context) { } } -func (suo *SpecUpdateOne) sqlSave(ctx context.Context) (s *Spec, err error) { +func (suo *SpecUpdateOne) sqlSave(ctx context.Context) (_node *Spec, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: spec.Table, @@ -376,9 +376,9 @@ func (suo *SpecUpdateOne) sqlSave(ctx context.Context) (s *Spec, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - s = &Spec{config: suo.config} - _spec.Assign = s.assignValues - _spec.ScanValues = s.scanValues() + _node = &Spec{config: suo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{spec.Label} @@ -387,5 +387,5 @@ func (suo *SpecUpdateOne) sqlSave(ctx context.Context) (s *Spec, err error) { } return nil, err } - return s, nil + return _node, nil } diff --git a/entc/integration/ent/task_create.go b/entc/integration/ent/task_create.go index c8ab2c362..15c535866 100644 --- a/entc/integration/ent/task_create.go +++ b/entc/integration/ent/task_create.go @@ -110,7 +110,7 @@ func (tc *TaskCreate) check() error { } func (tc *TaskCreate) sqlSave(ctx context.Context) (*Task, error) { - t, _spec := tc.createSpec() + _node, _spec := tc.createSpec() if err := sqlgraph.CreateNode(ctx, tc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -118,13 +118,13 @@ func (tc *TaskCreate) sqlSave(ctx context.Context) (*Task, error) { return nil, err } id := _spec.ID.Value.(int64) - t.ID = int(id) - return t, nil + _node.ID = int(id) + return _node, nil } func (tc *TaskCreate) createSpec() (*Task, *sqlgraph.CreateSpec) { var ( - t = &Task{config: tc.config} + _node = &Task{config: tc.config} _spec = &sqlgraph.CreateSpec{ Table: task.Table, ID: &sqlgraph.FieldSpec{ @@ -139,9 +139,9 @@ func (tc *TaskCreate) createSpec() (*Task, *sqlgraph.CreateSpec) { Value: value, Column: task.FieldPriority, }) - t.Priority = value + _node.Priority = value } - return t, _spec + return _node, _spec } // TaskCreateBulk is the builder for creating a bulk of Task entities. diff --git a/entc/integration/ent/task_query.go b/entc/integration/ent/task_query.go index afab5ceb8..64fed5bbf 100644 --- a/entc/integration/ent/task_query.go +++ b/entc/integration/ent/task_query.go @@ -58,23 +58,23 @@ func (tq *TaskQuery) Order(o ...OrderFunc) *TaskQuery { // First returns the first Task entity in the query. Returns *NotFoundError when no task was found. func (tq *TaskQuery) First(ctx context.Context) (*Task, error) { - ts, err := tq.Limit(1).All(ctx) + nodes, err := tq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{task.Label} } - return ts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (tq *TaskQuery) FirstX(ctx context.Context) *Task { - t, err := tq.First(ctx) + node, err := tq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return t + return node } // FirstID returns the first Task id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (tq *TaskQuery) FirstXID(ctx context.Context) int { // Only returns the only Task entity in the query, returns an error if not exactly one entity was returned. func (tq *TaskQuery) Only(ctx context.Context) (*Task, error) { - ts, err := tq.Limit(2).All(ctx) + nodes, err := tq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ts) { + switch len(nodes) { case 1: - return ts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{task.Label} default: @@ -117,11 +117,11 @@ func (tq *TaskQuery) Only(ctx context.Context) (*Task, error) { // OnlyX is like Only, but panics if an error occurs. func (tq *TaskQuery) OnlyX(ctx context.Context) *Task { - t, err := tq.Only(ctx) + node, err := tq.Only(ctx) if err != nil { panic(err) } - return t + return node } // OnlyID returns the only Task id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error) { // AllX is like All, but panics if an error occurs. func (tq *TaskQuery) AllX(ctx context.Context) []*Task { - ts, err := tq.All(ctx) + nodes, err := tq.All(ctx) if err != nil { panic(err) } - return ts + return nodes } // IDs executes the query and returns a list of Task ids. diff --git a/entc/integration/ent/task_update.go b/entc/integration/ent/task_update.go index 9ba74a125..2c146f70b 100644 --- a/entc/integration/ent/task_update.go +++ b/entc/integration/ent/task_update.go @@ -238,11 +238,11 @@ func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error) { // SaveX is like Save, but panics if an error occurs. func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task { - t, err := tuo.Save(ctx) + node, err := tuo.Save(ctx) if err != nil { panic(err) } - return t + return node } // Exec executes the query on the entity. @@ -268,7 +268,7 @@ func (tuo *TaskUpdateOne) check() error { return nil } -func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (t *Task, err error) { +func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (_node *Task, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: task.Table, @@ -298,9 +298,9 @@ func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (t *Task, err error) { Column: task.FieldPriority, }) } - t = &Task{config: tuo.config} - _spec.Assign = t.assignValues - _spec.ScanValues = t.scanValues() + _node = &Task{config: tuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, tuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{task.Label} @@ -309,5 +309,5 @@ func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (t *Task, err error) { } return nil, err } - return t, nil + return _node, nil } diff --git a/entc/integration/ent/tx.go b/entc/integration/ent/tx.go index 814d4722d..31d102433 100644 --- a/entc/integration/ent/tx.go +++ b/entc/integration/ent/tx.go @@ -26,6 +26,8 @@ type Tx struct { File *FileClient // FileType is the client for interacting with the FileType builders. FileType *FileTypeClient + // Goods is the client for interacting with the Goods builders. + Goods *GoodsClient // Group is the client for interacting with the Group builders. Group *GroupClient // GroupInfo is the client for interacting with the GroupInfo builders. @@ -182,6 +184,7 @@ func (tx *Tx) init() { tx.FieldType = NewFieldTypeClient(tx.config) tx.File = NewFileClient(tx.config) tx.FileType = NewFileTypeClient(tx.config) + tx.Goods = NewGoodsClient(tx.config) tx.Group = NewGroupClient(tx.config) tx.GroupInfo = NewGroupInfoClient(tx.config) tx.Item = NewItemClient(tx.config) diff --git a/entc/integration/ent/user_create.go b/entc/integration/ent/user_create.go index 33bdc4f16..4eae4ed32 100644 --- a/entc/integration/ent/user_create.go +++ b/entc/integration/ent/user_create.go @@ -408,7 +408,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -416,13 +416,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -437,7 +437,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldOptionalInt, }) - u.OptionalInt = value + _node.OptionalInt = value } if value, ok := uc.mutation.Age(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -445,7 +445,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -453,7 +453,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if value, ok := uc.mutation.Last(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -461,7 +461,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldLast, }) - u.Last = value + _node.Last = value } if value, ok := uc.mutation.Nickname(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -469,7 +469,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldNickname, }) - u.Nickname = value + _node.Nickname = value } if value, ok := uc.mutation.Phone(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -477,7 +477,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldPhone, }) - u.Phone = value + _node.Phone = value } if value, ok := uc.mutation.Password(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -485,7 +485,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldPassword, }) - u.Password = value + _node.Password = value } if value, ok := uc.mutation.Role(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -493,7 +493,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldRole, }) - u.Role = value + _node.Role = value } if value, ok := uc.mutation.SSOCert(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -501,7 +501,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldSSOCert, }) - u.SSOCert = value + _node.SSOCert = value } if nodes := uc.mutation.CardIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -712,7 +712,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/ent/user_query.go b/entc/integration/ent/user_query.go index 7c6946b8f..35748901d 100644 --- a/entc/integration/ent/user_query.go +++ b/entc/integration/ent/user_query.go @@ -318,23 +318,23 @@ func (uq *UserQuery) QueryParent() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -361,13 +361,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -377,11 +377,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -420,11 +420,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/ent/user_update.go b/entc/integration/ent/user_update.go index 74bc31ee6..5ef142d81 100644 --- a/entc/integration/ent/user_update.go +++ b/entc/integration/ent/user_update.go @@ -1827,11 +1827,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -1862,7 +1862,7 @@ func (uuo *UserUpdateOne) check() error { return nil } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -2503,9 +2503,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -2514,5 +2514,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/gremlin/ent/card_query.go b/entc/integration/gremlin/ent/card_query.go index 05887ab9d..220a7f880 100644 --- a/entc/integration/gremlin/ent/card_query.go +++ b/entc/integration/gremlin/ent/card_query.go @@ -92,23 +92,23 @@ func (cq *CardQuery) QuerySpec() *SpecQuery { // First returns the first Card entity in the query. Returns *NotFoundError when no card was found. func (cq *CardQuery) First(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{card.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CardQuery) FirstX(ctx context.Context) *Card { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Card id in the query. Returns *NotFoundError when no id was found. @@ -135,13 +135,13 @@ func (cq *CardQuery) FirstXID(ctx context.Context) string { // Only returns the only Card entity in the query, returns an error if not exactly one entity was returned. func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{card.Label} default: @@ -151,11 +151,11 @@ func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CardQuery) OnlyX(ctx context.Context) *Card { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Card id in the query, returns an error if not exactly one id was returned. @@ -194,11 +194,11 @@ func (cq *CardQuery) All(ctx context.Context) ([]*Card, error) { // AllX is like All, but panics if an error occurs. func (cq *CardQuery) AllX(ctx context.Context) []*Card { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Card ids. diff --git a/entc/integration/gremlin/ent/card_update.go b/entc/integration/gremlin/ent/card_update.go index 1ca1ab3e7..4862d0466 100644 --- a/entc/integration/gremlin/ent/card_update.go +++ b/entc/integration/gremlin/ent/card_update.go @@ -402,11 +402,11 @@ func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/client.go b/entc/integration/gremlin/ent/client.go index fd0354cb7..e475a5a45 100644 --- a/entc/integration/gremlin/ent/client.go +++ b/entc/integration/gremlin/ent/client.go @@ -17,6 +17,7 @@ import ( "github.com/facebook/ent/entc/integration/gremlin/ent/fieldtype" "github.com/facebook/ent/entc/integration/gremlin/ent/file" "github.com/facebook/ent/entc/integration/gremlin/ent/filetype" + "github.com/facebook/ent/entc/integration/gremlin/ent/goods" "github.com/facebook/ent/entc/integration/gremlin/ent/group" "github.com/facebook/ent/entc/integration/gremlin/ent/groupinfo" "github.com/facebook/ent/entc/integration/gremlin/ent/item" @@ -45,6 +46,8 @@ type Client struct { File *FileClient // FileType is the client for interacting with the FileType builders. FileType *FileTypeClient + // Goods is the client for interacting with the Goods builders. + Goods *GoodsClient // Group is the client for interacting with the Group builders. Group *GroupClient // GroupInfo is the client for interacting with the GroupInfo builders. @@ -78,6 +81,7 @@ func (c *Client) init() { c.FieldType = NewFieldTypeClient(c.config) c.File = NewFileClient(c.config) c.FileType = NewFileTypeClient(c.config) + c.Goods = NewGoodsClient(c.config) c.Group = NewGroupClient(c.config) c.GroupInfo = NewGroupInfoClient(c.config) c.Item = NewItemClient(c.config) @@ -132,6 +136,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { FieldType: NewFieldTypeClient(cfg), File: NewFileClient(cfg), FileType: NewFileTypeClient(cfg), + Goods: NewGoodsClient(cfg), Group: NewGroupClient(cfg), GroupInfo: NewGroupInfoClient(cfg), Item: NewItemClient(cfg), @@ -173,6 +178,7 @@ func (c *Client) Use(hooks ...Hook) { c.FieldType.Use(hooks...) c.File.Use(hooks...) c.FileType.Use(hooks...) + c.Goods.Use(hooks...) c.Group.Use(hooks...) c.GroupInfo.Use(hooks...) c.Item.Use(hooks...) @@ -689,6 +695,94 @@ func (c *FileTypeClient) Hooks() []Hook { return c.hooks.FileType } +// GoodsClient is a client for the Goods schema. +type GoodsClient struct { + config +} + +// NewGoodsClient returns a client for the Goods from the given config. +func NewGoodsClient(c config) *GoodsClient { + return &GoodsClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `goods.Hooks(f(g(h())))`. +func (c *GoodsClient) Use(hooks ...Hook) { + c.hooks.Goods = append(c.hooks.Goods, hooks...) +} + +// Create returns a create builder for Goods. +func (c *GoodsClient) Create() *GoodsCreate { + mutation := newGoodsMutation(c.config, OpCreate) + return &GoodsCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// BulkCreate returns a builder for creating a bulk of Goods entities. +func (c *GoodsClient) CreateBulk(builders ...*GoodsCreate) *GoodsCreateBulk { + return &GoodsCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for Goods. +func (c *GoodsClient) Update() *GoodsUpdate { + mutation := newGoodsMutation(c.config, OpUpdate) + return &GoodsUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *GoodsClient) UpdateOne(_go *Goods) *GoodsUpdateOne { + mutation := newGoodsMutation(c.config, OpUpdateOne, withGoods(_go)) + return &GoodsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *GoodsClient) UpdateOneID(id string) *GoodsUpdateOne { + mutation := newGoodsMutation(c.config, OpUpdateOne, withGoodsID(id)) + return &GoodsUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for Goods. +func (c *GoodsClient) Delete() *GoodsDelete { + mutation := newGoodsMutation(c.config, OpDelete) + return &GoodsDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a delete builder for the given entity. +func (c *GoodsClient) DeleteOne(_go *Goods) *GoodsDeleteOne { + return c.DeleteOneID(_go.ID) +} + +// DeleteOneID returns a delete builder for the given id. +func (c *GoodsClient) DeleteOneID(id string) *GoodsDeleteOne { + builder := c.Delete().Where(goods.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &GoodsDeleteOne{builder} +} + +// Query returns a query builder for Goods. +func (c *GoodsClient) Query() *GoodsQuery { + return &GoodsQuery{config: c.config} +} + +// Get returns a Goods entity by its id. +func (c *GoodsClient) Get(ctx context.Context, id string) (*Goods, error) { + return c.Query().Where(goods.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *GoodsClient) GetX(ctx context.Context, id string) *Goods { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// Hooks returns the client hooks. +func (c *GoodsClient) Hooks() []Hook { + return c.hooks.Goods +} + // GroupClient is a client for the Group schema. type GroupClient struct { config diff --git a/entc/integration/gremlin/ent/comment_query.go b/entc/integration/gremlin/ent/comment_query.go index 183752e6f..27e9f895a 100644 --- a/entc/integration/gremlin/ent/comment_query.go +++ b/entc/integration/gremlin/ent/comment_query.go @@ -59,23 +59,23 @@ func (cq *CommentQuery) Order(o ...OrderFunc) *CommentQuery { // First returns the first Comment entity in the query. Returns *NotFoundError when no comment was found. func (cq *CommentQuery) First(ctx context.Context) (*Comment, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{comment.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CommentQuery) FirstX(ctx context.Context) *Comment { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Comment id in the query. Returns *NotFoundError when no id was found. @@ -102,13 +102,13 @@ func (cq *CommentQuery) FirstXID(ctx context.Context) string { // Only returns the only Comment entity in the query, returns an error if not exactly one entity was returned. func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{comment.Label} default: @@ -118,11 +118,11 @@ func (cq *CommentQuery) Only(ctx context.Context) (*Comment, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CommentQuery) OnlyX(ctx context.Context) *Comment { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Comment id in the query, returns an error if not exactly one id was returned. @@ -161,11 +161,11 @@ func (cq *CommentQuery) All(ctx context.Context) ([]*Comment, error) { // AllX is like All, but panics if an error occurs. func (cq *CommentQuery) AllX(ctx context.Context) []*Comment { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Comment ids. diff --git a/entc/integration/gremlin/ent/comment_update.go b/entc/integration/gremlin/ent/comment_update.go index 3a8e275ce..c4c6fae41 100644 --- a/entc/integration/gremlin/ent/comment_update.go +++ b/entc/integration/gremlin/ent/comment_update.go @@ -324,11 +324,11 @@ func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CommentUpdateOne) SaveX(ctx context.Context) *Comment { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/config.go b/entc/integration/gremlin/ent/config.go index 87ce741f2..c80f23ede 100644 --- a/entc/integration/gremlin/ent/config.go +++ b/entc/integration/gremlin/ent/config.go @@ -33,6 +33,7 @@ type hooks struct { FieldType []ent.Hook File []ent.Hook FileType []ent.Hook + Goods []ent.Hook Group []ent.Hook GroupInfo []ent.Hook Item []ent.Hook diff --git a/entc/integration/gremlin/ent/fieldtype_query.go b/entc/integration/gremlin/ent/fieldtype_query.go index 5cb5e1c44..ac5870a7c 100644 --- a/entc/integration/gremlin/ent/fieldtype_query.go +++ b/entc/integration/gremlin/ent/fieldtype_query.go @@ -59,23 +59,23 @@ func (ftq *FieldTypeQuery) Order(o ...OrderFunc) *FieldTypeQuery { // First returns the first FieldType entity in the query. Returns *NotFoundError when no fieldtype was found. func (ftq *FieldTypeQuery) First(ctx context.Context) (*FieldType, error) { - fts, err := ftq.Limit(1).All(ctx) + nodes, err := ftq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{fieldtype.Label} } - return fts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (ftq *FieldTypeQuery) FirstX(ctx context.Context) *FieldType { - ft, err := ftq.First(ctx) + node, err := ftq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return ft + return node } // FirstID returns the first FieldType id in the query. Returns *NotFoundError when no id was found. @@ -102,13 +102,13 @@ func (ftq *FieldTypeQuery) FirstXID(ctx context.Context) string { // Only returns the only FieldType entity in the query, returns an error if not exactly one entity was returned. func (ftq *FieldTypeQuery) Only(ctx context.Context) (*FieldType, error) { - fts, err := ftq.Limit(2).All(ctx) + nodes, err := ftq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fts) { + switch len(nodes) { case 1: - return fts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{fieldtype.Label} default: @@ -118,11 +118,11 @@ func (ftq *FieldTypeQuery) Only(ctx context.Context) (*FieldType, error) { // OnlyX is like Only, but panics if an error occurs. func (ftq *FieldTypeQuery) OnlyX(ctx context.Context) *FieldType { - ft, err := ftq.Only(ctx) + node, err := ftq.Only(ctx) if err != nil { panic(err) } - return ft + return node } // OnlyID returns the only FieldType id in the query, returns an error if not exactly one id was returned. @@ -161,11 +161,11 @@ func (ftq *FieldTypeQuery) All(ctx context.Context) ([]*FieldType, error) { // AllX is like All, but panics if an error occurs. func (ftq *FieldTypeQuery) AllX(ctx context.Context) []*FieldType { - fts, err := ftq.All(ctx) + nodes, err := ftq.All(ctx) if err != nil { panic(err) } - return fts + return nodes } // IDs executes the query and returns a list of FieldType ids. diff --git a/entc/integration/gremlin/ent/fieldtype_update.go b/entc/integration/gremlin/ent/fieldtype_update.go index 9dc55a103..eab0ca5d6 100644 --- a/entc/integration/gremlin/ent/fieldtype_update.go +++ b/entc/integration/gremlin/ent/fieldtype_update.go @@ -2461,11 +2461,11 @@ func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error) { // SaveX is like Save, but panics if an error occurs. func (ftuo *FieldTypeUpdateOne) SaveX(ctx context.Context) *FieldType { - ft, err := ftuo.Save(ctx) + node, err := ftuo.Save(ctx) if err != nil { panic(err) } - return ft + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/file_query.go b/entc/integration/gremlin/ent/file_query.go index fb3a07ebf..b931a5eb7 100644 --- a/entc/integration/gremlin/ent/file_query.go +++ b/entc/integration/gremlin/ent/file_query.go @@ -107,23 +107,23 @@ func (fq *FileQuery) QueryField() *FieldTypeQuery { // First returns the first File entity in the query. Returns *NotFoundError when no file was found. func (fq *FileQuery) First(ctx context.Context) (*File, error) { - fs, err := fq.Limit(1).All(ctx) + nodes, err := fq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{file.Label} } - return fs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (fq *FileQuery) FirstX(ctx context.Context) *File { - f, err := fq.First(ctx) + node, err := fq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return f + return node } // FirstID returns the first File id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (fq *FileQuery) FirstXID(ctx context.Context) string { // Only returns the only File entity in the query, returns an error if not exactly one entity was returned. func (fq *FileQuery) Only(ctx context.Context) (*File, error) { - fs, err := fq.Limit(2).All(ctx) + nodes, err := fq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fs) { + switch len(nodes) { case 1: - return fs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{file.Label} default: @@ -166,11 +166,11 @@ func (fq *FileQuery) Only(ctx context.Context) (*File, error) { // OnlyX is like Only, but panics if an error occurs. func (fq *FileQuery) OnlyX(ctx context.Context) *File { - f, err := fq.Only(ctx) + node, err := fq.Only(ctx) if err != nil { panic(err) } - return f + return node } // OnlyID returns the only File id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (fq *FileQuery) All(ctx context.Context) ([]*File, error) { // AllX is like All, but panics if an error occurs. func (fq *FileQuery) AllX(ctx context.Context) []*File { - fs, err := fq.All(ctx) + nodes, err := fq.All(ctx) if err != nil { panic(err) } - return fs + return nodes } // IDs executes the query and returns a list of File ids. diff --git a/entc/integration/gremlin/ent/file_update.go b/entc/integration/gremlin/ent/file_update.go index 94957a9f9..3e0ef668a 100644 --- a/entc/integration/gremlin/ent/file_update.go +++ b/entc/integration/gremlin/ent/file_update.go @@ -601,11 +601,11 @@ func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { // SaveX is like Save, but panics if an error occurs. func (fuo *FileUpdateOne) SaveX(ctx context.Context) *File { - f, err := fuo.Save(ctx) + node, err := fuo.Save(ctx) if err != nil { panic(err) } - return f + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/filetype_query.go b/entc/integration/gremlin/ent/filetype_query.go index 912671b4e..fac573195 100644 --- a/entc/integration/gremlin/ent/filetype_query.go +++ b/entc/integration/gremlin/ent/filetype_query.go @@ -75,23 +75,23 @@ func (ftq *FileTypeQuery) QueryFiles() *FileQuery { // First returns the first FileType entity in the query. Returns *NotFoundError when no filetype was found. func (ftq *FileTypeQuery) First(ctx context.Context) (*FileType, error) { - fts, err := ftq.Limit(1).All(ctx) + nodes, err := ftq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(fts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{filetype.Label} } - return fts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (ftq *FileTypeQuery) FirstX(ctx context.Context) *FileType { - ft, err := ftq.First(ctx) + node, err := ftq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return ft + return node } // FirstID returns the first FileType id in the query. Returns *NotFoundError when no id was found. @@ -118,13 +118,13 @@ func (ftq *FileTypeQuery) FirstXID(ctx context.Context) string { // Only returns the only FileType entity in the query, returns an error if not exactly one entity was returned. func (ftq *FileTypeQuery) Only(ctx context.Context) (*FileType, error) { - fts, err := ftq.Limit(2).All(ctx) + nodes, err := ftq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(fts) { + switch len(nodes) { case 1: - return fts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{filetype.Label} default: @@ -134,11 +134,11 @@ func (ftq *FileTypeQuery) Only(ctx context.Context) (*FileType, error) { // OnlyX is like Only, but panics if an error occurs. func (ftq *FileTypeQuery) OnlyX(ctx context.Context) *FileType { - ft, err := ftq.Only(ctx) + node, err := ftq.Only(ctx) if err != nil { panic(err) } - return ft + return node } // OnlyID returns the only FileType id in the query, returns an error if not exactly one id was returned. @@ -177,11 +177,11 @@ func (ftq *FileTypeQuery) All(ctx context.Context) ([]*FileType, error) { // AllX is like All, but panics if an error occurs. func (ftq *FileTypeQuery) AllX(ctx context.Context) []*FileType { - fts, err := ftq.All(ctx) + nodes, err := ftq.All(ctx) if err != nil { panic(err) } - return fts + return nodes } // IDs executes the query and returns a list of FileType ids. diff --git a/entc/integration/gremlin/ent/filetype_update.go b/entc/integration/gremlin/ent/filetype_update.go index 47c714198..40f1984a7 100644 --- a/entc/integration/gremlin/ent/filetype_update.go +++ b/entc/integration/gremlin/ent/filetype_update.go @@ -366,11 +366,11 @@ func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error) { // SaveX is like Save, but panics if an error occurs. func (ftuo *FileTypeUpdateOne) SaveX(ctx context.Context) *FileType { - ft, err := ftuo.Save(ctx) + node, err := ftuo.Save(ctx) if err != nil { panic(err) } - return ft + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/goods.go b/entc/integration/gremlin/ent/goods.go new file mode 100644 index 000000000..e7498962b --- /dev/null +++ b/entc/integration/gremlin/ent/goods.go @@ -0,0 +1,93 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "fmt" + "strings" + + "github.com/facebook/ent/dialect/gremlin" +) + +// Goods is the model entity for the Goods schema. +type Goods struct { + config + // ID of the ent. + ID string `json:"id,omitempty"` +} + +// FromResponse scans the gremlin response data into Goods. +func (_go *Goods) FromResponse(res *gremlin.Response) error { + vmap, err := res.ReadValueMap() + if err != nil { + return err + } + var scan_go struct { + ID string `json:"id,omitempty"` + } + if err := vmap.Decode(&scan_go); err != nil { + return err + } + _go.ID = scan_go.ID + return nil +} + +// Update returns a builder for updating this Goods. +// Note that, you need to call Goods.Unwrap() before calling this method, if this Goods +// was returned from a transaction, and the transaction was committed or rolled back. +func (_go *Goods) Update() *GoodsUpdateOne { + return (&GoodsClient{config: _go.config}).UpdateOne(_go) +} + +// Unwrap unwraps the entity that was returned from a transaction after it was closed, +// so that all next queries will be executed through the driver which created the transaction. +func (_go *Goods) Unwrap() *Goods { + tx, ok := _go.config.driver.(*txDriver) + if !ok { + panic("ent: Goods is not a transactional entity") + } + _go.config.driver = tx.drv + return _go +} + +// String implements the fmt.Stringer. +func (_go *Goods) String() string { + var builder strings.Builder + builder.WriteString("Goods(") + builder.WriteString(fmt.Sprintf("id=%v", _go.ID)) + builder.WriteByte(')') + return builder.String() +} + +// GoodsSlice is a parsable slice of Goods. +type GoodsSlice []*Goods + +// FromResponse scans the gremlin response data into GoodsSlice. +func (_go *GoodsSlice) FromResponse(res *gremlin.Response) error { + vmap, err := res.ReadValueMap() + if err != nil { + return err + } + var scan_go []struct { + ID string `json:"id,omitempty"` + } + if err := vmap.Decode(&scan_go); err != nil { + return err + } + for _, v := range scan_go { + *_go = append(*_go, &Goods{ + ID: v.ID, + }) + } + return nil +} + +func (_go GoodsSlice) config(cfg config) { + for _i := range _go { + _go[_i].config = cfg + } +} diff --git a/entc/integration/gremlin/ent/goods/goods.go b/entc/integration/gremlin/ent/goods/goods.go new file mode 100644 index 000000000..7a984ebae --- /dev/null +++ b/entc/integration/gremlin/ent/goods/goods.go @@ -0,0 +1,16 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package goods + +const ( + // Label holds the string label denoting the goods type in the database. + Label = "goods" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" +) + +// comment from another template. diff --git a/entc/integration/gremlin/ent/goods/where.go b/entc/integration/gremlin/ent/goods/where.go new file mode 100644 index 000000000..a35c617f6 --- /dev/null +++ b/entc/integration/gremlin/ent/goods/where.go @@ -0,0 +1,120 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package goods + +import ( + "github.com/facebook/ent/dialect/gremlin/graph/dsl" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/__" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/p" + "github.com/facebook/ent/entc/integration/gremlin/ent/predicate" +) + +// ID filters vertices based on their identifier. +func ID(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(id) + }) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.EQ(id)) + }) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.NEQ(id)) + }) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + v := make([]interface{}, len(ids)) + for i := range v { + v[i] = ids[i] + } + t.HasID(p.Within(v...)) + }) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + v := make([]interface{}, len(ids)) + for i := range v { + v[i] = ids[i] + } + t.HasID(p.Without(v...)) + }) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.GT(id)) + }) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.GTE(id)) + }) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.LT(id)) + }) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id string) predicate.Goods { + return predicate.Goods(func(t *dsl.Traversal) { + t.HasID(p.LTE(id)) + }) +} + +// And groups list of predicates with the AND operator between them. +func And(predicates ...predicate.Goods) predicate.Goods { + return predicate.Goods(func(tr *dsl.Traversal) { + trs := make([]interface{}, 0, len(predicates)) + for _, p := range predicates { + t := __.New() + p(t) + trs = append(trs, t) + } + tr.Where(__.And(trs...)) + }) +} + +// Or groups list of predicates with the OR operator between them. +func Or(predicates ...predicate.Goods) predicate.Goods { + return predicate.Goods(func(tr *dsl.Traversal) { + trs := make([]interface{}, 0, len(predicates)) + for _, p := range predicates { + t := __.New() + p(t) + trs = append(trs, t) + } + tr.Where(__.Or(trs...)) + }) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.Goods) predicate.Goods { + return predicate.Goods(func(tr *dsl.Traversal) { + t := __.New() + p(t) + tr.Where(__.Not(t)) + }) +} diff --git a/entc/integration/gremlin/ent/goods_create.go b/entc/integration/gremlin/ent/goods_create.go new file mode 100644 index 000000000..26d35f9fd --- /dev/null +++ b/entc/integration/gremlin/ent/goods_create.go @@ -0,0 +1,105 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/gremlin" + "github.com/facebook/ent/dialect/gremlin/graph/dsl" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebook/ent/entc/integration/gremlin/ent/goods" +) + +// GoodsCreate is the builder for creating a Goods entity. +type GoodsCreate struct { + config + mutation *GoodsMutation + hooks []Hook +} + +// Mutation returns the GoodsMutation object of the builder. +func (gc *GoodsCreate) Mutation() *GoodsMutation { + return gc.mutation +} + +// Save creates the Goods in the database. +func (gc *GoodsCreate) Save(ctx context.Context) (*Goods, error) { + var ( + err error + node *Goods + ) + if len(gc.hooks) == 0 { + if err = gc.check(); err != nil { + return nil, err + } + node, err = gc.gremlinSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err = gc.check(); err != nil { + return nil, err + } + gc.mutation = mutation + node, err = gc.gremlinSave(ctx) + mutation.done = true + return node, err + }) + for i := len(gc.hooks) - 1; i >= 0; i-- { + mut = gc.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gc.mutation); err != nil { + return nil, err + } + } + return node, err +} + +// SaveX calls Save and panics if Save returns an error. +func (gc *GoodsCreate) SaveX(ctx context.Context) *Goods { + v, err := gc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// check runs all checks and user-defined validators on the builder. +func (gc *GoodsCreate) check() error { + return nil +} + +func (gc *GoodsCreate) gremlinSave(ctx context.Context) (*Goods, error) { + res := &gremlin.Response{} + query, bindings := gc.gremlin().Query() + if err := gc.driver.Exec(ctx, query, bindings, res); err != nil { + return nil, err + } + if err, ok := isConstantError(res); ok { + return nil, err + } + _go := &Goods{config: gc.config} + if err := _go.FromResponse(res); err != nil { + return nil, err + } + return _go, nil +} + +func (gc *GoodsCreate) gremlin() *dsl.Traversal { + v := g.AddV(goods.Label) + return v.ValueMap(true) +} + +// GoodsCreateBulk is the builder for creating a bulk of Goods entities. +type GoodsCreateBulk struct { + config + builders []*GoodsCreate +} diff --git a/entc/integration/gremlin/ent/goods_delete.go b/entc/integration/gremlin/ent/goods_delete.go new file mode 100644 index 000000000..244c891c3 --- /dev/null +++ b/entc/integration/gremlin/ent/goods_delete.go @@ -0,0 +1,111 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/gremlin" + "github.com/facebook/ent/dialect/gremlin/graph/dsl" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/__" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebook/ent/entc/integration/gremlin/ent/goods" + "github.com/facebook/ent/entc/integration/gremlin/ent/predicate" +) + +// GoodsDelete is the builder for deleting a Goods entity. +type GoodsDelete struct { + config + hooks []Hook + mutation *GoodsMutation + predicates []predicate.Goods +} + +// Where adds a new predicate to the delete builder. +func (gd *GoodsDelete) Where(ps ...predicate.Goods) *GoodsDelete { + gd.predicates = append(gd.predicates, ps...) + return gd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (gd *GoodsDelete) Exec(ctx context.Context) (int, error) { + var ( + err error + affected int + ) + if len(gd.hooks) == 0 { + affected, err = gd.gremlinExec(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + gd.mutation = mutation + affected, err = gd.gremlinExec(ctx) + mutation.done = true + return affected, err + }) + for i := len(gd.hooks) - 1; i >= 0; i-- { + mut = gd.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gd.mutation); err != nil { + return 0, err + } + } + return affected, err +} + +// ExecX is like Exec, but panics if an error occurs. +func (gd *GoodsDelete) ExecX(ctx context.Context) int { + n, err := gd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (gd *GoodsDelete) gremlinExec(ctx context.Context) (int, error) { + res := &gremlin.Response{} + query, bindings := gd.gremlin().Query() + if err := gd.driver.Exec(ctx, query, bindings, res); err != nil { + return 0, err + } + return res.ReadInt() +} + +func (gd *GoodsDelete) gremlin() *dsl.Traversal { + t := g.V().HasLabel(goods.Label) + for _, p := range gd.predicates { + p(t) + } + return t.SideEffect(__.Drop()).Count() +} + +// GoodsDeleteOne is the builder for deleting a single Goods entity. +type GoodsDeleteOne struct { + gd *GoodsDelete +} + +// Exec executes the deletion query. +func (gdo *GoodsDeleteOne) Exec(ctx context.Context) error { + n, err := gdo.gd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{goods.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (gdo *GoodsDeleteOne) ExecX(ctx context.Context) { + gdo.gd.ExecX(ctx) +} diff --git a/entc/integration/gremlin/ent/goods_query.go b/entc/integration/gremlin/ent/goods_query.go new file mode 100644 index 000000000..505b15e36 --- /dev/null +++ b/entc/integration/gremlin/ent/goods_query.go @@ -0,0 +1,839 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "errors" + "fmt" + "math" + + "github.com/facebook/ent/dialect/gremlin" + "github.com/facebook/ent/dialect/gremlin/graph/dsl" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/__" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebook/ent/entc/integration/gremlin/ent/goods" + "github.com/facebook/ent/entc/integration/gremlin/ent/predicate" +) + +// GoodsQuery is the builder for querying Goods entities. +type GoodsQuery struct { + config + limit *int + offset *int + order []OrderFunc + unique []string + predicates []predicate.Goods + // intermediate query (i.e. traversal path). + gremlin *dsl.Traversal + path func(context.Context) (*dsl.Traversal, error) +} + +// Where adds a new predicate for the builder. +func (gq *GoodsQuery) Where(ps ...predicate.Goods) *GoodsQuery { + gq.predicates = append(gq.predicates, ps...) + return gq +} + +// Limit adds a limit step to the query. +func (gq *GoodsQuery) Limit(limit int) *GoodsQuery { + gq.limit = &limit + return gq +} + +// Offset adds an offset step to the query. +func (gq *GoodsQuery) Offset(offset int) *GoodsQuery { + gq.offset = &offset + return gq +} + +// Order adds an order step to the query. +func (gq *GoodsQuery) Order(o ...OrderFunc) *GoodsQuery { + gq.order = append(gq.order, o...) + return gq +} + +// First returns the first Goods entity in the query. Returns *NotFoundError when no goods was found. +func (gq *GoodsQuery) First(ctx context.Context) (*Goods, error) { + nodes, err := gq.Limit(1).All(ctx) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{goods.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (gq *GoodsQuery) FirstX(ctx context.Context) *Goods { + node, err := gq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first Goods id in the query. Returns *NotFoundError when no id was found. +func (gq *GoodsQuery) FirstID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = gq.Limit(1).IDs(ctx); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{goods.Label} + return + } + return ids[0], nil +} + +// FirstXID is like FirstID, but panics if an error occurs. +func (gq *GoodsQuery) FirstXID(ctx context.Context) string { + id, err := gq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns the only Goods entity in the query, returns an error if not exactly one entity was returned. +func (gq *GoodsQuery) Only(ctx context.Context) (*Goods, error) { + nodes, err := gq.Limit(2).All(ctx) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{goods.Label} + default: + return nil, &NotSingularError{goods.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (gq *GoodsQuery) OnlyX(ctx context.Context) *Goods { + node, err := gq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID returns the only Goods id in the query, returns an error if not exactly one id was returned. +func (gq *GoodsQuery) OnlyID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = gq.Limit(2).IDs(ctx); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{goods.Label} + default: + err = &NotSingularError{goods.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (gq *GoodsQuery) OnlyIDX(ctx context.Context) string { + id, err := gq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of GoodsSlice. +func (gq *GoodsQuery) All(ctx context.Context) ([]*Goods, error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.gremlinAll(ctx) +} + +// AllX is like All, but panics if an error occurs. +func (gq *GoodsQuery) AllX(ctx context.Context) []*Goods { + nodes, err := gq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of Goods ids. +func (gq *GoodsQuery) IDs(ctx context.Context) ([]string, error) { + var ids []string + if err := gq.Select(goods.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (gq *GoodsQuery) IDsX(ctx context.Context) []string { + ids, err := gq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (gq *GoodsQuery) Count(ctx context.Context) (int, error) { + if err := gq.prepareQuery(ctx); err != nil { + return 0, err + } + return gq.gremlinCount(ctx) +} + +// CountX is like Count, but panics if an error occurs. +func (gq *GoodsQuery) CountX(ctx context.Context) int { + count, err := gq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (gq *GoodsQuery) Exist(ctx context.Context) (bool, error) { + if err := gq.prepareQuery(ctx); err != nil { + return false, err + } + return gq.gremlinExist(ctx) +} + +// ExistX is like Exist, but panics if an error occurs. +func (gq *GoodsQuery) ExistX(ctx context.Context) bool { + exist, err := gq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the query builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (gq *GoodsQuery) Clone() *GoodsQuery { + return &GoodsQuery{ + config: gq.config, + limit: gq.limit, + offset: gq.offset, + order: append([]OrderFunc{}, gq.order...), + unique: append([]string{}, gq.unique...), + predicates: append([]predicate.Goods{}, gq.predicates...), + // clone intermediate query. + gremlin: gq.gremlin.Clone(), + path: gq.path, + } +} + +// GroupBy used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +func (gq *GoodsQuery) GroupBy(field string, fields ...string) *GoodsGroupBy { + group := &GoodsGroupBy{config: gq.config} + group.fields = append([]string{field}, fields...) + group.path = func(ctx context.Context) (prev *dsl.Traversal, err error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.gremlinQuery(), nil + } + return group +} + +// Select one or more fields from the given query. +func (gq *GoodsQuery) Select(field string, fields ...string) *GoodsSelect { + selector := &GoodsSelect{config: gq.config} + selector.fields = append([]string{field}, fields...) + selector.path = func(ctx context.Context) (prev *dsl.Traversal, err error) { + if err := gq.prepareQuery(ctx); err != nil { + return nil, err + } + return gq.gremlinQuery(), nil + } + return selector +} + +func (gq *GoodsQuery) prepareQuery(ctx context.Context) error { + if gq.path != nil { + prev, err := gq.path(ctx) + if err != nil { + return err + } + gq.gremlin = prev + } + return nil +} + +func (gq *GoodsQuery) gremlinAll(ctx context.Context) ([]*Goods, error) { + res := &gremlin.Response{} + query, bindings := gq.gremlinQuery().ValueMap(true).Query() + if err := gq.driver.Exec(ctx, query, bindings, res); err != nil { + return nil, err + } + var _gos GoodsSlice + if err := _gos.FromResponse(res); err != nil { + return nil, err + } + _gos.config(gq.config) + return _gos, nil +} + +func (gq *GoodsQuery) gremlinCount(ctx context.Context) (int, error) { + res := &gremlin.Response{} + query, bindings := gq.gremlinQuery().Count().Query() + if err := gq.driver.Exec(ctx, query, bindings, res); err != nil { + return 0, err + } + return res.ReadInt() +} + +func (gq *GoodsQuery) gremlinExist(ctx context.Context) (bool, error) { + res := &gremlin.Response{} + query, bindings := gq.gremlinQuery().HasNext().Query() + if err := gq.driver.Exec(ctx, query, bindings, res); err != nil { + return false, err + } + return res.ReadBool() +} + +func (gq *GoodsQuery) gremlinQuery() *dsl.Traversal { + v := g.V().HasLabel(goods.Label) + if gq.gremlin != nil { + v = gq.gremlin.Clone() + } + for _, p := range gq.predicates { + p(v) + } + if len(gq.order) > 0 { + v.Order() + for _, p := range gq.order { + p(v) + } + } + switch limit, offset := gq.limit, gq.offset; { + case limit != nil && offset != nil: + v.Range(*offset, *offset+*limit) + case offset != nil: + v.Range(*offset, math.MaxInt32) + case limit != nil: + v.Limit(*limit) + } + if unique := gq.unique; len(unique) == 0 { + v.Dedup() + } + return v +} + +// GoodsGroupBy is the builder for group-by Goods entities. +type GoodsGroupBy struct { + config + fields []string + fns []AggregateFunc + // intermediate query (i.e. traversal path). + gremlin *dsl.Traversal + path func(context.Context) (*dsl.Traversal, error) +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (ggb *GoodsGroupBy) Aggregate(fns ...AggregateFunc) *GoodsGroupBy { + ggb.fns = append(ggb.fns, fns...) + return ggb +} + +// Scan applies the group-by query and scan the result into the given value. +func (ggb *GoodsGroupBy) Scan(ctx context.Context, v interface{}) error { + query, err := ggb.path(ctx) + if err != nil { + return err + } + ggb.gremlin = query + return ggb.gremlinScan(ctx, v) +} + +// ScanX is like Scan, but panics if an error occurs. +func (ggb *GoodsGroupBy) ScanX(ctx context.Context, v interface{}) { + if err := ggb.Scan(ctx, v); err != nil { + panic(err) + } +} + +// Strings returns list of strings from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Strings(ctx context.Context) ([]string, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Strings is not achievable when grouping more than 1 field") + } + var v []string + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// StringsX is like Strings, but panics if an error occurs. +func (ggb *GoodsGroupBy) StringsX(ctx context.Context) []string { + v, err := ggb.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = ggb.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (ggb *GoodsGroupBy) StringX(ctx context.Context) string { + v, err := ggb.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Ints(ctx context.Context) ([]int, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Ints is not achievable when grouping more than 1 field") + } + var v []int + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (ggb *GoodsGroupBy) IntsX(ctx context.Context) []int { + v, err := ggb.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = ggb.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (ggb *GoodsGroupBy) IntX(ctx context.Context) int { + v, err := ggb.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Float64s(ctx context.Context) ([]float64, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Float64s is not achievable when grouping more than 1 field") + } + var v []float64 + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (ggb *GoodsGroupBy) Float64sX(ctx context.Context) []float64 { + v, err := ggb.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = ggb.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (ggb *GoodsGroupBy) Float64X(ctx context.Context) float64 { + v, err := ggb.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Bools(ctx context.Context) ([]bool, error) { + if len(ggb.fields) > 1 { + return nil, errors.New("ent: GoodsGroupBy.Bools is not achievable when grouping more than 1 field") + } + var v []bool + if err := ggb.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (ggb *GoodsGroupBy) BoolsX(ctx context.Context) []bool { + v, err := ggb.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from group-by. It is only allowed when querying group-by with one field. +func (ggb *GoodsGroupBy) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = ggb.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsGroupBy.Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (ggb *GoodsGroupBy) BoolX(ctx context.Context) bool { + v, err := ggb.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +func (ggb *GoodsGroupBy) gremlinScan(ctx context.Context, v interface{}) error { + res := &gremlin.Response{} + query, bindings := ggb.gremlinQuery().Query() + if err := ggb.driver.Exec(ctx, query, bindings, res); err != nil { + return err + } + if len(ggb.fields)+len(ggb.fns) == 1 { + return res.ReadVal(v) + } + vm, err := res.ReadValueMap() + if err != nil { + return err + } + return vm.Decode(v) +} + +func (ggb *GoodsGroupBy) gremlinQuery() *dsl.Traversal { + var ( + trs []interface{} + names []interface{} + ) + for _, fn := range ggb.fns { + name, tr := fn("p", "") + trs = append(trs, tr) + names = append(names, name) + } + for _, f := range ggb.fields { + names = append(names, f) + trs = append(trs, __.As("p").Unfold().Values(f).As(f)) + } + return ggb.gremlin.Group(). + By(__.Values(ggb.fields...).Fold()). + By(__.Fold().Match(trs...).Select(names...)). + Select(dsl.Values). + Next() +} + +// GoodsSelect is the builder for select fields of Goods entities. +type GoodsSelect struct { + config + fields []string + // intermediate query (i.e. traversal path). + gremlin *dsl.Traversal + path func(context.Context) (*dsl.Traversal, error) +} + +// Scan applies the selector query and scan the result into the given value. +func (gs *GoodsSelect) Scan(ctx context.Context, v interface{}) error { + query, err := gs.path(ctx) + if err != nil { + return err + } + gs.gremlin = query + return gs.gremlinScan(ctx, v) +} + +// ScanX is like Scan, but panics if an error occurs. +func (gs *GoodsSelect) ScanX(ctx context.Context, v interface{}) { + if err := gs.Scan(ctx, v); err != nil { + panic(err) + } +} + +// Strings returns list of strings from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Strings(ctx context.Context) ([]string, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Strings is not achievable when selecting more than 1 field") + } + var v []string + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// StringsX is like Strings, but panics if an error occurs. +func (gs *GoodsSelect) StringsX(ctx context.Context) []string { + v, err := gs.Strings(ctx) + if err != nil { + panic(err) + } + return v +} + +// String returns a single string from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) String(ctx context.Context) (_ string, err error) { + var v []string + if v, err = gs.Strings(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Strings returned %d results when one was expected", len(v)) + } + return +} + +// StringX is like String, but panics if an error occurs. +func (gs *GoodsSelect) StringX(ctx context.Context) string { + v, err := gs.String(ctx) + if err != nil { + panic(err) + } + return v +} + +// Ints returns list of ints from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Ints(ctx context.Context) ([]int, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Ints is not achievable when selecting more than 1 field") + } + var v []int + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// IntsX is like Ints, but panics if an error occurs. +func (gs *GoodsSelect) IntsX(ctx context.Context) []int { + v, err := gs.Ints(ctx) + if err != nil { + panic(err) + } + return v +} + +// Int returns a single int from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Int(ctx context.Context) (_ int, err error) { + var v []int + if v, err = gs.Ints(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Ints returned %d results when one was expected", len(v)) + } + return +} + +// IntX is like Int, but panics if an error occurs. +func (gs *GoodsSelect) IntX(ctx context.Context) int { + v, err := gs.Int(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64s returns list of float64s from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Float64s(ctx context.Context) ([]float64, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Float64s is not achievable when selecting more than 1 field") + } + var v []float64 + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// Float64sX is like Float64s, but panics if an error occurs. +func (gs *GoodsSelect) Float64sX(ctx context.Context) []float64 { + v, err := gs.Float64s(ctx) + if err != nil { + panic(err) + } + return v +} + +// Float64 returns a single float64 from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Float64(ctx context.Context) (_ float64, err error) { + var v []float64 + if v, err = gs.Float64s(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Float64s returned %d results when one was expected", len(v)) + } + return +} + +// Float64X is like Float64, but panics if an error occurs. +func (gs *GoodsSelect) Float64X(ctx context.Context) float64 { + v, err := gs.Float64(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bools returns list of bools from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Bools(ctx context.Context) ([]bool, error) { + if len(gs.fields) > 1 { + return nil, errors.New("ent: GoodsSelect.Bools is not achievable when selecting more than 1 field") + } + var v []bool + if err := gs.Scan(ctx, &v); err != nil { + return nil, err + } + return v, nil +} + +// BoolsX is like Bools, but panics if an error occurs. +func (gs *GoodsSelect) BoolsX(ctx context.Context) []bool { + v, err := gs.Bools(ctx) + if err != nil { + panic(err) + } + return v +} + +// Bool returns a single bool from selector. It is only allowed when selecting one field. +func (gs *GoodsSelect) Bool(ctx context.Context) (_ bool, err error) { + var v []bool + if v, err = gs.Bools(ctx); err != nil { + return + } + switch len(v) { + case 1: + return v[0], nil + case 0: + err = &NotFoundError{goods.Label} + default: + err = fmt.Errorf("ent: GoodsSelect.Bools returned %d results when one was expected", len(v)) + } + return +} + +// BoolX is like Bool, but panics if an error occurs. +func (gs *GoodsSelect) BoolX(ctx context.Context) bool { + v, err := gs.Bool(ctx) + if err != nil { + panic(err) + } + return v +} + +func (gs *GoodsSelect) gremlinScan(ctx context.Context, v interface{}) error { + var ( + traversal *dsl.Traversal + res = &gremlin.Response{} + ) + if len(gs.fields) == 1 { + if gs.fields[0] != goods.FieldID { + traversal = gs.gremlin.Values(gs.fields...) + } else { + traversal = gs.gremlin.ID() + } + } else { + fields := make([]interface{}, len(gs.fields)) + for i, f := range gs.fields { + fields[i] = f + } + traversal = gs.gremlin.ValueMap(fields...) + } + query, bindings := traversal.Query() + if err := gs.driver.Exec(ctx, query, bindings, res); err != nil { + return err + } + if len(gs.fields) == 1 { + return res.ReadVal(v) + } + vm, err := res.ReadValueMap() + if err != nil { + return err + } + return vm.Decode(v) +} diff --git a/entc/integration/gremlin/ent/goods_update.go b/entc/integration/gremlin/ent/goods_update.go new file mode 100644 index 000000000..d044d7049 --- /dev/null +++ b/entc/integration/gremlin/ent/goods_update.go @@ -0,0 +1,206 @@ +// Copyright 2019-present Facebook Inc. All rights reserved. +// This source code is licensed under the Apache 2.0 license found +// in the LICENSE file in the root directory of this source tree. + +// Code generated by entc, DO NOT EDIT. + +package ent + +import ( + "context" + "fmt" + + "github.com/facebook/ent/dialect/gremlin" + "github.com/facebook/ent/dialect/gremlin/graph/dsl" + "github.com/facebook/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebook/ent/entc/integration/gremlin/ent/goods" + "github.com/facebook/ent/entc/integration/gremlin/ent/predicate" +) + +// GoodsUpdate is the builder for updating Goods entities. +type GoodsUpdate struct { + config + hooks []Hook + mutation *GoodsMutation + predicates []predicate.Goods +} + +// Where adds a new predicate for the builder. +func (gu *GoodsUpdate) Where(ps ...predicate.Goods) *GoodsUpdate { + gu.predicates = append(gu.predicates, ps...) + return gu +} + +// Mutation returns the GoodsMutation object of the builder. +func (gu *GoodsUpdate) Mutation() *GoodsMutation { + return gu.mutation +} + +// Save executes the query and returns the number of rows/vertices matched by this operation. +func (gu *GoodsUpdate) Save(ctx context.Context) (int, error) { + var ( + err error + affected int + ) + if len(gu.hooks) == 0 { + affected, err = gu.gremlinSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + gu.mutation = mutation + affected, err = gu.gremlinSave(ctx) + mutation.done = true + return affected, err + }) + for i := len(gu.hooks) - 1; i >= 0; i-- { + mut = gu.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, gu.mutation); err != nil { + return 0, err + } + } + return affected, err +} + +// SaveX is like Save, but panics if an error occurs. +func (gu *GoodsUpdate) SaveX(ctx context.Context) int { + affected, err := gu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (gu *GoodsUpdate) Exec(ctx context.Context) error { + _, err := gu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (gu *GoodsUpdate) ExecX(ctx context.Context) { + if err := gu.Exec(ctx); err != nil { + panic(err) + } +} + +func (gu *GoodsUpdate) gremlinSave(ctx context.Context) (int, error) { + res := &gremlin.Response{} + query, bindings := gu.gremlin().Query() + if err := gu.driver.Exec(ctx, query, bindings, res); err != nil { + return 0, err + } + if err, ok := isConstantError(res); ok { + return 0, err + } + return res.ReadInt() +} + +func (gu *GoodsUpdate) gremlin() *dsl.Traversal { + v := g.V().HasLabel(goods.Label) + for _, p := range gu.predicates { + p(v) + } + var ( + trs []*dsl.Traversal + ) + v.Count() + trs = append(trs, v) + return dsl.Join(trs...) +} + +// GoodsUpdateOne is the builder for updating a single Goods entity. +type GoodsUpdateOne struct { + config + hooks []Hook + mutation *GoodsMutation +} + +// Mutation returns the GoodsMutation object of the builder. +func (guo *GoodsUpdateOne) Mutation() *GoodsMutation { + return guo.mutation +} + +// Save executes the query and returns the updated entity. +func (guo *GoodsUpdateOne) Save(ctx context.Context) (*Goods, error) { + var ( + err error + node *Goods + ) + if len(guo.hooks) == 0 { + node, err = guo.gremlinSave(ctx) + } else { + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + guo.mutation = mutation + node, err = guo.gremlinSave(ctx) + mutation.done = true + return node, err + }) + for i := len(guo.hooks) - 1; i >= 0; i-- { + mut = guo.hooks[i](mut) + } + if _, err := mut.Mutate(ctx, guo.mutation); err != nil { + return nil, err + } + } + return node, err +} + +// SaveX is like Save, but panics if an error occurs. +func (guo *GoodsUpdateOne) SaveX(ctx context.Context) *Goods { + node, err := guo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (guo *GoodsUpdateOne) Exec(ctx context.Context) error { + _, err := guo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (guo *GoodsUpdateOne) ExecX(ctx context.Context) { + if err := guo.Exec(ctx); err != nil { + panic(err) + } +} + +func (guo *GoodsUpdateOne) gremlinSave(ctx context.Context) (*Goods, error) { + res := &gremlin.Response{} + id, ok := guo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Goods.ID for update")} + } + query, bindings := guo.gremlin(id).Query() + if err := guo.driver.Exec(ctx, query, bindings, res); err != nil { + return nil, err + } + if err, ok := isConstantError(res); ok { + return nil, err + } + _go := &Goods{config: guo.config} + if err := _go.FromResponse(res); err != nil { + return nil, err + } + return _go, nil +} + +func (guo *GoodsUpdateOne) gremlin(id string) *dsl.Traversal { + v := g.V(id) + var ( + trs []*dsl.Traversal + ) + v.ValueMap(true) + trs = append(trs, v) + return dsl.Join(trs...) +} diff --git a/entc/integration/gremlin/ent/group_query.go b/entc/integration/gremlin/ent/group_query.go index 91d8758d7..86b6060b5 100644 --- a/entc/integration/gremlin/ent/group_query.go +++ b/entc/integration/gremlin/ent/group_query.go @@ -121,23 +121,23 @@ func (gq *GroupQuery) QueryInfo() *GroupInfoQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -164,13 +164,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) string { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -180,11 +180,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -223,11 +223,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/entc/integration/gremlin/ent/group_update.go b/entc/integration/gremlin/ent/group_update.go index ce8358313..6a895bb6a 100644 --- a/entc/integration/gremlin/ent/group_update.go +++ b/entc/integration/gremlin/ent/group_update.go @@ -673,11 +673,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/groupinfo_query.go b/entc/integration/gremlin/ent/groupinfo_query.go index bd39b7b24..6413cdbd2 100644 --- a/entc/integration/gremlin/ent/groupinfo_query.go +++ b/entc/integration/gremlin/ent/groupinfo_query.go @@ -76,23 +76,23 @@ func (giq *GroupInfoQuery) QueryGroups() *GroupQuery { // First returns the first GroupInfo entity in the query. Returns *NotFoundError when no groupinfo was found. func (giq *GroupInfoQuery) First(ctx context.Context) (*GroupInfo, error) { - gis, err := giq.Limit(1).All(ctx) + nodes, err := giq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(gis) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{groupinfo.Label} } - return gis[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (giq *GroupInfoQuery) FirstX(ctx context.Context) *GroupInfo { - gi, err := giq.First(ctx) + node, err := giq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gi + return node } // FirstID returns the first GroupInfo id in the query. Returns *NotFoundError when no id was found. @@ -119,13 +119,13 @@ func (giq *GroupInfoQuery) FirstXID(ctx context.Context) string { // Only returns the only GroupInfo entity in the query, returns an error if not exactly one entity was returned. func (giq *GroupInfoQuery) Only(ctx context.Context) (*GroupInfo, error) { - gis, err := giq.Limit(2).All(ctx) + nodes, err := giq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(gis) { + switch len(nodes) { case 1: - return gis[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{groupinfo.Label} default: @@ -135,11 +135,11 @@ func (giq *GroupInfoQuery) Only(ctx context.Context) (*GroupInfo, error) { // OnlyX is like Only, but panics if an error occurs. func (giq *GroupInfoQuery) OnlyX(ctx context.Context) *GroupInfo { - gi, err := giq.Only(ctx) + node, err := giq.Only(ctx) if err != nil { panic(err) } - return gi + return node } // OnlyID returns the only GroupInfo id in the query, returns an error if not exactly one id was returned. @@ -178,11 +178,11 @@ func (giq *GroupInfoQuery) All(ctx context.Context) ([]*GroupInfo, error) { // AllX is like All, but panics if an error occurs. func (giq *GroupInfoQuery) AllX(ctx context.Context) []*GroupInfo { - gis, err := giq.All(ctx) + nodes, err := giq.All(ctx) if err != nil { panic(err) } - return gis + return nodes } // IDs executes the query and returns a list of GroupInfo ids. diff --git a/entc/integration/gremlin/ent/groupinfo_update.go b/entc/integration/gremlin/ent/groupinfo_update.go index 5e81dcfcc..4899c25c9 100644 --- a/entc/integration/gremlin/ent/groupinfo_update.go +++ b/entc/integration/gremlin/ent/groupinfo_update.go @@ -322,11 +322,11 @@ func (giuo *GroupInfoUpdateOne) Save(ctx context.Context) (*GroupInfo, error) { // SaveX is like Save, but panics if an error occurs. func (giuo *GroupInfoUpdateOne) SaveX(ctx context.Context) *GroupInfo { - gi, err := giuo.Save(ctx) + node, err := giuo.Save(ctx) if err != nil { panic(err) } - return gi + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/hook/hook.go b/entc/integration/gremlin/ent/hook/hook.go index 0c3089a44..6554b81da 100644 --- a/entc/integration/gremlin/ent/hook/hook.go +++ b/entc/integration/gremlin/ent/hook/hook.go @@ -78,6 +78,19 @@ func (f FileTypeFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, er return f(ctx, mv) } +// The GoodsFunc type is an adapter to allow the use of ordinary +// function as Goods mutator. +type GoodsFunc func(context.Context, *ent.GoodsMutation) (ent.Value, error) + +// Mutate calls f(ctx, m). +func (f GoodsFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) { + mv, ok := m.(*ent.GoodsMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.GoodsMutation", m) + } + return f(ctx, mv) +} + // The GroupFunc type is an adapter to allow the use of ordinary // function as Group mutator. type GroupFunc func(context.Context, *ent.GroupMutation) (ent.Value, error) diff --git a/entc/integration/gremlin/ent/item_query.go b/entc/integration/gremlin/ent/item_query.go index f346bf864..011b6cf6a 100644 --- a/entc/integration/gremlin/ent/item_query.go +++ b/entc/integration/gremlin/ent/item_query.go @@ -59,23 +59,23 @@ func (iq *ItemQuery) Order(o ...OrderFunc) *ItemQuery { // First returns the first Item entity in the query. Returns *NotFoundError when no item was found. func (iq *ItemQuery) First(ctx context.Context) (*Item, error) { - is, err := iq.Limit(1).All(ctx) + nodes, err := iq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(is) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{item.Label} } - return is[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (iq *ItemQuery) FirstX(ctx context.Context) *Item { - i, err := iq.First(ctx) + node, err := iq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return i + return node } // FirstID returns the first Item id in the query. Returns *NotFoundError when no id was found. @@ -102,13 +102,13 @@ func (iq *ItemQuery) FirstXID(ctx context.Context) string { // Only returns the only Item entity in the query, returns an error if not exactly one entity was returned. func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) { - is, err := iq.Limit(2).All(ctx) + nodes, err := iq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(is) { + switch len(nodes) { case 1: - return is[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{item.Label} default: @@ -118,11 +118,11 @@ func (iq *ItemQuery) Only(ctx context.Context) (*Item, error) { // OnlyX is like Only, but panics if an error occurs. func (iq *ItemQuery) OnlyX(ctx context.Context) *Item { - i, err := iq.Only(ctx) + node, err := iq.Only(ctx) if err != nil { panic(err) } - return i + return node } // OnlyID returns the only Item id in the query, returns an error if not exactly one id was returned. @@ -161,11 +161,11 @@ func (iq *ItemQuery) All(ctx context.Context) ([]*Item, error) { // AllX is like All, but panics if an error occurs. func (iq *ItemQuery) AllX(ctx context.Context) []*Item { - is, err := iq.All(ctx) + nodes, err := iq.All(ctx) if err != nil { panic(err) } - return is + return nodes } // IDs executes the query and returns a list of Item ids. diff --git a/entc/integration/gremlin/ent/item_update.go b/entc/integration/gremlin/ent/item_update.go index 226fe6819..3bf0bda92 100644 --- a/entc/integration/gremlin/ent/item_update.go +++ b/entc/integration/gremlin/ent/item_update.go @@ -155,11 +155,11 @@ func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) { // SaveX is like Save, but panics if an error occurs. func (iuo *ItemUpdateOne) SaveX(ctx context.Context) *Item { - i, err := iuo.Save(ctx) + node, err := iuo.Save(ctx) if err != nil { panic(err) } - return i + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/mutation.go b/entc/integration/gremlin/ent/mutation.go index e664a7a4d..a9377343e 100644 --- a/entc/integration/gremlin/ent/mutation.go +++ b/entc/integration/gremlin/ent/mutation.go @@ -47,6 +47,7 @@ const ( TypeFieldType = "FieldType" TypeFile = "File" TypeFileType = "FileType" + TypeGoods = "Goods" TypeGroup = "Group" TypeGroupInfo = "GroupInfo" TypeItem = "Item" @@ -6971,6 +6972,236 @@ func (m *FileTypeMutation) ResetEdge(name string) error { return fmt.Errorf("unknown FileType edge %s", name) } +// GoodsMutation represents an operation that mutate the GoodsSlice +// nodes in the graph. +type GoodsMutation struct { + config + op Op + typ string + id *string + clearedFields map[string]struct{} + done bool + oldValue func(context.Context) (*Goods, error) +} + +var _ ent.Mutation = (*GoodsMutation)(nil) + +// goodsOption allows to manage the mutation configuration using functional options. +type goodsOption func(*GoodsMutation) + +// newGoodsMutation creates new mutation for $n.Name. +func newGoodsMutation(c config, op Op, opts ...goodsOption) *GoodsMutation { + m := &GoodsMutation{ + config: c, + op: op, + typ: TypeGoods, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withGoodsID sets the id field of the mutation. +func withGoodsID(id string) goodsOption { + return func(m *GoodsMutation) { + var ( + err error + once sync.Once + value *Goods + ) + m.oldValue = func(ctx context.Context) (*Goods, error) { + once.Do(func() { + if m.done { + err = fmt.Errorf("querying old values post mutation is not allowed") + } else { + value, err = m.Client().Goods.Get(ctx, id) + } + }) + return value, err + } + m.id = &id + } +} + +// withGoods sets the old Goods of the mutation. +func withGoods(node *Goods) goodsOption { + return func(m *GoodsMutation) { + m.oldValue = func(context.Context) (*Goods, error) { + return node, nil + } + m.id = &node.ID + } +} + +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m GoodsMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client +} + +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m GoodsMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, fmt.Errorf("ent: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil +} + +// ID returns the id value in the mutation. Note that, the id +// is available only if it was provided to the builder. +func (m *GoodsMutation) ID() (id string, exists bool) { + if m.id == nil { + return + } + return *m.id, true +} + +// Op returns the operation name. +func (m *GoodsMutation) Op() Op { + return m.op +} + +// Type returns the node type of this mutation (Goods). +func (m *GoodsMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during +// this mutation. Note that, in order to get all numeric +// fields that were in/decremented, call AddedFields(). +func (m *GoodsMutation) Fields() []string { + fields := make([]string, 0, 0) + return fields +} + +// Field returns the value of a field with the given name. +// The second boolean value indicates that this field was +// not set, or was not define in the schema. +func (m *GoodsMutation) Field(name string) (ent.Value, bool) { + return nil, false +} + +// OldField returns the old value of the field from the database. +// An error is returned if the mutation operation is not UpdateOne, +// or the query to the database was failed. +func (m *GoodsMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + return nil, fmt.Errorf("unknown Goods field %s", name) +} + +// SetField sets the value for the given name. It returns an +// error if the field is not defined in the schema, or if the +// type mismatch the field type. +func (m *GoodsMutation) SetField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown Goods field %s", name) +} + +// AddedFields returns all numeric fields that were incremented +// or decremented during this mutation. +func (m *GoodsMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was in/decremented +// from a field with the given name. The second value indicates +// that this field was not set, or was not define in the schema. +func (m *GoodsMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value for the given name. It returns an +// error if the field is not defined in the schema, or if the +// type mismatch the field type. +func (m *GoodsMutation) AddField(name string, value ent.Value) error { + return fmt.Errorf("unknown Goods numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared +// during this mutation. +func (m *GoodsMutation) ClearedFields() []string { + return nil +} + +// FieldCleared returns a boolean indicates if this field was +// cleared in this mutation. +func (m *GoodsMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value for the given name. It returns an +// error if the field is not defined in the schema. +func (m *GoodsMutation) ClearField(name string) error { + return fmt.Errorf("unknown Goods nullable field %s", name) +} + +// ResetField resets all changes in the mutation regarding the +// given field name. It returns an error if the field is not +// defined in the schema. +func (m *GoodsMutation) ResetField(name string) error { + return fmt.Errorf("unknown Goods field %s", name) +} + +// AddedEdges returns all edge names that were set/added in this +// mutation. +func (m *GoodsMutation) AddedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// AddedIDs returns all ids (to other nodes) that were added for +// the given edge name. +func (m *GoodsMutation) AddedIDs(name string) []ent.Value { + return nil +} + +// RemovedEdges returns all edge names that were removed in this +// mutation. +func (m *GoodsMutation) RemovedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// RemovedIDs returns all ids (to other nodes) that were removed for +// the given edge name. +func (m *GoodsMutation) RemovedIDs(name string) []ent.Value { + return nil +} + +// ClearedEdges returns all edge names that were cleared in this +// mutation. +func (m *GoodsMutation) ClearedEdges() []string { + edges := make([]string, 0, 0) + return edges +} + +// EdgeCleared returns a boolean indicates if this edge was +// cleared in this mutation. +func (m *GoodsMutation) EdgeCleared(name string) bool { + return false +} + +// ClearEdge clears the value for the given name. It returns an +// error if the edge name is not defined in the schema. +func (m *GoodsMutation) ClearEdge(name string) error { + return fmt.Errorf("unknown Goods unique edge %s", name) +} + +// ResetEdge resets all changes in the mutation regarding the +// given edge name. It returns an error if the edge is not +// defined in the schema. +func (m *GoodsMutation) ResetEdge(name string) error { + return fmt.Errorf("unknown Goods edge %s", name) +} + // GroupMutation represents an operation that mutate the Groups // nodes in the graph. type GroupMutation struct { diff --git a/entc/integration/gremlin/ent/node_query.go b/entc/integration/gremlin/ent/node_query.go index 21e95f6f3..c3983fa0f 100644 --- a/entc/integration/gremlin/ent/node_query.go +++ b/entc/integration/gremlin/ent/node_query.go @@ -90,23 +90,23 @@ func (nq *NodeQuery) QueryNext() *NodeQuery { // First returns the first Node entity in the query. Returns *NotFoundError when no node was found. func (nq *NodeQuery) First(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(1).All(ctx) + nodes, err := nq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ns) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{node.Label} } - return ns[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (nq *NodeQuery) FirstX(ctx context.Context) *Node { - n, err := nq.First(ctx) + node, err := nq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return n + return node } // FirstID returns the first Node id in the query. Returns *NotFoundError when no id was found. @@ -133,13 +133,13 @@ func (nq *NodeQuery) FirstXID(ctx context.Context) string { // Only returns the only Node entity in the query, returns an error if not exactly one entity was returned. func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(2).All(ctx) + nodes, err := nq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ns) { + switch len(nodes) { case 1: - return ns[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{node.Label} default: @@ -149,11 +149,11 @@ func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { // OnlyX is like Only, but panics if an error occurs. func (nq *NodeQuery) OnlyX(ctx context.Context) *Node { - n, err := nq.Only(ctx) + node, err := nq.Only(ctx) if err != nil { panic(err) } - return n + return node } // OnlyID returns the only Node id in the query, returns an error if not exactly one id was returned. @@ -192,11 +192,11 @@ func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { // AllX is like All, but panics if an error occurs. func (nq *NodeQuery) AllX(ctx context.Context) []*Node { - ns, err := nq.All(ctx) + nodes, err := nq.All(ctx) if err != nil { panic(err) } - return ns + return nodes } // IDs executes the query and returns a list of Node ids. diff --git a/entc/integration/gremlin/ent/node_update.go b/entc/integration/gremlin/ent/node_update.go index f91931d24..f4079bbb9 100644 --- a/entc/integration/gremlin/ent/node_update.go +++ b/entc/integration/gremlin/ent/node_update.go @@ -364,11 +364,11 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { // SaveX is like Save, but panics if an error occurs. func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node { - n, err := nuo.Save(ctx) + node, err := nuo.Save(ctx) if err != nil { panic(err) } - return n + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/pet_query.go b/entc/integration/gremlin/ent/pet_query.go index 0866a7bc9..c615bfa51 100644 --- a/entc/integration/gremlin/ent/pet_query.go +++ b/entc/integration/gremlin/ent/pet_query.go @@ -91,23 +91,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -134,13 +134,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) string { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -150,11 +150,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -193,11 +193,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/entc/integration/gremlin/ent/pet_update.go b/entc/integration/gremlin/ent/pet_update.go index bbb859a11..a2e38f569 100644 --- a/entc/integration/gremlin/ent/pet_update.go +++ b/entc/integration/gremlin/ent/pet_update.go @@ -309,11 +309,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/predicate/predicate.go b/entc/integration/gremlin/ent/predicate/predicate.go index 5c265d759..5064f981d 100644 --- a/entc/integration/gremlin/ent/predicate/predicate.go +++ b/entc/integration/gremlin/ent/predicate/predicate.go @@ -25,6 +25,9 @@ type File func(*dsl.Traversal) // FileType is the predicate function for filetype builders. type FileType func(*dsl.Traversal) +// Goods is the predicate function for goods builders. +type Goods func(*dsl.Traversal) + // Group is the predicate function for group builders. type Group func(*dsl.Traversal) diff --git a/entc/integration/gremlin/ent/privacy/privacy.go b/entc/integration/gremlin/ent/privacy/privacy.go index 899eb76cf..351364736 100644 --- a/entc/integration/gremlin/ent/privacy/privacy.go +++ b/entc/integration/gremlin/ent/privacy/privacy.go @@ -334,6 +334,30 @@ func (f FileTypeMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutati return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.FileTypeMutation", m) } +// The GoodsQueryRuleFunc type is an adapter to allow the use of ordinary +// functions as a query rule. +type GoodsQueryRuleFunc func(context.Context, *ent.GoodsQuery) error + +// EvalQuery return f(ctx, q). +func (f GoodsQueryRuleFunc) EvalQuery(ctx context.Context, q ent.Query) error { + if q, ok := q.(*ent.GoodsQuery); ok { + return f(ctx, q) + } + return Denyf("ent/privacy: unexpected query type %T, expect *ent.GoodsQuery", q) +} + +// The GoodsMutationRuleFunc type is an adapter to allow the use of ordinary +// functions as a mutation rule. +type GoodsMutationRuleFunc func(context.Context, *ent.GoodsMutation) error + +// EvalMutation calls f(ctx, m). +func (f GoodsMutationRuleFunc) EvalMutation(ctx context.Context, m ent.Mutation) error { + if m, ok := m.(*ent.GoodsMutation); ok { + return f(ctx, m) + } + return Denyf("ent/privacy: unexpected mutation type %T, expect *ent.GoodsMutation", m) +} + // The GroupQueryRuleFunc type is an adapter to allow the use of ordinary // functions as a query rule. type GroupQueryRuleFunc func(context.Context, *ent.GroupQuery) error diff --git a/entc/integration/gremlin/ent/spec_query.go b/entc/integration/gremlin/ent/spec_query.go index af0d0896d..8c55ba8f5 100644 --- a/entc/integration/gremlin/ent/spec_query.go +++ b/entc/integration/gremlin/ent/spec_query.go @@ -75,23 +75,23 @@ func (sq *SpecQuery) QueryCard() *CardQuery { // First returns the first Spec entity in the query. Returns *NotFoundError when no spec was found. func (sq *SpecQuery) First(ctx context.Context) (*Spec, error) { - sSlice, err := sq.Limit(1).All(ctx) + nodes, err := sq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(sSlice) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{spec.Label} } - return sSlice[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (sq *SpecQuery) FirstX(ctx context.Context) *Spec { - s, err := sq.First(ctx) + node, err := sq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return s + return node } // FirstID returns the first Spec id in the query. Returns *NotFoundError when no id was found. @@ -118,13 +118,13 @@ func (sq *SpecQuery) FirstXID(ctx context.Context) string { // Only returns the only Spec entity in the query, returns an error if not exactly one entity was returned. func (sq *SpecQuery) Only(ctx context.Context) (*Spec, error) { - sSlice, err := sq.Limit(2).All(ctx) + nodes, err := sq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(sSlice) { + switch len(nodes) { case 1: - return sSlice[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{spec.Label} default: @@ -134,11 +134,11 @@ func (sq *SpecQuery) Only(ctx context.Context) (*Spec, error) { // OnlyX is like Only, but panics if an error occurs. func (sq *SpecQuery) OnlyX(ctx context.Context) *Spec { - s, err := sq.Only(ctx) + node, err := sq.Only(ctx) if err != nil { panic(err) } - return s + return node } // OnlyID returns the only Spec id in the query, returns an error if not exactly one id was returned. @@ -177,11 +177,11 @@ func (sq *SpecQuery) All(ctx context.Context) ([]*Spec, error) { // AllX is like All, but panics if an error occurs. func (sq *SpecQuery) AllX(ctx context.Context) []*Spec { - sSlice, err := sq.All(ctx) + nodes, err := sq.All(ctx) if err != nil { panic(err) } - return sSlice + return nodes } // IDs executes the query and returns a list of Spec ids. diff --git a/entc/integration/gremlin/ent/spec_update.go b/entc/integration/gremlin/ent/spec_update.go index f373ca132..0e65246ff 100644 --- a/entc/integration/gremlin/ent/spec_update.go +++ b/entc/integration/gremlin/ent/spec_update.go @@ -238,11 +238,11 @@ func (suo *SpecUpdateOne) Save(ctx context.Context) (*Spec, error) { // SaveX is like Save, but panics if an error occurs. func (suo *SpecUpdateOne) SaveX(ctx context.Context) *Spec { - s, err := suo.Save(ctx) + node, err := suo.Save(ctx) if err != nil { panic(err) } - return s + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/task_query.go b/entc/integration/gremlin/ent/task_query.go index 9331bad7d..929b38798 100644 --- a/entc/integration/gremlin/ent/task_query.go +++ b/entc/integration/gremlin/ent/task_query.go @@ -59,23 +59,23 @@ func (tq *TaskQuery) Order(o ...OrderFunc) *TaskQuery { // First returns the first Task entity in the query. Returns *NotFoundError when no task was found. func (tq *TaskQuery) First(ctx context.Context) (*Task, error) { - ts, err := tq.Limit(1).All(ctx) + nodes, err := tq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ts) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{task.Label} } - return ts[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (tq *TaskQuery) FirstX(ctx context.Context) *Task { - t, err := tq.First(ctx) + node, err := tq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return t + return node } // FirstID returns the first Task id in the query. Returns *NotFoundError when no id was found. @@ -102,13 +102,13 @@ func (tq *TaskQuery) FirstXID(ctx context.Context) string { // Only returns the only Task entity in the query, returns an error if not exactly one entity was returned. func (tq *TaskQuery) Only(ctx context.Context) (*Task, error) { - ts, err := tq.Limit(2).All(ctx) + nodes, err := tq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ts) { + switch len(nodes) { case 1: - return ts[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{task.Label} default: @@ -118,11 +118,11 @@ func (tq *TaskQuery) Only(ctx context.Context) (*Task, error) { // OnlyX is like Only, but panics if an error occurs. func (tq *TaskQuery) OnlyX(ctx context.Context) *Task { - t, err := tq.Only(ctx) + node, err := tq.Only(ctx) if err != nil { panic(err) } - return t + return node } // OnlyID returns the only Task id in the query, returns an error if not exactly one id was returned. @@ -161,11 +161,11 @@ func (tq *TaskQuery) All(ctx context.Context) ([]*Task, error) { // AllX is like All, but panics if an error occurs. func (tq *TaskQuery) AllX(ctx context.Context) []*Task { - ts, err := tq.All(ctx) + nodes, err := tq.All(ctx) if err != nil { panic(err) } - return ts + return nodes } // IDs executes the query and returns a list of Task ids. diff --git a/entc/integration/gremlin/ent/task_update.go b/entc/integration/gremlin/ent/task_update.go index 9e956a217..87138022e 100644 --- a/entc/integration/gremlin/ent/task_update.go +++ b/entc/integration/gremlin/ent/task_update.go @@ -227,11 +227,11 @@ func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error) { // SaveX is like Save, but panics if an error occurs. func (tuo *TaskUpdateOne) SaveX(ctx context.Context) *Task { - t, err := tuo.Save(ctx) + node, err := tuo.Save(ctx) if err != nil { panic(err) } - return t + return node } // Exec executes the query on the entity. diff --git a/entc/integration/gremlin/ent/tx.go b/entc/integration/gremlin/ent/tx.go index 814d4722d..31d102433 100644 --- a/entc/integration/gremlin/ent/tx.go +++ b/entc/integration/gremlin/ent/tx.go @@ -26,6 +26,8 @@ type Tx struct { File *FileClient // FileType is the client for interacting with the FileType builders. FileType *FileTypeClient + // Goods is the client for interacting with the Goods builders. + Goods *GoodsClient // Group is the client for interacting with the Group builders. Group *GroupClient // GroupInfo is the client for interacting with the GroupInfo builders. @@ -182,6 +184,7 @@ func (tx *Tx) init() { tx.FieldType = NewFieldTypeClient(tx.config) tx.File = NewFileClient(tx.config) tx.FileType = NewFileTypeClient(tx.config) + tx.Goods = NewGoodsClient(tx.config) tx.Group = NewGroupClient(tx.config) tx.GroupInfo = NewGroupInfoClient(tx.config) tx.Item = NewItemClient(tx.config) diff --git a/entc/integration/gremlin/ent/user_query.go b/entc/integration/gremlin/ent/user_query.go index c9b0a0845..507d1e53d 100644 --- a/entc/integration/gremlin/ent/user_query.go +++ b/entc/integration/gremlin/ent/user_query.go @@ -225,23 +225,23 @@ func (uq *UserQuery) QueryParent() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -268,13 +268,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) string { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -284,11 +284,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -327,11 +327,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/gremlin/ent/user_update.go b/entc/integration/gremlin/ent/user_update.go index c46132575..1b2fd2963 100644 --- a/entc/integration/gremlin/ent/user_update.go +++ b/entc/integration/gremlin/ent/user_update.go @@ -1379,11 +1379,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. diff --git a/entc/integration/hooks/ent/card_create.go b/entc/integration/hooks/ent/card_create.go index 9d26a908e..c101c3cb9 100644 --- a/entc/integration/hooks/ent/card_create.go +++ b/entc/integration/hooks/ent/card_create.go @@ -174,7 +174,7 @@ func (cc *CardCreate) check() error { } func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -182,13 +182,13 @@ func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { var ( - c = &Card{config: cc.config} + _node = &Card{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: card.Table, ID: &sqlgraph.FieldSpec{ @@ -203,7 +203,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldNumber, }) - c.Number = value + _node.Number = value } if value, ok := cc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -211,7 +211,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldName, }) - c.Name = value + _node.Name = value } if value, ok := cc.mutation.CreatedAt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -219,7 +219,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldCreatedAt, }) - c.CreatedAt = value + _node.CreatedAt = value } if value, ok := cc.mutation.InHook(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -227,7 +227,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldInHook, }) - c.InHook = value + _node.InHook = value } if nodes := cc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -248,7 +248,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CardCreateBulk is the builder for creating a bulk of Card entities. diff --git a/entc/integration/hooks/ent/card_query.go b/entc/integration/hooks/ent/card_query.go index 2e060eee6..07b26bfeb 100644 --- a/entc/integration/hooks/ent/card_query.go +++ b/entc/integration/hooks/ent/card_query.go @@ -84,23 +84,23 @@ func (cq *CardQuery) QueryOwner() *UserQuery { // First returns the first Card entity in the query. Returns *NotFoundError when no card was found. func (cq *CardQuery) First(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{card.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CardQuery) FirstX(ctx context.Context) *Card { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Card id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CardQuery) FirstXID(ctx context.Context) int { // Only returns the only Card entity in the query, returns an error if not exactly one entity was returned. func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{card.Label} default: @@ -143,11 +143,11 @@ func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CardQuery) OnlyX(ctx context.Context) *Card { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Card id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CardQuery) All(ctx context.Context) ([]*Card, error) { // AllX is like All, but panics if an error occurs. func (cq *CardQuery) AllX(ctx context.Context) []*Card { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Card ids. diff --git a/entc/integration/hooks/ent/card_update.go b/entc/integration/hooks/ent/card_update.go index 74ed5431f..d7bcddac4 100644 --- a/entc/integration/hooks/ent/card_update.go +++ b/entc/integration/hooks/ent/card_update.go @@ -353,11 +353,11 @@ func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -373,7 +373,7 @@ func (cuo *CardUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { +func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: card.Table, @@ -451,9 +451,9 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Card{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Card{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{card.Label} @@ -462,5 +462,5 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/hooks/ent/user_create.go b/entc/integration/hooks/ent/user_create.go index 3b9b62ba6..32c17b7e3 100644 --- a/entc/integration/hooks/ent/user_create.go +++ b/entc/integration/hooks/ent/user_create.go @@ -177,7 +177,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -185,13 +185,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -206,7 +206,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldVersion, }) - u.Version = value + _node.Version = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -214,7 +214,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if value, ok := uc.mutation.Worth(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -222,7 +222,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldWorth, }) - u.Worth = value + _node.Worth = value } if nodes := uc.mutation.CardsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -281,7 +281,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/hooks/ent/user_query.go b/entc/integration/hooks/ent/user_query.go index 070f1d1fa..2f19cc7a2 100644 --- a/entc/integration/hooks/ent/user_query.go +++ b/entc/integration/hooks/ent/user_query.go @@ -131,23 +131,23 @@ func (uq *UserQuery) QueryBestFriend() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -174,13 +174,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -190,11 +190,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -233,11 +233,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/hooks/ent/user_update.go b/entc/integration/hooks/ent/user_update.go index 8c9a41679..5c5416515 100644 --- a/entc/integration/hooks/ent/user_update.go +++ b/entc/integration/hooks/ent/user_update.go @@ -646,11 +646,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -666,7 +666,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -866,9 +866,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -877,5 +877,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/idtype/ent/user_create.go b/entc/integration/idtype/ent/user_create.go index 011d1b620..5997eae08 100644 --- a/entc/integration/idtype/ent/user_create.go +++ b/entc/integration/idtype/ent/user_create.go @@ -136,7 +136,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -144,13 +144,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = uint64(id) - return u, nil + _node.ID = uint64(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -165,7 +165,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.SpouseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -224,7 +224,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/idtype/ent/user_query.go b/entc/integration/idtype/ent/user_query.go index 2ec30ed0a..f016fb5d4 100644 --- a/entc/integration/idtype/ent/user_query.go +++ b/entc/integration/idtype/ent/user_query.go @@ -130,23 +130,23 @@ func (uq *UserQuery) QueryFollowing() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -173,13 +173,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) uint64 { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -189,11 +189,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -232,11 +232,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/idtype/ent/user_update.go b/entc/integration/idtype/ent/user_update.go index 574861811..7e756a60a 100644 --- a/entc/integration/idtype/ent/user_update.go +++ b/entc/integration/idtype/ent/user_update.go @@ -515,11 +515,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -535,7 +535,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -701,9 +701,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -712,5 +712,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/json/ent/user_create.go b/entc/integration/json/ent/user_create.go index 406ab78a3..385f60c89 100644 --- a/entc/integration/json/ent/user_create.go +++ b/entc/integration/json/ent/user_create.go @@ -123,7 +123,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -131,13 +131,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -152,7 +152,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldT, }) - u.T = value + _node.T = value } if value, ok := uc.mutation.URL(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -160,7 +160,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldURL, }) - u.URL = value + _node.URL = value } if value, ok := uc.mutation.Raw(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -168,7 +168,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldRaw, }) - u.Raw = value + _node.Raw = value } if value, ok := uc.mutation.Dirs(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -176,7 +176,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldDirs, }) - u.Dirs = value + _node.Dirs = value } if value, ok := uc.mutation.Ints(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -184,7 +184,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldInts, }) - u.Ints = value + _node.Ints = value } if value, ok := uc.mutation.Floats(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -192,7 +192,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldFloats, }) - u.Floats = value + _node.Floats = value } if value, ok := uc.mutation.Strings(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -200,9 +200,9 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldStrings, }) - u.Strings = value + _node.Strings = value } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/json/ent/user_query.go b/entc/integration/json/ent/user_query.go index 73f9500f9..7c518b431 100644 --- a/entc/integration/json/ent/user_query.go +++ b/entc/integration/json/ent/user_query.go @@ -58,23 +58,23 @@ func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -117,11 +117,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/json/ent/user_update.go b/entc/integration/json/ent/user_update.go index e6f32218b..b0def7592 100644 --- a/entc/integration/json/ent/user_update.go +++ b/entc/integration/json/ent/user_update.go @@ -422,11 +422,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -442,7 +442,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -549,9 +549,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { Column: user.FieldStrings, }) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -560,5 +560,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/migrate/entv1/car_create.go b/entc/integration/migrate/entv1/car_create.go index 5e6aa2bfe..ce5065083 100644 --- a/entc/integration/migrate/entv1/car_create.go +++ b/entc/integration/migrate/entv1/car_create.go @@ -97,7 +97,7 @@ func (cc *CarCreate) check() error { } func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -105,13 +105,13 @@ func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { var ( - c = &Car{config: cc.config} + _node = &Car{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: car.Table, ID: &sqlgraph.FieldSpec{ @@ -139,7 +139,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CarCreateBulk is the builder for creating a bulk of Car entities. diff --git a/entc/integration/migrate/entv1/car_query.go b/entc/integration/migrate/entv1/car_query.go index 16bf1f73d..280f6fcc3 100644 --- a/entc/integration/migrate/entv1/car_query.go +++ b/entc/integration/migrate/entv1/car_query.go @@ -84,23 +84,23 @@ func (cq *CarQuery) QueryOwner() *UserQuery { // First returns the first Car entity in the query. Returns *NotFoundError when no car was found. func (cq *CarQuery) First(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{car.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CarQuery) FirstX(ctx context.Context) *Car { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Car id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CarQuery) FirstXID(ctx context.Context) int { // Only returns the only Car entity in the query, returns an error if not exactly one entity was returned. func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{car.Label} default: @@ -143,11 +143,11 @@ func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CarQuery) OnlyX(ctx context.Context) *Car { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Car id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CarQuery) All(ctx context.Context) ([]*Car, error) { // AllX is like All, but panics if an error occurs. func (cq *CarQuery) AllX(ctx context.Context) []*Car { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Car ids. diff --git a/entc/integration/migrate/entv1/car_update.go b/entc/integration/migrate/entv1/car_update.go index 17ea9c4da..bc829da16 100644 --- a/entc/integration/migrate/entv1/car_update.go +++ b/entc/integration/migrate/entv1/car_update.go @@ -245,11 +245,11 @@ func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CarUpdateOne) SaveX(ctx context.Context) *Car { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -265,7 +265,7 @@ func (cuo *CarUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { +func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: car.Table, @@ -316,9 +316,9 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Car{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Car{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{car.Label} @@ -327,5 +327,5 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/migrate/entv1/user_create.go b/entc/integration/migrate/entv1/user_create.go index edd45d3f5..01a4a1a4e 100644 --- a/entc/integration/migrate/entv1/user_create.go +++ b/entc/integration/migrate/entv1/user_create.go @@ -256,23 +256,23 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - if u.ID == 0 { + if _node.ID == 0 { id := _spec.ID.Value.(int64) - u.ID = int(id) + _node.ID = int(id) } - return u, nil + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -282,7 +282,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } ) if id, ok := uc.mutation.ID(); ok { - u.ID = id + _node.ID = id _spec.ID.Value = id } if value, ok := uc.mutation.Age(); ok { @@ -291,7 +291,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -299,7 +299,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if value, ok := uc.mutation.Nickname(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -307,7 +307,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldNickname, }) - u.Nickname = value + _node.Nickname = value } if value, ok := uc.mutation.Address(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -315,7 +315,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAddress, }) - u.Address = value + _node.Address = value } if value, ok := uc.mutation.Renamed(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -323,7 +323,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldRenamed, }) - u.Renamed = value + _node.Renamed = value } if value, ok := uc.mutation.Blob(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -331,7 +331,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldBlob, }) - u.Blob = value + _node.Blob = value } if value, ok := uc.mutation.State(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -339,7 +339,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldState, }) - u.State = value + _node.State = value } if value, ok := uc.mutation.Status(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -347,7 +347,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldStatus, }) - u.Status = value + _node.Status = value } if nodes := uc.mutation.ParentIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -425,7 +425,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/migrate/entv1/user_query.go b/entc/integration/migrate/entv1/user_query.go index 10b83184a..179c59b68 100644 --- a/entc/integration/migrate/entv1/user_query.go +++ b/entc/integration/migrate/entv1/user_query.go @@ -154,23 +154,23 @@ func (uq *UserQuery) QueryCar() *CarQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -197,13 +197,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -213,11 +213,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -256,11 +256,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/migrate/entv1/user_update.go b/entc/integration/migrate/entv1/user_update.go index be8a9d98f..1585e1a2b 100644 --- a/entc/integration/migrate/entv1/user_update.go +++ b/entc/integration/migrate/entv1/user_update.go @@ -895,11 +895,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -930,7 +930,7 @@ func (uuo *UserUpdateOne) check() error { return nil } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -1198,9 +1198,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -1209,5 +1209,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/migrate/entv2/car_create.go b/entc/integration/migrate/entv2/car_create.go index 2071a3252..b627b5e10 100644 --- a/entc/integration/migrate/entv2/car_create.go +++ b/entc/integration/migrate/entv2/car_create.go @@ -97,7 +97,7 @@ func (cc *CarCreate) check() error { } func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -105,13 +105,13 @@ func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { var ( - c = &Car{config: cc.config} + _node = &Car{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: car.Table, ID: &sqlgraph.FieldSpec{ @@ -139,7 +139,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CarCreateBulk is the builder for creating a bulk of Car entities. diff --git a/entc/integration/migrate/entv2/car_query.go b/entc/integration/migrate/entv2/car_query.go index ff4667348..c6b076c3d 100644 --- a/entc/integration/migrate/entv2/car_query.go +++ b/entc/integration/migrate/entv2/car_query.go @@ -84,23 +84,23 @@ func (cq *CarQuery) QueryOwner() *UserQuery { // First returns the first Car entity in the query. Returns *NotFoundError when no car was found. func (cq *CarQuery) First(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{car.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CarQuery) FirstX(ctx context.Context) *Car { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Car id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CarQuery) FirstXID(ctx context.Context) int { // Only returns the only Car entity in the query, returns an error if not exactly one entity was returned. func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{car.Label} default: @@ -143,11 +143,11 @@ func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CarQuery) OnlyX(ctx context.Context) *Car { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Car id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CarQuery) All(ctx context.Context) ([]*Car, error) { // AllX is like All, but panics if an error occurs. func (cq *CarQuery) AllX(ctx context.Context) []*Car { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Car ids. diff --git a/entc/integration/migrate/entv2/car_update.go b/entc/integration/migrate/entv2/car_update.go index 7c3dc752b..bbaa155b5 100644 --- a/entc/integration/migrate/entv2/car_update.go +++ b/entc/integration/migrate/entv2/car_update.go @@ -245,11 +245,11 @@ func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CarUpdateOne) SaveX(ctx context.Context) *Car { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -265,7 +265,7 @@ func (cuo *CarUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { +func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: car.Table, @@ -316,9 +316,9 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Car{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Car{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{car.Label} @@ -327,5 +327,5 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/entc/integration/migrate/entv2/group_create.go b/entc/integration/migrate/entv2/group_create.go index 2d6552934..fa8fc220b 100644 --- a/entc/integration/migrate/entv2/group_create.go +++ b/entc/integration/migrate/entv2/group_create.go @@ -77,7 +77,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -85,13 +85,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -100,7 +100,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { }, } ) - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/entc/integration/migrate/entv2/group_query.go b/entc/integration/migrate/entv2/group_query.go index 9ce580dbf..98ee2a1db 100644 --- a/entc/integration/migrate/entv2/group_query.go +++ b/entc/integration/migrate/entv2/group_query.go @@ -58,23 +58,23 @@ func (gq *GroupQuery) Order(o ...OrderFunc) *GroupQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -117,11 +117,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/entc/integration/migrate/entv2/group_update.go b/entc/integration/migrate/entv2/group_update.go index 2daa88a99..07b69a559 100644 --- a/entc/integration/migrate/entv2/group_update.go +++ b/entc/integration/migrate/entv2/group_update.go @@ -159,11 +159,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -179,7 +179,7 @@ func (guo *GroupUpdateOne) ExecX(ctx context.Context) { } } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -195,9 +195,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -206,5 +206,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/entc/integration/migrate/entv2/pet_create.go b/entc/integration/migrate/entv2/pet_create.go index 7fd3264df..d541a756b 100644 --- a/entc/integration/migrate/entv2/pet_create.go +++ b/entc/integration/migrate/entv2/pet_create.go @@ -97,7 +97,7 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -105,13 +105,13 @@ func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { return nil, err } id := _spec.ID.Value.(int64) - pe.ID = int(id) - return pe, nil + _node.ID = int(id) + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -139,7 +139,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/entc/integration/migrate/entv2/pet_query.go b/entc/integration/migrate/entv2/pet_query.go index a67904b11..92ab0d5ac 100644 --- a/entc/integration/migrate/entv2/pet_query.go +++ b/entc/integration/migrate/entv2/pet_query.go @@ -84,23 +84,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) int { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -143,11 +143,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/entc/integration/migrate/entv2/pet_update.go b/entc/integration/migrate/entv2/pet_update.go index 6a15508d2..8c57b855b 100644 --- a/entc/integration/migrate/entv2/pet_update.go +++ b/entc/integration/migrate/entv2/pet_update.go @@ -245,11 +245,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -265,7 +265,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -316,9 +316,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -327,5 +327,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/entc/integration/migrate/entv2/user_create.go b/entc/integration/migrate/entv2/user_create.go index bcfe3a2fc..0485ac25d 100644 --- a/entc/integration/migrate/entv2/user_create.go +++ b/entc/integration/migrate/entv2/user_create.go @@ -320,23 +320,23 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr } return nil, err } - if u.ID == 0 { + if _node.ID == 0 { id := _spec.ID.Value.(int64) - u.ID = int(id) + _node.ID = int(id) } - return u, nil + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -346,7 +346,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } ) if id, ok := uc.mutation.ID(); ok { - u.ID = id + _node.ID = id _spec.ID.Value = id } if value, ok := uc.mutation.MixedString(); ok { @@ -355,7 +355,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldMixedString, }) - u.MixedString = value + _node.MixedString = value } if value, ok := uc.mutation.MixedEnum(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -363,7 +363,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldMixedEnum, }) - u.MixedEnum = value + _node.MixedEnum = value } if value, ok := uc.mutation.Age(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -371,7 +371,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -379,7 +379,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if value, ok := uc.mutation.Nickname(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -387,7 +387,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldNickname, }) - u.Nickname = value + _node.Nickname = value } if value, ok := uc.mutation.Phone(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -395,7 +395,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldPhone, }) - u.Phone = value + _node.Phone = value } if value, ok := uc.mutation.Buffer(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -403,7 +403,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldBuffer, }) - u.Buffer = value + _node.Buffer = value } if value, ok := uc.mutation.Title(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -411,7 +411,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldTitle, }) - u.Title = value + _node.Title = value } if value, ok := uc.mutation.NewName(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -419,7 +419,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldNewName, }) - u.NewName = value + _node.NewName = value } if value, ok := uc.mutation.Blob(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -427,7 +427,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldBlob, }) - u.Blob = value + _node.Blob = value } if value, ok := uc.mutation.State(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -435,7 +435,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldState, }) - u.State = value + _node.State = value } if value, ok := uc.mutation.Status(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -443,7 +443,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldStatus, }) - u.Status = value + _node.Status = value } if nodes := uc.mutation.CarIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -502,7 +502,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/migrate/entv2/user_query.go b/entc/integration/migrate/entv2/user_query.go index ce58108d8..009394016 100644 --- a/entc/integration/migrate/entv2/user_query.go +++ b/entc/integration/migrate/entv2/user_query.go @@ -131,23 +131,23 @@ func (uq *UserQuery) QueryFriends() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -174,13 +174,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -190,11 +190,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -233,11 +233,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/migrate/entv2/user_update.go b/entc/integration/migrate/entv2/user_update.go index f4dca82a1..4e816e6a6 100644 --- a/entc/integration/migrate/entv2/user_update.go +++ b/entc/integration/migrate/entv2/user_update.go @@ -981,11 +981,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -1021,7 +1021,7 @@ func (uuo *UserUpdateOne) check() error { return nil } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -1301,9 +1301,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -1312,5 +1312,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/entc/integration/privacy/ent/galaxy_create.go b/entc/integration/privacy/ent/galaxy_create.go index be9dc4c8c..bdd7db9ae 100644 --- a/entc/integration/privacy/ent/galaxy_create.go +++ b/entc/integration/privacy/ent/galaxy_create.go @@ -122,7 +122,7 @@ func (gc *GalaxyCreate) check() error { } func (gc *GalaxyCreate) sqlSave(ctx context.Context) (*Galaxy, error) { - ga, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -130,13 +130,13 @@ func (gc *GalaxyCreate) sqlSave(ctx context.Context) (*Galaxy, error) { return nil, err } id := _spec.ID.Value.(int64) - ga.ID = int(id) - return ga, nil + _node.ID = int(id) + return _node, nil } func (gc *GalaxyCreate) createSpec() (*Galaxy, *sqlgraph.CreateSpec) { var ( - ga = &Galaxy{config: gc.config} + _node = &Galaxy{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: galaxy.Table, ID: &sqlgraph.FieldSpec{ @@ -151,7 +151,7 @@ func (gc *GalaxyCreate) createSpec() (*Galaxy, *sqlgraph.CreateSpec) { Value: value, Column: galaxy.FieldName, }) - ga.Name = value + _node.Name = value } if value, ok := gc.mutation.GetType(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -159,7 +159,7 @@ func (gc *GalaxyCreate) createSpec() (*Galaxy, *sqlgraph.CreateSpec) { Value: value, Column: galaxy.FieldType, }) - ga.Type = value + _node.Type = value } if nodes := gc.mutation.PlanetsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -180,7 +180,7 @@ func (gc *GalaxyCreate) createSpec() (*Galaxy, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return ga, _spec + return _node, _spec } // GalaxyCreateBulk is the builder for creating a bulk of Galaxy entities. diff --git a/entc/integration/privacy/ent/galaxy_query.go b/entc/integration/privacy/ent/galaxy_query.go index 1d6be7a73..20ccde7e4 100644 --- a/entc/integration/privacy/ent/galaxy_query.go +++ b/entc/integration/privacy/ent/galaxy_query.go @@ -84,23 +84,23 @@ func (gq *GalaxyQuery) QueryPlanets() *PlanetQuery { // First returns the first Galaxy entity in the query. Returns *NotFoundError when no galaxy was found. func (gq *GalaxyQuery) First(ctx context.Context) (*Galaxy, error) { - gas, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(gas) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{galaxy.Label} } - return gas[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GalaxyQuery) FirstX(ctx context.Context) *Galaxy { - ga, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return ga + return node } // FirstID returns the first Galaxy id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (gq *GalaxyQuery) FirstXID(ctx context.Context) int { // Only returns the only Galaxy entity in the query, returns an error if not exactly one entity was returned. func (gq *GalaxyQuery) Only(ctx context.Context) (*Galaxy, error) { - gas, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(gas) { + switch len(nodes) { case 1: - return gas[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{galaxy.Label} default: @@ -143,11 +143,11 @@ func (gq *GalaxyQuery) Only(ctx context.Context) (*Galaxy, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GalaxyQuery) OnlyX(ctx context.Context) *Galaxy { - ga, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return ga + return node } // OnlyID returns the only Galaxy id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (gq *GalaxyQuery) All(ctx context.Context) ([]*Galaxy, error) { // AllX is like All, but panics if an error occurs. func (gq *GalaxyQuery) AllX(ctx context.Context) []*Galaxy { - gas, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return gas + return nodes } // IDs executes the query and returns a list of Galaxy ids. diff --git a/entc/integration/privacy/ent/galaxy_update.go b/entc/integration/privacy/ent/galaxy_update.go index a957db2b2..c2644bba1 100644 --- a/entc/integration/privacy/ent/galaxy_update.go +++ b/entc/integration/privacy/ent/galaxy_update.go @@ -351,11 +351,11 @@ func (guo *GalaxyUpdateOne) Save(ctx context.Context) (*Galaxy, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GalaxyUpdateOne) SaveX(ctx context.Context) *Galaxy { - ga, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return ga + return node } // Exec executes the query on the entity. @@ -386,7 +386,7 @@ func (guo *GalaxyUpdateOne) check() error { return nil } -func (guo *GalaxyUpdateOne) sqlSave(ctx context.Context) (ga *Galaxy, err error) { +func (guo *GalaxyUpdateOne) sqlSave(ctx context.Context) (_node *Galaxy, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: galaxy.Table, @@ -470,9 +470,9 @@ func (guo *GalaxyUpdateOne) sqlSave(ctx context.Context) (ga *Galaxy, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - ga = &Galaxy{config: guo.config} - _spec.Assign = ga.assignValues - _spec.ScanValues = ga.scanValues() + _node = &Galaxy{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{galaxy.Label} @@ -481,5 +481,5 @@ func (guo *GalaxyUpdateOne) sqlSave(ctx context.Context) (ga *Galaxy, err error) } return nil, err } - return ga, nil + return _node, nil } diff --git a/entc/integration/privacy/ent/planet_create.go b/entc/integration/privacy/ent/planet_create.go index bd604ada9..ad34627bf 100644 --- a/entc/integration/privacy/ent/planet_create.go +++ b/entc/integration/privacy/ent/planet_create.go @@ -121,7 +121,7 @@ func (pc *PlanetCreate) check() error { } func (pc *PlanetCreate) sqlSave(ctx context.Context) (*Planet, error) { - pl, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -129,13 +129,13 @@ func (pc *PlanetCreate) sqlSave(ctx context.Context) (*Planet, error) { return nil, err } id := _spec.ID.Value.(int64) - pl.ID = int(id) - return pl, nil + _node.ID = int(id) + return _node, nil } func (pc *PlanetCreate) createSpec() (*Planet, *sqlgraph.CreateSpec) { var ( - pl = &Planet{config: pc.config} + _node = &Planet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: planet.Table, ID: &sqlgraph.FieldSpec{ @@ -150,7 +150,7 @@ func (pc *PlanetCreate) createSpec() (*Planet, *sqlgraph.CreateSpec) { Value: value, Column: planet.FieldName, }) - pl.Name = value + _node.Name = value } if value, ok := pc.mutation.Age(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -158,7 +158,7 @@ func (pc *PlanetCreate) createSpec() (*Planet, *sqlgraph.CreateSpec) { Value: value, Column: planet.FieldAge, }) - pl.Age = value + _node.Age = value } if nodes := pc.mutation.NeighborsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -179,7 +179,7 @@ func (pc *PlanetCreate) createSpec() (*Planet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pl, _spec + return _node, _spec } // PlanetCreateBulk is the builder for creating a bulk of Planet entities. diff --git a/entc/integration/privacy/ent/planet_query.go b/entc/integration/privacy/ent/planet_query.go index a618f076b..54cf3b8e1 100644 --- a/entc/integration/privacy/ent/planet_query.go +++ b/entc/integration/privacy/ent/planet_query.go @@ -84,23 +84,23 @@ func (pq *PlanetQuery) QueryNeighbors() *PlanetQuery { // First returns the first Planet entity in the query. Returns *NotFoundError when no planet was found. func (pq *PlanetQuery) First(ctx context.Context) (*Planet, error) { - pls, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pls) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{planet.Label} } - return pls[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PlanetQuery) FirstX(ctx context.Context) *Planet { - pl, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pl + return node } // FirstID returns the first Planet id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (pq *PlanetQuery) FirstXID(ctx context.Context) int { // Only returns the only Planet entity in the query, returns an error if not exactly one entity was returned. func (pq *PlanetQuery) Only(ctx context.Context) (*Planet, error) { - pls, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pls) { + switch len(nodes) { case 1: - return pls[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{planet.Label} default: @@ -143,11 +143,11 @@ func (pq *PlanetQuery) Only(ctx context.Context) (*Planet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PlanetQuery) OnlyX(ctx context.Context) *Planet { - pl, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pl + return node } // OnlyID returns the only Planet id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (pq *PlanetQuery) All(ctx context.Context) ([]*Planet, error) { // AllX is like All, but panics if an error occurs. func (pq *PlanetQuery) AllX(ctx context.Context) []*Planet { - pls, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pls + return nodes } // IDs executes the query and returns a list of Planet ids. diff --git a/entc/integration/privacy/ent/planet_update.go b/entc/integration/privacy/ent/planet_update.go index 3393b155c..8e14c8c8b 100644 --- a/entc/integration/privacy/ent/planet_update.go +++ b/entc/integration/privacy/ent/planet_update.go @@ -359,11 +359,11 @@ func (puo *PlanetUpdateOne) Save(ctx context.Context) (*Planet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PlanetUpdateOne) SaveX(ctx context.Context) *Planet { - pl, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pl + return node } // Exec executes the query on the entity. @@ -379,7 +379,7 @@ func (puo *PlanetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PlanetUpdateOne) sqlSave(ctx context.Context) (pl *Planet, err error) { +func (puo *PlanetUpdateOne) sqlSave(ctx context.Context) (_node *Planet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: planet.Table, @@ -469,9 +469,9 @@ func (puo *PlanetUpdateOne) sqlSave(ctx context.Context) (pl *Planet, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pl = &Planet{config: puo.config} - _spec.Assign = pl.assignValues - _spec.ScanValues = pl.scanValues() + _node = &Planet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{planet.Label} @@ -480,5 +480,5 @@ func (puo *PlanetUpdateOne) sqlSave(ctx context.Context) (pl *Planet, err error) } return nil, err } - return pl, nil + return _node, nil } diff --git a/entc/integration/template/ent/group_create.go b/entc/integration/template/ent/group_create.go index 28f710a43..ceed8de5a 100644 --- a/entc/integration/template/ent/group_create.go +++ b/entc/integration/template/ent/group_create.go @@ -87,7 +87,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -95,13 +95,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -116,9 +116,9 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldMaxUsers, }) - gr.MaxUsers = value + _node.MaxUsers = value } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/entc/integration/template/ent/group_query.go b/entc/integration/template/ent/group_query.go index 92778378a..f61befd4c 100644 --- a/entc/integration/template/ent/group_query.go +++ b/entc/integration/template/ent/group_query.go @@ -58,23 +58,23 @@ func (gq *GroupQuery) Order(o ...OrderFunc) *GroupQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -117,11 +117,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/entc/integration/template/ent/group_update.go b/entc/integration/template/ent/group_update.go index 18b285940..f25f7dceb 100644 --- a/entc/integration/template/ent/group_update.go +++ b/entc/integration/template/ent/group_update.go @@ -199,11 +199,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -219,7 +219,7 @@ func (guo *GroupUpdateOne) ExecX(ctx context.Context) { } } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -249,9 +249,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { Column: group.FieldMaxUsers, }) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -260,5 +260,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/entc/integration/template/ent/pet_create.go b/entc/integration/template/ent/pet_create.go index 1b09d5940..09cbfff0b 100644 --- a/entc/integration/template/ent/pet_create.go +++ b/entc/integration/template/ent/pet_create.go @@ -122,7 +122,7 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -130,13 +130,13 @@ func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { return nil, err } id := _spec.ID.Value.(int64) - pe.ID = int(id) - return pe, nil + _node.ID = int(id) + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -151,7 +151,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { Value: value, Column: pet.FieldAge, }) - pe.Age = value + _node.Age = value } if value, ok := pc.mutation.LicensedAt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -159,7 +159,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { Value: value, Column: pet.FieldLicensedAt, }) - pe.LicensedAt = &value + _node.LicensedAt = &value } if nodes := pc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -180,7 +180,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/entc/integration/template/ent/pet_query.go b/entc/integration/template/ent/pet_query.go index b3398036a..ba91fe9f3 100644 --- a/entc/integration/template/ent/pet_query.go +++ b/entc/integration/template/ent/pet_query.go @@ -84,23 +84,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) int { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -143,11 +143,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/entc/integration/template/ent/pet_update.go b/entc/integration/template/ent/pet_update.go index 50e2bc792..23c77d426 100644 --- a/entc/integration/template/ent/pet_update.go +++ b/entc/integration/template/ent/pet_update.go @@ -339,11 +339,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -359,7 +359,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -437,9 +437,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -448,5 +448,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/entc/integration/template/ent/user_create.go b/entc/integration/template/ent/user_create.go index 89d8c079d..f88f29511 100644 --- a/entc/integration/template/ent/user_create.go +++ b/entc/integration/template/ent/user_create.go @@ -118,7 +118,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -126,13 +126,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -147,7 +147,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.PetsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -187,7 +187,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/entc/integration/template/ent/user_query.go b/entc/integration/template/ent/user_query.go index 23207e535..d4bf9365e 100644 --- a/entc/integration/template/ent/user_query.go +++ b/entc/integration/template/ent/user_query.go @@ -107,23 +107,23 @@ func (uq *UserQuery) QueryFriends() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -166,11 +166,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/entc/integration/template/ent/user_update.go b/entc/integration/template/ent/user_update.go index f24372a10..a0de5206e 100644 --- a/entc/integration/template/ent/user_update.go +++ b/entc/integration/template/ent/user_update.go @@ -431,11 +431,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -451,7 +451,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -582,9 +582,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -593,5 +593,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/edgeindex/ent/city_create.go b/examples/edgeindex/ent/city_create.go index 77d2f9122..abc2b9d67 100644 --- a/examples/edgeindex/ent/city_create.go +++ b/examples/edgeindex/ent/city_create.go @@ -103,7 +103,7 @@ func (cc *CityCreate) check() error { } func (cc *CityCreate) sqlSave(ctx context.Context) (*City, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -111,13 +111,13 @@ func (cc *CityCreate) sqlSave(ctx context.Context) (*City, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CityCreate) createSpec() (*City, *sqlgraph.CreateSpec) { var ( - c = &City{config: cc.config} + _node = &City{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: city.Table, ID: &sqlgraph.FieldSpec{ @@ -132,7 +132,7 @@ func (cc *CityCreate) createSpec() (*City, *sqlgraph.CreateSpec) { Value: value, Column: city.FieldName, }) - c.Name = value + _node.Name = value } if nodes := cc.mutation.StreetsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -153,7 +153,7 @@ func (cc *CityCreate) createSpec() (*City, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CityCreateBulk is the builder for creating a bulk of City entities. diff --git a/examples/edgeindex/ent/city_query.go b/examples/edgeindex/ent/city_query.go index 7905acfdd..3d306faeb 100644 --- a/examples/edgeindex/ent/city_query.go +++ b/examples/edgeindex/ent/city_query.go @@ -84,23 +84,23 @@ func (cq *CityQuery) QueryStreets() *StreetQuery { // First returns the first City entity in the query. Returns *NotFoundError when no city was found. func (cq *CityQuery) First(ctx context.Context) (*City, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{city.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CityQuery) FirstX(ctx context.Context) *City { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first City id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CityQuery) FirstXID(ctx context.Context) int { // Only returns the only City entity in the query, returns an error if not exactly one entity was returned. func (cq *CityQuery) Only(ctx context.Context) (*City, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{city.Label} default: @@ -143,11 +143,11 @@ func (cq *CityQuery) Only(ctx context.Context) (*City, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CityQuery) OnlyX(ctx context.Context) *City { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only City id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CityQuery) All(ctx context.Context) ([]*City, error) { // AllX is like All, but panics if an error occurs. func (cq *CityQuery) AllX(ctx context.Context) []*City { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of City ids. diff --git a/examples/edgeindex/ent/city_update.go b/examples/edgeindex/ent/city_update.go index 063eb9455..07e92aaf8 100644 --- a/examples/edgeindex/ent/city_update.go +++ b/examples/edgeindex/ent/city_update.go @@ -305,11 +305,11 @@ func (cuo *CityUpdateOne) Save(ctx context.Context) (*City, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CityUpdateOne) SaveX(ctx context.Context) *City { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -325,7 +325,7 @@ func (cuo *CityUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CityUpdateOne) sqlSave(ctx context.Context) (c *City, err error) { +func (cuo *CityUpdateOne) sqlSave(ctx context.Context) (_node *City, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: city.Table, @@ -402,9 +402,9 @@ func (cuo *CityUpdateOne) sqlSave(ctx context.Context) (c *City, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &City{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &City{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{city.Label} @@ -413,5 +413,5 @@ func (cuo *CityUpdateOne) sqlSave(ctx context.Context) (c *City, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/examples/edgeindex/ent/street_create.go b/examples/edgeindex/ent/street_create.go index 740d4cdb3..50292372a 100644 --- a/examples/edgeindex/ent/street_create.go +++ b/examples/edgeindex/ent/street_create.go @@ -107,7 +107,7 @@ func (sc *StreetCreate) check() error { } func (sc *StreetCreate) sqlSave(ctx context.Context) (*Street, error) { - s, _spec := sc.createSpec() + _node, _spec := sc.createSpec() if err := sqlgraph.CreateNode(ctx, sc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -115,13 +115,13 @@ func (sc *StreetCreate) sqlSave(ctx context.Context) (*Street, error) { return nil, err } id := _spec.ID.Value.(int64) - s.ID = int(id) - return s, nil + _node.ID = int(id) + return _node, nil } func (sc *StreetCreate) createSpec() (*Street, *sqlgraph.CreateSpec) { var ( - s = &Street{config: sc.config} + _node = &Street{config: sc.config} _spec = &sqlgraph.CreateSpec{ Table: street.Table, ID: &sqlgraph.FieldSpec{ @@ -136,7 +136,7 @@ func (sc *StreetCreate) createSpec() (*Street, *sqlgraph.CreateSpec) { Value: value, Column: street.FieldName, }) - s.Name = value + _node.Name = value } if nodes := sc.mutation.CityIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -157,7 +157,7 @@ func (sc *StreetCreate) createSpec() (*Street, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return s, _spec + return _node, _spec } // StreetCreateBulk is the builder for creating a bulk of Street entities. diff --git a/examples/edgeindex/ent/street_query.go b/examples/edgeindex/ent/street_query.go index d5f01593b..00738b866 100644 --- a/examples/edgeindex/ent/street_query.go +++ b/examples/edgeindex/ent/street_query.go @@ -84,23 +84,23 @@ func (sq *StreetQuery) QueryCity() *CityQuery { // First returns the first Street entity in the query. Returns *NotFoundError when no street was found. func (sq *StreetQuery) First(ctx context.Context) (*Street, error) { - sSlice, err := sq.Limit(1).All(ctx) + nodes, err := sq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(sSlice) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{street.Label} } - return sSlice[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (sq *StreetQuery) FirstX(ctx context.Context) *Street { - s, err := sq.First(ctx) + node, err := sq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return s + return node } // FirstID returns the first Street id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (sq *StreetQuery) FirstXID(ctx context.Context) int { // Only returns the only Street entity in the query, returns an error if not exactly one entity was returned. func (sq *StreetQuery) Only(ctx context.Context) (*Street, error) { - sSlice, err := sq.Limit(2).All(ctx) + nodes, err := sq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(sSlice) { + switch len(nodes) { case 1: - return sSlice[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{street.Label} default: @@ -143,11 +143,11 @@ func (sq *StreetQuery) Only(ctx context.Context) (*Street, error) { // OnlyX is like Only, but panics if an error occurs. func (sq *StreetQuery) OnlyX(ctx context.Context) *Street { - s, err := sq.Only(ctx) + node, err := sq.Only(ctx) if err != nil { panic(err) } - return s + return node } // OnlyID returns the only Street id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (sq *StreetQuery) All(ctx context.Context) ([]*Street, error) { // AllX is like All, but panics if an error occurs. func (sq *StreetQuery) AllX(ctx context.Context) []*Street { - sSlice, err := sq.All(ctx) + nodes, err := sq.All(ctx) if err != nil { panic(err) } - return sSlice + return nodes } // IDs executes the query and returns a list of Street ids. diff --git a/examples/edgeindex/ent/street_update.go b/examples/edgeindex/ent/street_update.go index 2d418da9f..8b0acc006 100644 --- a/examples/edgeindex/ent/street_update.go +++ b/examples/edgeindex/ent/street_update.go @@ -264,11 +264,11 @@ func (suo *StreetUpdateOne) Save(ctx context.Context) (*Street, error) { // SaveX is like Save, but panics if an error occurs. func (suo *StreetUpdateOne) SaveX(ctx context.Context) *Street { - s, err := suo.Save(ctx) + node, err := suo.Save(ctx) if err != nil { panic(err) } - return s + return node } // Exec executes the query on the entity. @@ -284,7 +284,7 @@ func (suo *StreetUpdateOne) ExecX(ctx context.Context) { } } -func (suo *StreetUpdateOne) sqlSave(ctx context.Context) (s *Street, err error) { +func (suo *StreetUpdateOne) sqlSave(ctx context.Context) (_node *Street, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: street.Table, @@ -342,9 +342,9 @@ func (suo *StreetUpdateOne) sqlSave(ctx context.Context) (s *Street, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - s = &Street{config: suo.config} - _spec.Assign = s.assignValues - _spec.ScanValues = s.scanValues() + _node = &Street{config: suo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, suo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{street.Label} @@ -353,5 +353,5 @@ func (suo *StreetUpdateOne) sqlSave(ctx context.Context) (s *Street, err error) } return nil, err } - return s, nil + return _node, nil } diff --git a/examples/entcpkg/ent/user_create.go b/examples/entcpkg/ent/user_create.go index e75f4e56e..361bbda6b 100644 --- a/examples/entcpkg/ent/user_create.go +++ b/examples/entcpkg/ent/user_create.go @@ -77,7 +77,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -85,13 +85,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -100,7 +100,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { }, } ) - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/entcpkg/ent/user_query.go b/examples/entcpkg/ent/user_query.go index 1832bd4f8..1e7cf9840 100644 --- a/examples/entcpkg/ent/user_query.go +++ b/examples/entcpkg/ent/user_query.go @@ -58,23 +58,23 @@ func (uq *UserQuery) Order(o ...OrderFunc) *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -101,13 +101,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -117,11 +117,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -160,11 +160,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/entcpkg/ent/user_update.go b/examples/entcpkg/ent/user_update.go index 26272c3bc..e733af3a9 100644 --- a/examples/entcpkg/ent/user_update.go +++ b/examples/entcpkg/ent/user_update.go @@ -159,11 +159,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -179,7 +179,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -195,9 +195,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -206,5 +206,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/m2m2types/ent/group_create.go b/examples/m2m2types/ent/group_create.go index 136db07c3..d2245e85b 100644 --- a/examples/m2m2types/ent/group_create.go +++ b/examples/m2m2types/ent/group_create.go @@ -103,7 +103,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -111,13 +111,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -132,7 +132,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldName, }) - gr.Name = value + _node.Name = value } if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -153,7 +153,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/examples/m2m2types/ent/group_query.go b/examples/m2m2types/ent/group_query.go index 4ca67251e..40e7781f6 100644 --- a/examples/m2m2types/ent/group_query.go +++ b/examples/m2m2types/ent/group_query.go @@ -84,23 +84,23 @@ func (gq *GroupQuery) QueryUsers() *UserQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -143,11 +143,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/examples/m2m2types/ent/group_update.go b/examples/m2m2types/ent/group_update.go index d50b5f666..50257ddf1 100644 --- a/examples/m2m2types/ent/group_update.go +++ b/examples/m2m2types/ent/group_update.go @@ -305,11 +305,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -325,7 +325,7 @@ func (guo *GroupUpdateOne) ExecX(ctx context.Context) { } } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -402,9 +402,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -413,5 +413,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/examples/m2m2types/ent/user_create.go b/examples/m2m2types/ent/user_create.go index d441ce428..d47d740a0 100644 --- a/examples/m2m2types/ent/user_create.go +++ b/examples/m2m2types/ent/user_create.go @@ -112,7 +112,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -120,13 +120,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -141,7 +141,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -149,7 +149,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.GroupsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -170,7 +170,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/m2m2types/ent/user_query.go b/examples/m2m2types/ent/user_query.go index b5f30908b..d6c32d723 100644 --- a/examples/m2m2types/ent/user_query.go +++ b/examples/m2m2types/ent/user_query.go @@ -84,23 +84,23 @@ func (uq *UserQuery) QueryGroups() *GroupQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -143,11 +143,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/m2m2types/ent/user_update.go b/examples/m2m2types/ent/user_update.go index a9ebf8388..a6a4009ee 100644 --- a/examples/m2m2types/ent/user_update.go +++ b/examples/m2m2types/ent/user_update.go @@ -345,11 +345,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -365,7 +365,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -456,9 +456,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -467,5 +467,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/m2mbidi/ent/user_create.go b/examples/m2mbidi/ent/user_create.go index 599d51426..d7ea0f745 100644 --- a/examples/m2mbidi/ent/user_create.go +++ b/examples/m2mbidi/ent/user_create.go @@ -111,7 +111,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -119,13 +119,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -140,7 +140,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -148,7 +148,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.FriendsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -169,7 +169,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/m2mbidi/ent/user_query.go b/examples/m2mbidi/ent/user_query.go index 5ad333bc6..7ce316aed 100644 --- a/examples/m2mbidi/ent/user_query.go +++ b/examples/m2mbidi/ent/user_query.go @@ -83,23 +83,23 @@ func (uq *UserQuery) QueryFriends() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -126,13 +126,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -142,11 +142,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -185,11 +185,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/m2mbidi/ent/user_update.go b/examples/m2mbidi/ent/user_update.go index fabf382f7..617fd9183 100644 --- a/examples/m2mbidi/ent/user_update.go +++ b/examples/m2mbidi/ent/user_update.go @@ -344,11 +344,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -364,7 +364,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -455,9 +455,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -466,5 +466,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/m2mrecur/ent/user_create.go b/examples/m2mrecur/ent/user_create.go index eee060cf9..a5b6a0703 100644 --- a/examples/m2mrecur/ent/user_create.go +++ b/examples/m2mrecur/ent/user_create.go @@ -126,7 +126,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -134,13 +134,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -155,7 +155,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -163,7 +163,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.FollowersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -203,7 +203,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/m2mrecur/ent/user_query.go b/examples/m2mrecur/ent/user_query.go index f39b7b7b6..111919f5d 100644 --- a/examples/m2mrecur/ent/user_query.go +++ b/examples/m2mrecur/ent/user_query.go @@ -106,23 +106,23 @@ func (uq *UserQuery) QueryFollowing() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -149,13 +149,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -165,11 +165,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -208,11 +208,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/m2mrecur/ent/user_update.go b/examples/m2mrecur/ent/user_update.go index 6de99271d..fcc280752 100644 --- a/examples/m2mrecur/ent/user_update.go +++ b/examples/m2mrecur/ent/user_update.go @@ -470,11 +470,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -490,7 +490,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -635,9 +635,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -646,5 +646,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/o2m2types/ent/pet_create.go b/examples/o2m2types/ent/pet_create.go index 6654b1ab9..9905990c4 100644 --- a/examples/o2m2types/ent/pet_create.go +++ b/examples/o2m2types/ent/pet_create.go @@ -107,7 +107,7 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -115,13 +115,13 @@ func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { return nil, err } id := _spec.ID.Value.(int64) - pe.ID = int(id) - return pe, nil + _node.ID = int(id) + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -136,7 +136,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { Value: value, Column: pet.FieldName, }) - pe.Name = value + _node.Name = value } if nodes := pc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -157,7 +157,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/examples/o2m2types/ent/pet_query.go b/examples/o2m2types/ent/pet_query.go index 911de6d04..f1e783476 100644 --- a/examples/o2m2types/ent/pet_query.go +++ b/examples/o2m2types/ent/pet_query.go @@ -84,23 +84,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) int { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -143,11 +143,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/examples/o2m2types/ent/pet_update.go b/examples/o2m2types/ent/pet_update.go index b8daa3ee7..21e4b9c0a 100644 --- a/examples/o2m2types/ent/pet_update.go +++ b/examples/o2m2types/ent/pet_update.go @@ -264,11 +264,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -284,7 +284,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -342,9 +342,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -353,5 +353,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/examples/o2m2types/ent/user_create.go b/examples/o2m2types/ent/user_create.go index ea758ac0f..5446f7a27 100644 --- a/examples/o2m2types/ent/user_create.go +++ b/examples/o2m2types/ent/user_create.go @@ -112,7 +112,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -120,13 +120,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -141,7 +141,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -149,7 +149,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.PetsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -170,7 +170,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/o2m2types/ent/user_query.go b/examples/o2m2types/ent/user_query.go index 3412c9707..7237b906a 100644 --- a/examples/o2m2types/ent/user_query.go +++ b/examples/o2m2types/ent/user_query.go @@ -84,23 +84,23 @@ func (uq *UserQuery) QueryPets() *PetQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -143,11 +143,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/o2m2types/ent/user_update.go b/examples/o2m2types/ent/user_update.go index 77bde5ec1..6e7849a82 100644 --- a/examples/o2m2types/ent/user_update.go +++ b/examples/o2m2types/ent/user_update.go @@ -345,11 +345,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -365,7 +365,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -456,9 +456,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -467,5 +467,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/o2mrecur/ent/node_create.go b/examples/o2mrecur/ent/node_create.go index 16a8ca0c9..508c091ce 100644 --- a/examples/o2mrecur/ent/node_create.go +++ b/examples/o2mrecur/ent/node_create.go @@ -121,7 +121,7 @@ func (nc *NodeCreate) check() error { } func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { - n, _spec := nc.createSpec() + _node, _spec := nc.createSpec() if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -129,13 +129,13 @@ func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { return nil, err } id := _spec.ID.Value.(int64) - n.ID = int(id) - return n, nil + _node.ID = int(id) + return _node, nil } func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { var ( - n = &Node{config: nc.config} + _node = &Node{config: nc.config} _spec = &sqlgraph.CreateSpec{ Table: node.Table, ID: &sqlgraph.FieldSpec{ @@ -150,7 +150,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { Value: value, Column: node.FieldValue, }) - n.Value = value + _node.Value = value } if nodes := nc.mutation.ParentIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -190,7 +190,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return n, _spec + return _node, _spec } // NodeCreateBulk is the builder for creating a bulk of Node entities. diff --git a/examples/o2mrecur/ent/node_query.go b/examples/o2mrecur/ent/node_query.go index f1eb795ce..7e511a4d9 100644 --- a/examples/o2mrecur/ent/node_query.go +++ b/examples/o2mrecur/ent/node_query.go @@ -107,23 +107,23 @@ func (nq *NodeQuery) QueryChildren() *NodeQuery { // First returns the first Node entity in the query. Returns *NotFoundError when no node was found. func (nq *NodeQuery) First(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(1).All(ctx) + nodes, err := nq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ns) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{node.Label} } - return ns[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (nq *NodeQuery) FirstX(ctx context.Context) *Node { - n, err := nq.First(ctx) + node, err := nq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return n + return node } // FirstID returns the first Node id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (nq *NodeQuery) FirstXID(ctx context.Context) int { // Only returns the only Node entity in the query, returns an error if not exactly one entity was returned. func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(2).All(ctx) + nodes, err := nq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ns) { + switch len(nodes) { case 1: - return ns[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{node.Label} default: @@ -166,11 +166,11 @@ func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { // OnlyX is like Only, but panics if an error occurs. func (nq *NodeQuery) OnlyX(ctx context.Context) *Node { - n, err := nq.Only(ctx) + node, err := nq.Only(ctx) if err != nil { panic(err) } - return n + return node } // OnlyID returns the only Node id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { // AllX is like All, but panics if an error occurs. func (nq *NodeQuery) AllX(ctx context.Context) []*Node { - ns, err := nq.All(ctx) + nodes, err := nq.All(ctx) if err != nil { panic(err) } - return ns + return nodes } // IDs executes the query and returns a list of Node ids. diff --git a/examples/o2mrecur/ent/node_update.go b/examples/o2mrecur/ent/node_update.go index d9395497e..c72a01dad 100644 --- a/examples/o2mrecur/ent/node_update.go +++ b/examples/o2mrecur/ent/node_update.go @@ -410,11 +410,11 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { // SaveX is like Save, but panics if an error occurs. func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node { - n, err := nuo.Save(ctx) + node, err := nuo.Save(ctx) if err != nil { panic(err) } - return n + return node } // Exec executes the query on the entity. @@ -430,7 +430,7 @@ func (nuo *NodeUpdateOne) ExecX(ctx context.Context) { } } -func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { +func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: node.Table, @@ -549,9 +549,9 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - n = &Node{config: nuo.config} - _spec.Assign = n.assignValues - _spec.ScanValues = n.scanValues() + _node = &Node{config: nuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{node.Label} @@ -560,5 +560,5 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } return nil, err } - return n, nil + return _node, nil } diff --git a/examples/o2o2types/ent/card_create.go b/examples/o2o2types/ent/card_create.go index ec8aad094..ef9f9a14a 100644 --- a/examples/o2o2types/ent/card_create.go +++ b/examples/o2o2types/ent/card_create.go @@ -112,7 +112,7 @@ func (cc *CardCreate) check() error { } func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -120,13 +120,13 @@ func (cc *CardCreate) sqlSave(ctx context.Context) (*Card, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { var ( - c = &Card{config: cc.config} + _node = &Card{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: card.Table, ID: &sqlgraph.FieldSpec{ @@ -141,7 +141,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldExpired, }) - c.Expired = value + _node.Expired = value } if value, ok := cc.mutation.Number(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -149,7 +149,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { Value: value, Column: card.FieldNumber, }) - c.Number = value + _node.Number = value } if nodes := cc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -170,7 +170,7 @@ func (cc *CardCreate) createSpec() (*Card, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CardCreateBulk is the builder for creating a bulk of Card entities. diff --git a/examples/o2o2types/ent/card_query.go b/examples/o2o2types/ent/card_query.go index 1ad151e16..917a402d8 100644 --- a/examples/o2o2types/ent/card_query.go +++ b/examples/o2o2types/ent/card_query.go @@ -84,23 +84,23 @@ func (cq *CardQuery) QueryOwner() *UserQuery { // First returns the first Card entity in the query. Returns *NotFoundError when no card was found. func (cq *CardQuery) First(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{card.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CardQuery) FirstX(ctx context.Context) *Card { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Card id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CardQuery) FirstXID(ctx context.Context) int { // Only returns the only Card entity in the query, returns an error if not exactly one entity was returned. func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{card.Label} default: @@ -143,11 +143,11 @@ func (cq *CardQuery) Only(ctx context.Context) (*Card, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CardQuery) OnlyX(ctx context.Context) *Card { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Card id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CardQuery) All(ctx context.Context) ([]*Card, error) { // AllX is like All, but panics if an error occurs. func (cq *CardQuery) AllX(ctx context.Context) []*Card { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Card ids. diff --git a/examples/o2o2types/ent/card_update.go b/examples/o2o2types/ent/card_update.go index d952c2565..42ba0a57a 100644 --- a/examples/o2o2types/ent/card_update.go +++ b/examples/o2o2types/ent/card_update.go @@ -289,11 +289,11 @@ func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CardUpdateOne) SaveX(ctx context.Context) *Card { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -317,7 +317,7 @@ func (cuo *CardUpdateOne) check() error { return nil } -func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { +func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: card.Table, @@ -382,9 +382,9 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Card{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Card{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{card.Label} @@ -393,5 +393,5 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (c *Card, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/examples/o2o2types/ent/user_create.go b/examples/o2o2types/ent/user_create.go index 9d3d3f233..e3392d9e8 100644 --- a/examples/o2o2types/ent/user_create.go +++ b/examples/o2o2types/ent/user_create.go @@ -116,7 +116,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -124,13 +124,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -145,7 +145,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -153,7 +153,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.CardIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -174,7 +174,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/o2o2types/ent/user_query.go b/examples/o2o2types/ent/user_query.go index f845ccead..947499647 100644 --- a/examples/o2o2types/ent/user_query.go +++ b/examples/o2o2types/ent/user_query.go @@ -84,23 +84,23 @@ func (uq *UserQuery) QueryCard() *CardQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -143,11 +143,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/o2o2types/ent/user_update.go b/examples/o2o2types/ent/user_update.go index 3f4b92e61..9ab93526b 100644 --- a/examples/o2o2types/ent/user_update.go +++ b/examples/o2o2types/ent/user_update.go @@ -304,11 +304,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -324,7 +324,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -396,9 +396,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -407,5 +407,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/o2obidi/ent/user_create.go b/examples/o2obidi/ent/user_create.go index ee933f5d6..c93ccab5c 100644 --- a/examples/o2obidi/ent/user_create.go +++ b/examples/o2obidi/ent/user_create.go @@ -115,7 +115,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -123,13 +123,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -144,7 +144,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -152,7 +152,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.SpouseIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -173,7 +173,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/o2obidi/ent/user_query.go b/examples/o2obidi/ent/user_query.go index 73f716b93..5c869d809 100644 --- a/examples/o2obidi/ent/user_query.go +++ b/examples/o2obidi/ent/user_query.go @@ -83,23 +83,23 @@ func (uq *UserQuery) QuerySpouse() *UserQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -126,13 +126,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -142,11 +142,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -185,11 +185,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/o2obidi/ent/user_update.go b/examples/o2obidi/ent/user_update.go index 270ce001c..d84279a73 100644 --- a/examples/o2obidi/ent/user_update.go +++ b/examples/o2obidi/ent/user_update.go @@ -303,11 +303,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -323,7 +323,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -395,9 +395,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -406,5 +406,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/o2orecur/ent/node_create.go b/examples/o2orecur/ent/node_create.go index 1d4001d39..323eaaa87 100644 --- a/examples/o2orecur/ent/node_create.go +++ b/examples/o2orecur/ent/node_create.go @@ -125,7 +125,7 @@ func (nc *NodeCreate) check() error { } func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { - n, _spec := nc.createSpec() + _node, _spec := nc.createSpec() if err := sqlgraph.CreateNode(ctx, nc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -133,13 +133,13 @@ func (nc *NodeCreate) sqlSave(ctx context.Context) (*Node, error) { return nil, err } id := _spec.ID.Value.(int64) - n.ID = int(id) - return n, nil + _node.ID = int(id) + return _node, nil } func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { var ( - n = &Node{config: nc.config} + _node = &Node{config: nc.config} _spec = &sqlgraph.CreateSpec{ Table: node.Table, ID: &sqlgraph.FieldSpec{ @@ -154,7 +154,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { Value: value, Column: node.FieldValue, }) - n.Value = value + _node.Value = value } if nodes := nc.mutation.PrevIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -194,7 +194,7 @@ func (nc *NodeCreate) createSpec() (*Node, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return n, _spec + return _node, _spec } // NodeCreateBulk is the builder for creating a bulk of Node entities. diff --git a/examples/o2orecur/ent/node_query.go b/examples/o2orecur/ent/node_query.go index b80583433..4938ccd28 100644 --- a/examples/o2orecur/ent/node_query.go +++ b/examples/o2orecur/ent/node_query.go @@ -107,23 +107,23 @@ func (nq *NodeQuery) QueryNext() *NodeQuery { // First returns the first Node entity in the query. Returns *NotFoundError when no node was found. func (nq *NodeQuery) First(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(1).All(ctx) + nodes, err := nq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(ns) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{node.Label} } - return ns[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (nq *NodeQuery) FirstX(ctx context.Context) *Node { - n, err := nq.First(ctx) + node, err := nq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return n + return node } // FirstID returns the first Node id in the query. Returns *NotFoundError when no id was found. @@ -150,13 +150,13 @@ func (nq *NodeQuery) FirstXID(ctx context.Context) int { // Only returns the only Node entity in the query, returns an error if not exactly one entity was returned. func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { - ns, err := nq.Limit(2).All(ctx) + nodes, err := nq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(ns) { + switch len(nodes) { case 1: - return ns[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{node.Label} default: @@ -166,11 +166,11 @@ func (nq *NodeQuery) Only(ctx context.Context) (*Node, error) { // OnlyX is like Only, but panics if an error occurs. func (nq *NodeQuery) OnlyX(ctx context.Context) *Node { - n, err := nq.Only(ctx) + node, err := nq.Only(ctx) if err != nil { panic(err) } - return n + return node } // OnlyID returns the only Node id in the query, returns an error if not exactly one id was returned. @@ -209,11 +209,11 @@ func (nq *NodeQuery) All(ctx context.Context) ([]*Node, error) { // AllX is like All, but panics if an error occurs. func (nq *NodeQuery) AllX(ctx context.Context) []*Node { - ns, err := nq.All(ctx) + nodes, err := nq.All(ctx) if err != nil { panic(err) } - return ns + return nodes } // IDs executes the query and returns a list of Node ids. diff --git a/examples/o2orecur/ent/node_update.go b/examples/o2orecur/ent/node_update.go index 68ace7d6a..4cee4a69b 100644 --- a/examples/o2orecur/ent/node_update.go +++ b/examples/o2orecur/ent/node_update.go @@ -369,11 +369,11 @@ func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { // SaveX is like Save, but panics if an error occurs. func (nuo *NodeUpdateOne) SaveX(ctx context.Context) *Node { - n, err := nuo.Save(ctx) + node, err := nuo.Save(ctx) if err != nil { panic(err) } - return n + return node } // Exec executes the query on the entity. @@ -389,7 +389,7 @@ func (nuo *NodeUpdateOne) ExecX(ctx context.Context) { } } -func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { +func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: node.Table, @@ -489,9 +489,9 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - n = &Node{config: nuo.config} - _spec.Assign = n.assignValues - _spec.ScanValues = n.scanValues() + _node = &Node{config: nuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, nuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{node.Label} @@ -500,5 +500,5 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (n *Node, err error) { } return nil, err } - return n, nil + return _node, nil } diff --git a/examples/start/ent/car_create.go b/examples/start/ent/car_create.go index b374d61fd..b9e948c63 100644 --- a/examples/start/ent/car_create.go +++ b/examples/start/ent/car_create.go @@ -117,7 +117,7 @@ func (cc *CarCreate) check() error { } func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { - c, _spec := cc.createSpec() + _node, _spec := cc.createSpec() if err := sqlgraph.CreateNode(ctx, cc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -125,13 +125,13 @@ func (cc *CarCreate) sqlSave(ctx context.Context) (*Car, error) { return nil, err } id := _spec.ID.Value.(int64) - c.ID = int(id) - return c, nil + _node.ID = int(id) + return _node, nil } func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { var ( - c = &Car{config: cc.config} + _node = &Car{config: cc.config} _spec = &sqlgraph.CreateSpec{ Table: car.Table, ID: &sqlgraph.FieldSpec{ @@ -146,7 +146,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { Value: value, Column: car.FieldModel, }) - c.Model = value + _node.Model = value } if value, ok := cc.mutation.RegisteredAt(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -154,7 +154,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { Value: value, Column: car.FieldRegisteredAt, }) - c.RegisteredAt = value + _node.RegisteredAt = value } if nodes := cc.mutation.OwnerIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -175,7 +175,7 @@ func (cc *CarCreate) createSpec() (*Car, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return c, _spec + return _node, _spec } // CarCreateBulk is the builder for creating a bulk of Car entities. diff --git a/examples/start/ent/car_query.go b/examples/start/ent/car_query.go index 4fa7378ea..f689a80d9 100644 --- a/examples/start/ent/car_query.go +++ b/examples/start/ent/car_query.go @@ -84,23 +84,23 @@ func (cq *CarQuery) QueryOwner() *UserQuery { // First returns the first Car entity in the query. Returns *NotFoundError when no car was found. func (cq *CarQuery) First(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(1).All(ctx) + nodes, err := cq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(cs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{car.Label} } - return cs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (cq *CarQuery) FirstX(ctx context.Context) *Car { - c, err := cq.First(ctx) + node, err := cq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return c + return node } // FirstID returns the first Car id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (cq *CarQuery) FirstXID(ctx context.Context) int { // Only returns the only Car entity in the query, returns an error if not exactly one entity was returned. func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { - cs, err := cq.Limit(2).All(ctx) + nodes, err := cq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(cs) { + switch len(nodes) { case 1: - return cs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{car.Label} default: @@ -143,11 +143,11 @@ func (cq *CarQuery) Only(ctx context.Context) (*Car, error) { // OnlyX is like Only, but panics if an error occurs. func (cq *CarQuery) OnlyX(ctx context.Context) *Car { - c, err := cq.Only(ctx) + node, err := cq.Only(ctx) if err != nil { panic(err) } - return c + return node } // OnlyID returns the only Car id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (cq *CarQuery) All(ctx context.Context) ([]*Car, error) { // AllX is like All, but panics if an error occurs. func (cq *CarQuery) AllX(ctx context.Context) []*Car { - cs, err := cq.All(ctx) + nodes, err := cq.All(ctx) if err != nil { panic(err) } - return cs + return nodes } // IDs executes the query and returns a list of Car ids. diff --git a/examples/start/ent/car_update.go b/examples/start/ent/car_update.go index 24a7dfcb3..f82c6ebd5 100644 --- a/examples/start/ent/car_update.go +++ b/examples/start/ent/car_update.go @@ -284,11 +284,11 @@ func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { // SaveX is like Save, but panics if an error occurs. func (cuo *CarUpdateOne) SaveX(ctx context.Context) *Car { - c, err := cuo.Save(ctx) + node, err := cuo.Save(ctx) if err != nil { panic(err) } - return c + return node } // Exec executes the query on the entity. @@ -304,7 +304,7 @@ func (cuo *CarUpdateOne) ExecX(ctx context.Context) { } } -func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { +func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: car.Table, @@ -369,9 +369,9 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - c = &Car{config: cuo.config} - _spec.Assign = c.assignValues - _spec.ScanValues = c.scanValues() + _node = &Car{config: cuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, cuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{car.Label} @@ -380,5 +380,5 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (c *Car, err error) { } return nil, err } - return c, nil + return _node, nil } diff --git a/examples/start/ent/group_create.go b/examples/start/ent/group_create.go index 8d50fa118..85700b97e 100644 --- a/examples/start/ent/group_create.go +++ b/examples/start/ent/group_create.go @@ -108,7 +108,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -116,13 +116,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -137,7 +137,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldName, }) - gr.Name = value + _node.Name = value } if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -158,7 +158,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/examples/start/ent/group_query.go b/examples/start/ent/group_query.go index 1d4e8f8ea..17563f025 100644 --- a/examples/start/ent/group_query.go +++ b/examples/start/ent/group_query.go @@ -84,23 +84,23 @@ func (gq *GroupQuery) QueryUsers() *UserQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -127,13 +127,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -143,11 +143,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -186,11 +186,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/examples/start/ent/group_update.go b/examples/start/ent/group_update.go index aa934b9e5..1f8c4bfc3 100644 --- a/examples/start/ent/group_update.go +++ b/examples/start/ent/group_update.go @@ -327,11 +327,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -357,7 +357,7 @@ func (guo *GroupUpdateOne) check() error { return nil } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -434,9 +434,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -445,5 +445,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/examples/start/ent/user_create.go b/examples/start/ent/user_create.go index b36d41f4d..970ba4212 100644 --- a/examples/start/ent/user_create.go +++ b/examples/start/ent/user_create.go @@ -150,7 +150,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -158,13 +158,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -179,7 +179,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -187,7 +187,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.CarsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -227,7 +227,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/start/ent/user_query.go b/examples/start/ent/user_query.go index c304fa98c..e4b4de80d 100644 --- a/examples/start/ent/user_query.go +++ b/examples/start/ent/user_query.go @@ -108,23 +108,23 @@ func (uq *UserQuery) QueryGroups() *GroupQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -151,13 +151,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -167,11 +167,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -210,11 +210,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/start/ent/user_update.go b/examples/start/ent/user_update.go index 5ac4eac41..52c3b2a1b 100644 --- a/examples/start/ent/user_update.go +++ b/examples/start/ent/user_update.go @@ -510,11 +510,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -540,7 +540,7 @@ func (uuo *UserUpdateOne) check() error { return nil } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -685,9 +685,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -696,5 +696,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil } diff --git a/examples/traversal/ent/group_create.go b/examples/traversal/ent/group_create.go index bedbaf719..07345c5db 100644 --- a/examples/traversal/ent/group_create.go +++ b/examples/traversal/ent/group_create.go @@ -122,7 +122,7 @@ func (gc *GroupCreate) check() error { } func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { - gr, _spec := gc.createSpec() + _node, _spec := gc.createSpec() if err := sqlgraph.CreateNode(ctx, gc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -130,13 +130,13 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { return nil, err } id := _spec.ID.Value.(int64) - gr.ID = int(id) - return gr, nil + _node.ID = int(id) + return _node, nil } func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( - gr = &Group{config: gc.config} + _node = &Group{config: gc.config} _spec = &sqlgraph.CreateSpec{ Table: group.Table, ID: &sqlgraph.FieldSpec{ @@ -151,7 +151,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Value: value, Column: group.FieldName, }) - gr.Name = value + _node.Name = value } if nodes := gc.mutation.UsersIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -191,7 +191,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return gr, _spec + return _node, _spec } // GroupCreateBulk is the builder for creating a bulk of Group entities. diff --git a/examples/traversal/ent/group_query.go b/examples/traversal/ent/group_query.go index bbe9784af..a0c190e0c 100644 --- a/examples/traversal/ent/group_query.go +++ b/examples/traversal/ent/group_query.go @@ -108,23 +108,23 @@ func (gq *GroupQuery) QueryAdmin() *UserQuery { // First returns the first Group entity in the query. Returns *NotFoundError when no group was found. func (gq *GroupQuery) First(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(1).All(ctx) + nodes, err := gq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(grs) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{group.Label} } - return grs[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (gq *GroupQuery) FirstX(ctx context.Context) *Group { - gr, err := gq.First(ctx) + node, err := gq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return gr + return node } // FirstID returns the first Group id in the query. Returns *NotFoundError when no id was found. @@ -151,13 +151,13 @@ func (gq *GroupQuery) FirstXID(ctx context.Context) int { // Only returns the only Group entity in the query, returns an error if not exactly one entity was returned. func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { - grs, err := gq.Limit(2).All(ctx) + nodes, err := gq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(grs) { + switch len(nodes) { case 1: - return grs[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{group.Label} default: @@ -167,11 +167,11 @@ func (gq *GroupQuery) Only(ctx context.Context) (*Group, error) { // OnlyX is like Only, but panics if an error occurs. func (gq *GroupQuery) OnlyX(ctx context.Context) *Group { - gr, err := gq.Only(ctx) + node, err := gq.Only(ctx) if err != nil { panic(err) } - return gr + return node } // OnlyID returns the only Group id in the query, returns an error if not exactly one id was returned. @@ -210,11 +210,11 @@ func (gq *GroupQuery) All(ctx context.Context) ([]*Group, error) { // AllX is like All, but panics if an error occurs. func (gq *GroupQuery) AllX(ctx context.Context) []*Group { - grs, err := gq.All(ctx) + nodes, err := gq.All(ctx) if err != nil { panic(err) } - return grs + return nodes } // IDs executes the query and returns a list of Group ids. diff --git a/examples/traversal/ent/group_update.go b/examples/traversal/ent/group_update.go index 32f176d57..3773323da 100644 --- a/examples/traversal/ent/group_update.go +++ b/examples/traversal/ent/group_update.go @@ -390,11 +390,11 @@ func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { // SaveX is like Save, but panics if an error occurs. func (guo *GroupUpdateOne) SaveX(ctx context.Context) *Group { - gr, err := guo.Save(ctx) + node, err := guo.Save(ctx) if err != nil { panic(err) } - return gr + return node } // Exec executes the query on the entity. @@ -410,7 +410,7 @@ func (guo *GroupUpdateOne) ExecX(ctx context.Context) { } } -func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { +func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: group.Table, @@ -522,9 +522,9 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - gr = &Group{config: guo.config} - _spec.Assign = gr.assignValues - _spec.ScanValues = gr.scanValues() + _node = &Group{config: guo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, guo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{group.Label} @@ -533,5 +533,5 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (gr *Group, err error) { } return nil, err } - return gr, nil + return _node, nil } diff --git a/examples/traversal/ent/pet_create.go b/examples/traversal/ent/pet_create.go index d66d6a1d4..ebce0a68c 100644 --- a/examples/traversal/ent/pet_create.go +++ b/examples/traversal/ent/pet_create.go @@ -122,7 +122,7 @@ func (pc *PetCreate) check() error { } func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { - pe, _spec := pc.createSpec() + _node, _spec := pc.createSpec() if err := sqlgraph.CreateNode(ctx, pc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -130,13 +130,13 @@ func (pc *PetCreate) sqlSave(ctx context.Context) (*Pet, error) { return nil, err } id := _spec.ID.Value.(int64) - pe.ID = int(id) - return pe, nil + _node.ID = int(id) + return _node, nil } func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { var ( - pe = &Pet{config: pc.config} + _node = &Pet{config: pc.config} _spec = &sqlgraph.CreateSpec{ Table: pet.Table, ID: &sqlgraph.FieldSpec{ @@ -151,7 +151,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { Value: value, Column: pet.FieldName, }) - pe.Name = value + _node.Name = value } if nodes := pc.mutation.FriendsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -191,7 +191,7 @@ func (pc *PetCreate) createSpec() (*Pet, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return pe, _spec + return _node, _spec } // PetCreateBulk is the builder for creating a bulk of Pet entities. diff --git a/examples/traversal/ent/pet_query.go b/examples/traversal/ent/pet_query.go index 123193fb0..be025ae68 100644 --- a/examples/traversal/ent/pet_query.go +++ b/examples/traversal/ent/pet_query.go @@ -108,23 +108,23 @@ func (pq *PetQuery) QueryOwner() *UserQuery { // First returns the first Pet entity in the query. Returns *NotFoundError when no pet was found. func (pq *PetQuery) First(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(1).All(ctx) + nodes, err := pq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(pes) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{pet.Label} } - return pes[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (pq *PetQuery) FirstX(ctx context.Context) *Pet { - pe, err := pq.First(ctx) + node, err := pq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return pe + return node } // FirstID returns the first Pet id in the query. Returns *NotFoundError when no id was found. @@ -151,13 +151,13 @@ func (pq *PetQuery) FirstXID(ctx context.Context) int { // Only returns the only Pet entity in the query, returns an error if not exactly one entity was returned. func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { - pes, err := pq.Limit(2).All(ctx) + nodes, err := pq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(pes) { + switch len(nodes) { case 1: - return pes[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{pet.Label} default: @@ -167,11 +167,11 @@ func (pq *PetQuery) Only(ctx context.Context) (*Pet, error) { // OnlyX is like Only, but panics if an error occurs. func (pq *PetQuery) OnlyX(ctx context.Context) *Pet { - pe, err := pq.Only(ctx) + node, err := pq.Only(ctx) if err != nil { panic(err) } - return pe + return node } // OnlyID returns the only Pet id in the query, returns an error if not exactly one id was returned. @@ -210,11 +210,11 @@ func (pq *PetQuery) All(ctx context.Context) ([]*Pet, error) { // AllX is like All, but panics if an error occurs. func (pq *PetQuery) AllX(ctx context.Context) []*Pet { - pes, err := pq.All(ctx) + nodes, err := pq.All(ctx) if err != nil { panic(err) } - return pes + return nodes } // IDs executes the query and returns a list of Pet ids. diff --git a/examples/traversal/ent/pet_update.go b/examples/traversal/ent/pet_update.go index f3635fbde..4fda95d77 100644 --- a/examples/traversal/ent/pet_update.go +++ b/examples/traversal/ent/pet_update.go @@ -390,11 +390,11 @@ func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { // SaveX is like Save, but panics if an error occurs. func (puo *PetUpdateOne) SaveX(ctx context.Context) *Pet { - pe, err := puo.Save(ctx) + node, err := puo.Save(ctx) if err != nil { panic(err) } - return pe + return node } // Exec executes the query on the entity. @@ -410,7 +410,7 @@ func (puo *PetUpdateOne) ExecX(ctx context.Context) { } } -func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { +func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: pet.Table, @@ -522,9 +522,9 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - pe = &Pet{config: puo.config} - _spec.Assign = pe.assignValues - _spec.ScanValues = pe.scanValues() + _node = &Pet{config: puo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, puo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{pet.Label} @@ -533,5 +533,5 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (pe *Pet, err error) { } return nil, err } - return pe, nil + return _node, nil } diff --git a/examples/traversal/ent/user_create.go b/examples/traversal/ent/user_create.go index e4ff4fcd9..9ece7ca83 100644 --- a/examples/traversal/ent/user_create.go +++ b/examples/traversal/ent/user_create.go @@ -158,7 +158,7 @@ func (uc *UserCreate) check() error { } func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { - u, _spec := uc.createSpec() + _node, _spec := uc.createSpec() if err := sqlgraph.CreateNode(ctx, uc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr @@ -166,13 +166,13 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { return nil, err } id := _spec.ID.Value.(int64) - u.ID = int(id) - return u, nil + _node.ID = int(id) + return _node, nil } func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( - u = &User{config: uc.config} + _node = &User{config: uc.config} _spec = &sqlgraph.CreateSpec{ Table: user.Table, ID: &sqlgraph.FieldSpec{ @@ -187,7 +187,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldAge, }) - u.Age = value + _node.Age = value } if value, ok := uc.mutation.Name(); ok { _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ @@ -195,7 +195,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Value: value, Column: user.FieldName, }) - u.Name = value + _node.Name = value } if nodes := uc.mutation.PetsIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ @@ -273,7 +273,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - return u, _spec + return _node, _spec } // UserCreateBulk is the builder for creating a bulk of User entities. diff --git a/examples/traversal/ent/user_query.go b/examples/traversal/ent/user_query.go index 157b89527..31184bcb7 100644 --- a/examples/traversal/ent/user_query.go +++ b/examples/traversal/ent/user_query.go @@ -154,23 +154,23 @@ func (uq *UserQuery) QueryManage() *GroupQuery { // First returns the first User entity in the query. Returns *NotFoundError when no user was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { - us, err := uq.Limit(1).All(ctx) + nodes, err := uq.Limit(1).All(ctx) if err != nil { return nil, err } - if len(us) == 0 { + if len(nodes) == 0 { return nil, &NotFoundError{user.Label} } - return us[0], nil + return nodes[0], nil } // FirstX is like First, but panics if an error occurs. func (uq *UserQuery) FirstX(ctx context.Context) *User { - u, err := uq.First(ctx) + node, err := uq.First(ctx) if err != nil && !IsNotFound(err) { panic(err) } - return u + return node } // FirstID returns the first User id in the query. Returns *NotFoundError when no id was found. @@ -197,13 +197,13 @@ func (uq *UserQuery) FirstXID(ctx context.Context) int { // Only returns the only User entity in the query, returns an error if not exactly one entity was returned. func (uq *UserQuery) Only(ctx context.Context) (*User, error) { - us, err := uq.Limit(2).All(ctx) + nodes, err := uq.Limit(2).All(ctx) if err != nil { return nil, err } - switch len(us) { + switch len(nodes) { case 1: - return us[0], nil + return nodes[0], nil case 0: return nil, &NotFoundError{user.Label} default: @@ -213,11 +213,11 @@ func (uq *UserQuery) Only(ctx context.Context) (*User, error) { // OnlyX is like Only, but panics if an error occurs. func (uq *UserQuery) OnlyX(ctx context.Context) *User { - u, err := uq.Only(ctx) + node, err := uq.Only(ctx) if err != nil { panic(err) } - return u + return node } // OnlyID returns the only User id in the query, returns an error if not exactly one id was returned. @@ -256,11 +256,11 @@ func (uq *UserQuery) All(ctx context.Context) ([]*User, error) { // AllX is like All, but panics if an error occurs. func (uq *UserQuery) AllX(ctx context.Context) []*User { - us, err := uq.All(ctx) + nodes, err := uq.All(ctx) if err != nil { panic(err) } - return us + return nodes } // IDs executes the query and returns a list of User ids. diff --git a/examples/traversal/ent/user_update.go b/examples/traversal/ent/user_update.go index 4b6f0da1e..836c0a23a 100644 --- a/examples/traversal/ent/user_update.go +++ b/examples/traversal/ent/user_update.go @@ -724,11 +724,11 @@ func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { // SaveX is like Save, but panics if an error occurs. func (uuo *UserUpdateOne) SaveX(ctx context.Context) *User { - u, err := uuo.Save(ctx) + node, err := uuo.Save(ctx) if err != nil { panic(err) } - return u + return node } // Exec executes the query on the entity. @@ -744,7 +744,7 @@ func (uuo *UserUpdateOne) ExecX(ctx context.Context) { } } -func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { +func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) { _spec := &sqlgraph.UpdateSpec{ Node: &sqlgraph.NodeSpec{ Table: user.Table, @@ -997,9 +997,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - u = &User{config: uuo.config} - _spec.Assign = u.assignValues - _spec.ScanValues = u.scanValues() + _node = &User{config: uuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues() if err = sqlgraph.UpdateNode(ctx, uuo.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -1008,5 +1008,5 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (u *User, err error) { } return nil, err } - return u, nil + return _node, nil }