From 5d70144f4424c50858d06ef6265fcbc82178714d Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Sun, 14 Mar 2021 15:55:17 +0200 Subject: [PATCH] entc/gen: allow selecting partial fields on update-one --- entc/gen/internal/bindata.go | 12 +++++------ entc/gen/template/builder/update.tmpl | 8 ++++++++ entc/gen/template/dialect/gremlin/update.tmpl | 15 +++++++++++++- entc/gen/template/dialect/sql/update.tmpl | 12 +++++++++++ entc/integration/README.md | 2 +- entc/integration/config/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/customid/ent/blob_update.go | 20 +++++++++++++++++++ entc/integration/customid/ent/car_update.go | 20 +++++++++++++++++++ entc/integration/customid/ent/group_update.go | 20 +++++++++++++++++++ .../customid/ent/mixinid_update.go | 20 +++++++++++++++++++ entc/integration/customid/ent/pet_update.go | 20 +++++++++++++++++++ entc/integration/customid/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/edgefield/ent/card_update.go | 20 +++++++++++++++++++ entc/integration/edgefield/ent/info_update.go | 20 +++++++++++++++++++ .../edgefield/ent/metadata_update.go | 20 +++++++++++++++++++ entc/integration/edgefield/ent/pet_update.go | 20 +++++++++++++++++++ entc/integration/edgefield/ent/post_update.go | 20 +++++++++++++++++++ entc/integration/edgefield/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/ent/card_update.go | 20 +++++++++++++++++++ entc/integration/ent/comment_update.go | 20 +++++++++++++++++++ entc/integration/ent/fieldtype_update.go | 20 +++++++++++++++++++ entc/integration/ent/file_update.go | 20 +++++++++++++++++++ entc/integration/ent/filetype_update.go | 20 +++++++++++++++++++ entc/integration/ent/goods_update.go | 20 +++++++++++++++++++ entc/integration/ent/group_update.go | 20 +++++++++++++++++++ entc/integration/ent/groupinfo_update.go | 20 +++++++++++++++++++ entc/integration/ent/item_update.go | 20 +++++++++++++++++++ entc/integration/ent/node_update.go | 20 +++++++++++++++++++ entc/integration/ent/pet_update.go | 20 +++++++++++++++++++ entc/integration/ent/spec_update.go | 20 +++++++++++++++++++ entc/integration/ent/task_update.go | 20 +++++++++++++++++++ entc/integration/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/gremlin/ent/card_update.go | 19 +++++++++++++++++- .../integration/gremlin/ent/comment_update.go | 19 +++++++++++++++++- .../gremlin/ent/fieldtype_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/file_update.go | 19 +++++++++++++++++- .../gremlin/ent/filetype_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/goods_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/group_update.go | 19 +++++++++++++++++- .../gremlin/ent/groupinfo_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/item_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/node_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/pet_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/spec_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/task_update.go | 19 +++++++++++++++++- entc/integration/gremlin/ent/user_update.go | 19 +++++++++++++++++- entc/integration/gremlin/gremlin_test.go | 11 ++++++++++ entc/integration/hooks/ent/card_update.go | 20 +++++++++++++++++++ entc/integration/hooks/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/idtype/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/integration_test.go | 10 ++++++++++ entc/integration/json/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/migrate/entv1/car_update.go | 20 +++++++++++++++++++ .../migrate/entv1/conversion_update.go | 20 +++++++++++++++++++ .../migrate/entv1/customtype_update.go | 20 +++++++++++++++++++ entc/integration/migrate/entv1/user_update.go | 20 +++++++++++++++++++ entc/integration/migrate/entv2/car_update.go | 20 +++++++++++++++++++ .../migrate/entv2/conversion_update.go | 20 +++++++++++++++++++ .../migrate/entv2/customtype_update.go | 20 +++++++++++++++++++ .../integration/migrate/entv2/group_update.go | 20 +++++++++++++++++++ .../integration/migrate/entv2/media_update.go | 20 +++++++++++++++++++ entc/integration/migrate/entv2/pet_update.go | 20 +++++++++++++++++++ entc/integration/migrate/entv2/user_update.go | 20 +++++++++++++++++++ .../multischema/ent/group_update.go | 20 +++++++++++++++++++ .../integration/multischema/ent/pet_update.go | 20 +++++++++++++++++++ .../multischema/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/privacy/ent/task_update.go | 20 +++++++++++++++++++ entc/integration/privacy/ent/team_update.go | 20 +++++++++++++++++++ entc/integration/privacy/ent/user_update.go | 20 +++++++++++++++++++ entc/integration/template/ent/group_update.go | 20 +++++++++++++++++++ entc/integration/template/ent/pet_update.go | 20 +++++++++++++++++++ entc/integration/template/ent/user_update.go | 20 +++++++++++++++++++ examples/edgeindex/ent/city_update.go | 20 +++++++++++++++++++ examples/edgeindex/ent/street_update.go | 20 +++++++++++++++++++ examples/entcpkg/ent/user_update.go | 20 +++++++++++++++++++ examples/m2m2types/ent/group_update.go | 20 +++++++++++++++++++ examples/m2m2types/ent/user_update.go | 20 +++++++++++++++++++ examples/m2mbidi/ent/user_update.go | 20 +++++++++++++++++++ examples/m2mrecur/ent/user_update.go | 20 +++++++++++++++++++ examples/o2m2types/ent/pet_update.go | 20 +++++++++++++++++++ examples/o2m2types/ent/user_update.go | 20 +++++++++++++++++++ examples/o2mrecur/ent/node_update.go | 20 +++++++++++++++++++ examples/o2o2types/ent/card_update.go | 20 +++++++++++++++++++ examples/o2o2types/ent/user_update.go | 20 +++++++++++++++++++ examples/o2obidi/ent/user_update.go | 20 +++++++++++++++++++ examples/o2orecur/ent/node_update.go | 20 +++++++++++++++++++ examples/privacyadmin/ent/user_update.go | 20 +++++++++++++++++++ examples/privacytenant/ent/group_update.go | 20 +++++++++++++++++++ examples/privacytenant/ent/tenant_update.go | 20 +++++++++++++++++++ examples/privacytenant/ent/user_update.go | 20 +++++++++++++++++++ examples/start/ent/car_update.go | 20 +++++++++++++++++++ examples/start/ent/group_update.go | 20 +++++++++++++++++++ examples/start/ent/user_update.go | 20 +++++++++++++++++++ examples/traversal/ent/group_update.go | 20 +++++++++++++++++++ examples/traversal/ent/pet_update.go | 20 +++++++++++++++++++ examples/traversal/ent/user_update.go | 20 +++++++++++++++++++ 96 files changed, 1814 insertions(+), 22 deletions(-) diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 2696a24b2..f9eb64380 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -272,7 +272,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\x39\x61\x73\x90\x0c\x5b\x9b\xe4\x5b\x1d\xb8\xc0\x25\x76\x7a\x06\xda\x5c\x11\xe7\xae\x07\x24\xc1\x41\x2b\x8d\xbc\xac\xb5\xa4\x42\x52\x6b\x1b\x5b\xfd\xf7\x62\xf8\xa2\x97\x5d\xad\xb3\x36\xd2\x43\xaf\x28\x10\xc0\x5a\x91\x1c\xce\x3c\xf3\xf6\x90\xca\x66\x33\x3f\x0a\xdf\x88\xfa\x5e\xb2\xeb\xa5\x86\x97\xcf\x5f\xfc\xe9\xa4\x96\xa8\x90\x6b\x78\x9b\xe5\xb8\x10\xe2\x06\x2e\x79\x9e\xc2\x0f\x55\x05\x66\x92\x02\x1a\x97\x6b\x2c\xd2\xf0\xc3\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\xf9\xe6\xe2\xdd\xd5\x05\x94\xac\x42\x70\xef\xa4\x10\x1a\x0a\x26\x31\xd7\x42\xde\x83\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\xed\xac\xbe\xb9\x86\xd3\x33\x58\x64\x0a\x61\x96\xbe\x11\xbc\x64\xd7\xe9\xdf\xb3\xfc\x26\xbb\x46\x70\x4b\x35\xae\xea\x2a\xd3\x08\xd1\x12\xb3\x02\x65\x04\xb3\xdd\x21\xb6\xaa\x85\xd4\x7e\xc8\xfe\x82\x38\x0c\x36\x9b\x13\x90\x19\xbf\x46\x98\xd5\x99\x5e\xd2\x66\xb3\xf4\x8a\x2d\x2a\xc6\xaf\x2f\xcd\x2c\x45\x2b\x82\x20\x32\xea\xd0\x94\xb6\x8d\xec\x3a\xe4\x05\x8d\x25\x66\xab\xd9\xa2\x61\x15\xc1\x65\x24\xfc\x6c\xcc\x78\x97\xad\xd0\x5b\x22\x31\x47\xb6\xb6\xe3\xdd\x73\xb7\xc8\x4d\x5a\x35\x3a\xd3\x4c\x70\x9a\x54\x4b\xc6\xf5\x60\x5d\x94\xfa\x51\x83\x4e\x38\x9f\xc3\x70\xdb\xb6\x25\xd7\x11\xee\xfe\x4d\x29\x24\x18\x38\x19\xbf\x36\x53\x53\xa7\x0f\x20\xd7\x4c\x33\x54\x69\xa8\xef\x6b\xdc\x16\xa3\xb4\x6c\x72\x0d\x9b\x30\xc8\x0d\xde\xd6\xd8\x1e\x4a\xeb\xa2\x79\xc9\xb0\x2a\x14\x21\x7a\xd2\xb6\xa1\x55\xe8\x1f\x4b\x94\x08\x59\x51\x28\xc8\x80\xe3\x2d\xd4\x12\x0b\x96\xd3\x32\xd2\x86\xb4\xdb\xda\xcc\x3d\xa6\x61\xd9\xf0\x1c\xe2\x21\x52\x6d\x0b\x47\xe3\xd9\x89\xdd\x20\xae\x15\xa4\x69\xda\xc9\x4e\x87\xc6\x25\xdb\x8b\xc8\x90\x11\xb6\x6d\xdb\x2f\x55\x70\x06\x59\x5d\x23\x2f\xe2\xfd\x73\x8e\xa1\x56\x69\x9a\x26\x61\x20\x51\x37\x92\xc3\xc8\x9f\xd6\xf8\xcd\x06\x6e\x99\x5e\x02\xde\x69\x0a\x8b\x19\x44\xaf\xad\x06\xd1\xc8\xc9\xc1\x28\x28\x15\x6a\x4d\x33\x52\xe7\x7f\x17\x50\x4f\x13\xe6\xdc\x82\xc5\x35\xaa\x5d\x91\xf3\x39\x5c\x65\x6b\x04\xbc\xc3\xbc\x21\xbb\xc9\x17\x5f\x1a\x94\xf7\x90\xf1\x02\xac\x61\xf6\x2d\x6f\x56\x0b\x94\x94\xaf\x5c\x14\xa8\x20\x2b\x4b\xcc\x35\x16\xb0\xb8\x37\xe3\x76\x23\x10\x35\x4a\x03\xd6\x94\xef\x60\xca\x79\xa4\x40\x9c\xeb\x3b\xc8\x05\xd7\x78\xa7\x29\x9f\xe9\x6f\x02\x31\xe3\xfa\x18\x50\x4a\x21\x13\xf2\xd7\x3a\x93\x94\x9c\x01\x4a\x69\xdf\x86\x41\xd0\xa9\xc1\xb8\x0e\x83\xc4\x46\x25\x2b\x61\x96\xfe\x98\x29\x9b\x6f\xe7\x58\x66\x4d\xa5\x6d\xc2\x6e\xa9\x93\x16\x76\x50\xc5\xc9\x28\x7b\x03\x56\x42\x85\x7c\x5b\xfb\x74\x29\xc4\x8d\x4a\xe0\xec\x0c\x9e\x93\x46\x13\xbb\xbd\x59\x62\x7e\x83\xd2\xd5\x07\x92\x43\xea\x9e\x6d\x47\x47\x9a\xd3\xbc\x38\x79\x65\x86\xbf\x3b\x03\xce\x2a\x23\x31\xf0\xe1\xf4\xdc\x98\x4e\x6f\x5a\xb7\x91\xd7\xad\x33\xfa\x78\x8f\x6c\x13\xf9\x57\x5a\x48\x5b\x0f\x3d\xc2\x49\x18\xb4\x80\x95\x42\xb3\x11\xa1\xb9\x6a\x34\xfc\x8d\xa2\x5b\x90\x18\xf3\x84\x6f\x1b\x9e\xc7\xe4\xbb\x29\xa7\x1c\xc3\xca\x4e\x63\x82\x27\x10\xff\x92\x55\x0d\x0e\x5d\x14\x04\x3e\x59\x8e\x41\xdc\x50\xc1\x5a\xa5\xb1\x71\x79\xea\x97\xf9\x8c\x74\xe8\x7c\x27\x6e\xc6\x76\x73\x56\x1d\x43\xb9\xd2\xe9\x05\x49\x2d\xe3\xa8\xe1\x78\x57\x5b\x27\x77\x99\x68\x2a\xd4\xb3\x0f\xd1\x31\xac\x12\x0f\xd1\xd7\x9d\xf1\x14\x6f\xec\xba\xa3\xdf\xac\x73\xc8\x76\x29\x81\xb3\x4e\x55\x1a\x7d\xba\xbf\x7a\x3c\xd3\x42\x70\x84\x33\xd0\xb2\xc1\xb0\x57\x6b\x24\x3a\x0c\x02\x83\x2b\x55\x55\x46\xe0\x3f\x10\xc2\x27\xf0\xe2\x15\x30\xf8\xf3\x19\x3c\x7f\x05\xec\xe4\xa4\xf3\xde\x84\x7e\x66\xc9\x47\xf6\x39\x5e\x35\x9a\xe4\x93\xc9\xac\x84\xdf\xac\x3d\xa7\xc6\x58\xeb\x5f\xa3\xf7\x31\x6c\xc1\x31\x81\xeb\x36\xaa\x6d\x48\xff\x26\x8d\xea\xeb\xd4\xaf\x96\x87\xdc\xa0\xf9\x75\x0c\x8b\x46\x43\x9d\x71\x96\x2b\xf2\x7b\xc6\x6d\x20\x82\xc8\xf3\x46\xaa\x47\x15\xa0\x5f\xa7\x2b\x10\xf5\xda\x4d\xb8\xe5\xbf\xd3\x5d\x80\x06\x1e\x73\x21\x36\xb0\xd5\x68\x18\xa3\x94\xc9\x94\x8d\xce\xbc\x8b\x3b\xcc\x27\xca\xf0\xc1\x46\xd0\xfa\x69\x1b\x2c\x26\x9b\x30\xf8\xed\x10\xf5\x9d\x76\x3d\xee\x24\xb8\xc7\x9d\x7e\x7d\x2b\xdc\x8d\xe4\x69\x9d\x37\x1d\x8e\x13\xda\x7a\x53\x77\xa3\x6a\x8c\xf4\x64\xcb\x7c\xef\x04\x45\x43\x0e\xe5\xa8\x63\x64\x99\xe5\x23\xda\xaa\x29\x1b\x13\x7d\xf5\x90\x56\xbd\xb5\xab\xdb\x62\xa6\x57\x75\xd5\x11\xbd\x12\xa2\x82\x65\x15\xe6\x7a\xfe\x4c\xcd\x3d\x0b\x1e\xd6\x0a\xb3\xe8\xae\x53\xcc\x2e\x9f\x50\x67\x26\x38\x4e\x70\xd1\x9f\xf8\x34\x1d\x1d\xb2\xd1\xc1\xca\x6d\x42\x7a\x30\x1f\x1d\xc9\x78\x90\x92\x66\xa0\x18\xbf\xae\x70\x82\x9b\xde\x0f\x98\xe9\x58\xe0\xa3\xc9\xe9\xd7\xe9\xd9\xd8\xea\xc3\x18\xda\x93\x05\x7e\x33\x96\x66\x05\x15\xd3\xe0\x3d\x90\x97\x63\x38\x1f\x24\x65\x47\x43\xd9\x5f\xa3\x67\xc4\x15\x61\xb4\xe2\x7f\x8b\xa4\x19\xb2\xb2\x8f\xa6\x91\xf1\xff\xa7\x68\xbf\x1f\x45\x1b\x3a\xe3\xf1\x24\xed\x69\xde\xfa\x2a\x41\xeb\xc4\xfe\xf1\xc8\xd9\x00\xcf\x11\x3d\xeb\x4d\xfa\x4f\x50\xb3\x51\x29\x7a\x90\x9d\x8d\xea\x0a\x69\xde\xbb\xf0\xdb\x70\x34\x92\xf7\x30\x3f\x03\x61\x6f\xb5\x1e\x5b\x62\xff\x30\x84\x6d\x42\xeb\xff\x72\xce\x76\x40\x9f\x7d\x0a\x6d\x1b\x88\xfd\x7d\x99\x5b\xff\x38\x3f\x02\xb5\xcc\x24\x16\x9e\xef\x58\x3e\x03\x0b\xd4\xb7\x88\x36\x10\xf5\xad\x70\x24\x40\x2a\x30\xf7\xa8\x3b\xd7\xa8\x9e\x06\x91\x0a\xa6\x78\xc0\xc7\xcf\x3f\x0a\x71\x13\x76\xa5\x0c\x26\xdb\xc1\x3e\x65\x0c\x6b\x01\x89\x2b\xb1\xce\xaa\x47\x2b\xe3\x38\x8f\x63\x96\x03\x8a\x5a\x67\x2a\xcf\x2a\x48\xaf\x72\x51\x63\xfa\x7a\xcc\x40\xbf\xf9\xbd\xe9\x66\xe3\x2f\x7c\xd1\xf2\xe3\x0b\x63\x95\xf7\xad\xc9\x10\x7a\x8f\x1d\x2a\x6f\x2a\xcc\x6c\x88\x39\x8e\x6b\xe6\xb4\x2d\xe4\x34\xa0\xe8\x15\x75\x3a\x4c\x7f\xe6\xec\x4b\x43\x00\x12\x24\xe6\xc2\x18\x7d\xd1\x8a\x0c\x78\x84\x2b\xb5\xfc\xb6\xcd\xaa\x6a\x72\x86\xea\xa0\x07\x2d\xba\x0b\x53\x4c\x3f\xdc\xd7\xb8\x43\xf3\x82\x03\xcf\x5f\x03\x9d\xe3\xc9\xfb\xd1\x9d\x0b\xd2\xd1\x8a\x30\xd8\x77\xf1\x19\x58\xd0\x58\x09\x5c\xe8\x11\x02\x4e\x66\x6d\xda\x9f\xb8\x45\x09\xb1\xcf\x96\x67\xe9\x0b\x62\xe6\x03\x9b\x12\xbf\x60\x7e\x44\xb2\xcc\x25\x24\x99\x2a\xec\x73\x9d\xc9\x6c\x85\x1a\x25\x95\xa2\xb2\x62\xb9\x56\x36\x7b\xcd\x57\x06\xaf\x8e\x59\x61\x42\x2f\x70\x3a\xe1\x17\x52\x60\x04\x8d\xd5\xe9\x0c\xa2\x75\xe4\x7e\x76\xa4\x81\x86\x58\xa1\xde\x3a\xff\xdb\x30\x8a\xde\x53\xb0\x63\x04\x31\x9d\x55\x9a\x2a\x93\x9d\xc7\xfe\xe5\xe2\x36\x81\xe8\xf2\xdc\xc6\x75\xe0\x03\xc4\xcb\x69\x5b\x9b\x2d\xae\x91\x4c\x39\x9c\xdc\xbc\xcf\xc5\x0c\x15\x2c\xee\xe1\xf2\x5c\xa5\x44\x27\x0e\x77\x76\xbf\x7f\xcc\x0a\x73\x59\x3e\xd8\xe2\xf2\xdc\xfc\xdd\x77\x57\x3e\x1d\x0c\x63\x89\xf6\x36\x7c\x7f\x58\x04\x1e\xd0\x72\x1a\xcd\x19\xa6\x57\xa6\xb0\xbd\xa5\x02\x35\x82\xae\xdc\xc2\x6d\x32\x49\xbe\x02\xda\x23\xd1\xf2\x81\x6e\x83\xa3\x6d\x09\xaf\xa3\x5d\xf1\x7b\xd0\x22\x80\x89\x7b\x65\x37\x18\x7f\xfc\x3c\x89\xf3\x71\xc7\x00\x49\x7c\x92\x78\x90\x0d\x39\x8c\x18\xc5\x4e\x1f\xb1\xcc\xce\xb2\xe3\x67\x10\xfd\xd3\x0d\x53\xa0\x9e\x58\x7a\x4b\xc4\xd2\x8e\xb7\xad\xa9\x8b\xa6\x9e\x75\xea\x5b\xae\xcc\x0a\xf5\xd1\x4f\xfa\xec\xd8\x24\x0d\xf7\x2f\xd3\xcb\xf3\x8e\xae\x4f\x7b\x72\xbf\xeb\x6d\xe2\xbb\xe4\x99\x7a\x1a\x35\x8e\xae\xf7\xf9\xaf\x40\x2f\xfd\x57\x04\x87\xe6\xde\xa6\xe1\x1b\xf8\xf8\x7b\xa0\x6b\x15\x83\x0f\x81\xdb\xad\xc2\xcd\x78\x3f\x88\xca\xc7\x74\x9d\x47\x36\x94\xfd\x27\xdc\xf9\x1c\xfc\x99\x16\x14\x6a\x5b\x07\xdc\x1b\x58\xd3\x89\x4d\xf9\x32\xe7\x75\x5b\x60\x29\x24\x82\xca\xd6\x78\x78\x89\xef\x0f\xce\xdd\x41\xd8\x75\xb9\xd2\x76\xb9\xb7\x96\x41\xb4\xa3\xc3\x59\x99\x4e\x9c\xc9\xfd\xa1\xc2\x1e\x19\x27\x3b\x43\xd7\x1a\xff\x82\xda\xb4\x88\x57\xf6\xe8\xb8\x71\x52\x7f\xaa\x69\x30\xab\x48\xd5\xef\xbf\x87\xef\xa6\x85\x8c\x4b\x80\xe9\xb2\x58\xc4\x49\x5f\x95\xfd\xa9\x6f\xed\x15\x19\x78\xdc\xc9\x18\xe9\xef\x12\xb5\x53\xe3\x52\x7d\x60\xe6\x4d\x9c\x0c\x2b\xfd\x44\x89\xbb\x42\x3d\xa5\x53\xbc\x4e\xf6\x1c\x31\x87\x3f\xb6\x79\xdc\x03\xc7\xde\xf9\x1c\x4c\x44\x83\x6c\xb8\x02\x22\x01\x36\xc0\xcd\xf5\x4e\xa3\x50\x9e\xd8\xf8\x2f\x28\x36\x58\x91\x69\x21\x95\x3f\x79\x74\x9f\x4a\x0f\x8d\x09\x77\x8e\xee\x8f\x19\x87\x84\x85\x69\xac\xa4\x4d\x2c\x24\x01\xf2\x4b\xaf\x87\x41\xf4\x82\x37\xab\x04\x62\xd3\xef\xcb\xf4\x72\x45\x28\x2e\x2a\xdf\xc2\x4d\xec\xac\x1f\x1b\x3b\xdd\xad\x83\xd1\x60\xb6\xc8\x14\xb3\x1c\xac\x4c\x5f\xd3\xb3\x29\xa3\xb6\x65\xdb\x69\xe3\xe3\xc7\x6e\x54\x74\x4a\xfb\xb2\x6e\x45\x4e\x1e\x81\xfb\xe2\xf7\xbd\x5b\xc6\x04\x37\xd7\x1d\x1b\x8a\xa7\x53\xdb\x81\xca\xae\x03\x99\xa3\xda\xe9\xe8\x52\xc4\x57\xa6\xb6\x3d\xed\xfd\x06\x65\xc6\x2a\x2c\x4c\xc9\x33\x3c\x1c\x3e\x8d\x25\x7d\x8a\x4e\xe1\xd9\xad\x95\x97\x38\xc3\xda\x03\xc2\x6d\xe8\xc5\x1d\x0a\xdb\xe5\x36\xb9\xb0\x27\x64\xb1\xe3\x67\x3e\x31\x93\x43\x53\x7d\xbb\x51\x5f\x9e\x93\xc3\x0e\x99\xd9\xe7\x33\x55\x80\xde\xc5\xfd\x31\x56\x48\x95\xbe\xc3\xdb\x31\x7e\x86\x53\xdb\xeb\x61\x89\x5f\x1a\x26\xcd\xff\x43\x31\x46\x18\xba\xf4\x69\x4c\x08\x3e\x45\xd1\x21\x29\x3a\xb8\xe8\xd8\xcd\x57\xf7\xf8\xef\x00\x00\x00\xff\xff\xbb\xb9\x1f\xec\x4a\x23\x00\x00") +var _templateBuilderUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5a\x6d\x6f\xdc\xc6\x11\xfe\x4c\xfe\x8a\x09\x71\x0e\x48\x41\xe2\x39\xf9\x56\x19\x2a\x10\x5b\x72\x23\xa0\x75\x0a\xcb\x49\x03\xd8\x46\xc0\x23\x87\xba\xad\x78\xbb\xf4\xee\xf2\x24\xe1\xca\xff\x5e\xcc\xbe\xf0\xe5\x8e\x27\x9d\x04\x37\x68\x8a\x02\x06\xc4\xe3\xee\xce\xce\x3c\x33\x3b\xf3\xcc\xd2\x9b\xcd\xfc\x28\x7c\x23\xea\x7b\xc9\xae\x97\x1a\xbe\x7f\xf9\xdd\x9f\x4e\x6a\x89\x0a\xb9\x86\xb7\x59\x8e\x0b\x21\x6e\xe0\x92\xe7\x29\xfc\x50\x55\x60\x26\x29\xa0\x71\xb9\xc6\x22\x0d\x3f\x2c\x99\x02\x25\x1a\x99\x23\xe4\xa2\x40\x60\x0a\x2a\x96\x23\x57\x58\x40\xc3\x0b\x94\xa0\x97\x08\x3f\xd4\x59\xbe\x44\xf8\x3e\x7d\xe9\x47\xa1\x14\x0d\x2f\x42\xc6\xcd\xf8\x5f\x2f\xdf\x5c\xbc\xbb\xba\x80\x92\x55\x08\xee\x9d\x14\x42\x43\xc1\x24\xe6\x5a\xc8\x7b\x10\x25\xe8\xc1\x66\x5a\x22\xa6\xe1\xd1\xbc\x6d\xc3\x70\xb3\x81\x02\x4b\xc6\x11\xa2\xa6\x2e\x32\x8d\x11\xb4\x2d\xbd\x9d\xd5\x37\xd7\x70\x7a\x06\x8b\x4c\x21\xcc\xd2\x37\x82\x97\xec\x3a\xfd\x7b\x96\xdf\x64\xd7\x08\x6e\xa9\xc6\x55\x5d\x65\x1a\x21\x5a\x62\x56\xa0\x8c\x60\xb6\x3b\xc4\x56\xb5\x90\xda\x0f\xd9\x5f\x10\x87\xc1\x66\x73\x02\x32\xe3\xd7\x08\xb3\x3a\xd3\x4b\xda\x6c\x96\x5e\xb1\x45\xc5\xf8\xf5\xa5\x99\xa5\x68\x45\x10\x44\x46\x1d\x9a\xd2\xb6\x91\x5d\x87\xbc\xa0\xb1\xc4\x6c\x35\x5b\x34\xac\x22\xb8\x8c\x84\x9f\x8d\x19\xef\xb2\x15\x7a\x4b\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\xd0\x09\xe7\x73\x18\x6e\xdb\xb6\xe4\x3a\xc2\xdd\xbf\x29\x85\x04\x03\x27\xe3\xd7\x66\x6a\xea\xf4\x01\xe4\x9a\x69\x86\x2a\x0d\xf5\x7d\x8d\xdb\x62\x94\x96\x4d\xae\x61\x13\x06\xb9\xc1\xdb\x1a\xdb\x43\x69\x5d\x34\x2f\x19\x56\x85\x22\x44\x4f\xda\x36\xb4\x0a\xfd\x63\x89\x12\x21\x2b\x0a\x05\x19\x70\xbc\x85\x5a\x62\xc1\x72\x5a\x46\xda\x90\x76\x5b\x9b\xb9\xc7\x34\x2c\x1b\x9e\x43\x3c\x44\xaa\x6d\xe1\x68\x3c\x3b\xb1\x1b\xc4\xb5\x82\x34\x4d\x3b\xd9\xe9\xd0\xb8\x64\x7b\x11\x19\x32\xc2\xb6\x6d\xfb\xa5\x0a\xce\x20\xab\x6b\xe4\x45\xbc\x7f\xce\x31\xd4\x2a\x4d\xd3\x24\x0c\x24\xea\x46\x72\x18\xf9\xd3\x1a\xbf\xd9\xc0\x2d\xd3\x4b\xc0\x3b\x4d\x61\x31\x83\xe8\xb5\xd5\x20\x1a\x39\x39\x18\x05\xa5\x42\xad\x69\x46\xea\xfc\xef\x02\xea\x79\xc2\x9c\x5b\xb0\xb8\x46\xb5\x2b\x72\x3e\x87\xab\x6c\x8d\x80\x77\x98\x37\x64\x37\xf9\xe2\x4b\x83\xf2\x1e\x32\x5e\x80\x35\xcc\xbe\xe5\xcd\x6a\x81\x92\xce\x2b\x17\x05\x2a\xc8\xca\x12\x73\x8d\x05\x2c\xee\xcd\xb8\xdd\x08\x44\x8d\xd2\x80\x35\xe5\x3b\x98\x72\x1e\x29\x10\xe7\xfa\x0e\x72\xc1\x35\xde\x69\x3a\xcf\xf4\x37\x81\x98\x71\x7d\x0c\x28\xa5\x90\x09\xf9\x6b\x9d\x49\x3a\x9c\x01\x4a\x69\xdf\x86\x41\xd0\xa9\xc1\xb8\x0e\x83\xc4\x46\x25\x2b\x61\x96\xfe\x98\x29\x7b\xde\xce\xb1\xcc\x9a\x4a\xdb\x03\xbb\xa5\x4e\x5a\xd8\x41\x15\x27\xa3\xd3\x1b\xb0\x12\x2a\xe4\xdb\xda\xa7\x4b\x21\x6e\x54\x02\x67\x67\xf0\x92\x34\x9a\xd8\xed\xcd\x12\xf3\x1b\x94\x2e\x3f\x90\x1c\x52\xf7\x6c\x3b\x3a\xd2\x9c\xe6\xc5\xc9\x2b\x33\xfc\xcd\x19\x70\x56\x19\x89\x81\x0f\xa7\x97\xc6\x74\x7a\xd3\xba\x8d\xbc\x6e\x9d\xd1\xc7\x7b\x64\x9b\xc8\xbf\xd2\x42\xda\x7c\xe8\x11\x4e\xc2\xa0\x05\xac\x14\x9a\x8d\x08\xcd\x55\xa3\xe1\x6f\x14\xdd\x82\xc4\x98\x27\x7c\xdb\xf0\x3c\x26\xdf\x4d\x39\xe5\x18\x56\x76\x1a\x13\x3c\x81\xf8\x97\xac\x6a\x70\xe8\xa2\x20\xf0\x87\xe5\x18\xc4\x0d\x25\xac\x55\x1a\x1b\x97\xa7\x7e\x99\x3f\x91\x0e\x9d\x6f\xc4\xcd\xd8\x6e\xce\xaa\x63\x28\x57\x3a\xbd\x20\xa9\x65\x1c\x35\x1c\xef\x6a\xeb\xe4\xee\x24\x9a\x0c\xf5\xe2\x43\x74\x0c\xab\xc4\x43\xf4\xb8\x33\x9e\xe3\x8d\x5d\x77\xf4\x9b\x75\x0e\xd9\x4e\x25\x70\xd6\xa9\x4a\xa3\xcf\xf7\x57\x8f\x67\x5a\x08\x8e\x70\x06\x5a\x36\x18\xf6\x6a\x8d\x44\x87\x41\x60\x70\xa5\xac\xca\x08\xfc\x07\x42\xf8\x04\xbe\x7b\x05\x0c\xfe\x7c\x06\x2f\x5f\x01\x3b\x39\xe9\xbc\x37\xa1\x9f\x59\xf2\x91\x7d\x8e\x57\x8d\x26\xf9\x64\x32\x2b\xe1\x37\x6b\xcf\xa9\x31\xd6\xfa\xd7\xe8\x7d\x0c\x5b\x70\x4c\xe0\xba\x8d\x6a\x1b\xd2\xbf\x49\xa3\xfa\x3c\xf5\xab\xe5\x21\x37\x68\x7e\x1d\xc3\xa2\xd1\x50\x67\x9c\xe5\x8a\xfc\x9e\x71\x1b\x88\x20\xf2\xbc\x91\xea\x49\x09\xe8\xd7\xe9\x0c\x44\xb5\x76\x13\x6e\xf9\xef\x74\x17\xa0\x81\xc7\x5c\x88\x0d\x6c\x35\x1a\xc6\x28\x65\x32\x65\xa3\x33\xef\xe2\x0e\xf3\x89\x34\x7c\xb0\x11\xb4\x7e\xda\x06\x8b\xc9\x26\x0c\x7e\x3b\x44\x7d\xa7\x5d\x8f\x3b\x09\xee\x71\xa7\x5f\x5f\x0b\x77\x23\x79\x5a\xe7\x4d\x87\xe3\x84\xb6\xde\xd4\xdd\xa8\x1a\x23\x3d\x59\x32\xdf\x3b\x41\xd1\x90\x43\x39\xea\x18\x59\x66\xf9\x84\xb2\x6a\xd2\xc6\x44\x5d\x3d\xa4\x54\x6f\xed\xea\xb6\x98\xe9\x55\x5d\x75\x44\xaf\x84\xa8\x60\x59\x85\xb9\x9e\xbf\x50\x73\xcf\x82\x87\xb9\xc2\x2c\xba\xeb\x14\xb3\xcb\x27\xd4\x99\x09\x8e\x13\x5c\xf4\x27\x3e\x4d\x47\x87\x6c\x74\xb0\x72\x9b\x90\x1e\xcc\x47\x47\x32\x1e\xa4\xa4\x19\x28\xc6\xaf\x2b\x9c\xe0\xa6\xf7\x03\x66\x3a\x16\xb8\x4b\x4e\x2d\x0f\x85\x8f\x9f\x95\x96\x8c\x3f\xce\x56\x1f\xe7\x6b\x63\x18\x0e\xa3\x6c\xcf\x16\xf8\x38\x6d\x43\x8a\x0a\xc8\xaa\x4a\xdc\x2a\x50\xe6\x17\xc1\x47\x45\x42\x48\x58\x09\x89\xe0\x30\x88\x73\x51\x35\x2b\xae\x12\xdb\x6c\xa1\xa3\x75\x58\x74\xa8\xce\xe7\xf0\x61\x89\xe0\xb8\x10\xb9\xa7\x17\x98\x55\x95\x17\x64\xbb\xb1\xc2\x77\x72\x76\x35\xa8\x7c\x89\xab\xec\xc1\x53\x3f\xb2\x34\x71\xba\xc7\x46\x2a\x58\xff\x1c\xfb\x3d\xd2\x34\xb5\x6f\x92\x89\xa5\x9e\xb4\x0f\xb3\x81\x5b\xd7\x11\x76\xef\xf1\x8d\x19\x68\xbd\xe0\xc7\x98\xfa\x13\x98\xb0\xf5\x4d\x31\x1d\xa0\x87\xa2\x00\x0f\x12\xdf\xa3\xa1\xec\xc7\x28\x30\xf1\x71\x18\xad\xf8\xdf\x22\xc2\x86\x10\xee\xa3\xc2\x64\xfc\xff\x69\xf0\xef\x47\x83\x87\xce\x78\x3a\x11\x7e\x9e\xb7\x1e\x25\xc1\x9d\xd8\x3f\x1e\x01\x1e\xe0\x39\xa2\xc0\xbd\x49\xff\x09\xfa\xbb\x9d\x90\xf7\x33\xe0\x51\x5e\x21\xcd\x7b\x17\x7e\x1d\x1e\x4c\xf2\x1e\xe6\xc0\x20\x86\xf5\xe6\x29\x76\xfd\x41\x48\xf1\x84\xd6\xff\xe5\xbc\xf8\x00\xea\xf2\x1c\x6a\x3c\x10\xfb\xfb\xb2\xe3\xfe\x71\x7e\x04\x6a\x99\x49\x2c\x3c\xa7\x74\xfc\x62\x81\xfa\x16\xd1\x06\xa2\xbe\x15\x8e\x04\x48\x05\xe6\xae\x7a\xe7\xaa\xda\x33\x4b\x52\xc1\x24\x0f\xf8\xf8\xf9\x47\x21\x6e\xc2\x2e\x95\xc1\x64\x39\xd8\xa7\x8c\x21\x82\x20\x71\x25\xd6\x59\xf5\x64\x65\x1c\x8d\x74\xec\x7d\xd0\x06\xd4\x99\xca\xb3\x0a\xd2\xab\x5c\xd4\x98\xbe\x1e\xb3\xfc\xaf\x7e\x37\xbd\xd9\xf8\x4b\x75\xb4\x3d\xc8\x85\xb1\xca\xfb\xd6\x9c\x10\x7a\x8f\x1d\x2a\x6f\x2a\xcc\x6c\x88\xb9\x3e\xc2\xcc\x69\x5b\xc8\x69\x40\xd1\x2b\xaa\x74\x98\xfe\xcc\xd9\x97\x86\x00\x24\x48\xcc\xa5\x3c\xfa\xa4\x15\x19\xf0\x08\x57\x2a\xf9\x6d\x4b\x84\x76\x6a\x86\xea\xa0\x07\x2d\xba\x4b\x69\x4c\x3f\xdc\xd7\xb8\x43\xf3\x82\x03\x7b\xdc\x81\xce\xf1\xe4\x1d\xf4\xce\x25\xf4\x68\x45\x18\xec\xa3\xac\x81\x05\x8d\x95\xc0\x85\x1e\x21\xe0\x64\xd6\xa6\xfc\x89\x5b\x94\x10\xfb\xd3\xf2\x22\xfd\x8e\x9a\x9d\x81\x4d\x89\x5f\x30\x3f\x22\x59\xe6\xa2\x97\x4c\x75\x9d\x42\x9d\xc9\x6c\x85\x1a\x25\xa5\xa2\xb2\x62\xb9\x56\xf6\xf4\xda\x36\xc2\xa9\x63\x56\x98\xd0\x0b\x9c\x4e\xf8\x85\x14\x18\x41\x63\x75\x3a\x83\x68\x1d\xb9\x9f\x1d\x69\xa0\x21\x56\xa8\xb7\xce\xff\x36\x8c\xa2\xf7\x14\xec\x18\x41\x4c\xfd\x60\x53\x65\xb2\xf3\xd8\xbf\x5c\xdc\x26\x10\x5d\x9e\xdb\xb8\x0e\x7c\x80\x78\x39\x6d\x6b\x4f\x8b\x2b\x24\x53\x0e\x27\x37\xef\x73\x31\x43\x05\x8b\x7b\xb8\x3c\x57\x29\xd1\x89\xc3\x9d\xdd\xef\x1f\x33\xdb\xce\x0c\xb6\xb8\x3c\x37\x7f\xf7\x7d\x8f\x98\x0e\x86\xb1\x44\xdb\xc7\xec\x0f\x8b\xc0\x03\x5a\x4e\xa3\x39\xc3\xf4\xca\x24\xb6\xb7\xa6\xfb\x1a\x42\x57\x6e\xe1\x36\x79\x48\x1e\x01\xed\x89\x68\xf9\x40\xb7\xc1\xd1\xb6\x84\xd7\xd1\xae\xf8\x3d\x68\x11\xc0\xc4\xbd\xb2\x1b\x8c\x3f\x7e\x9e\xc4\xf9\xb8\x63\x80\x24\x3e\x49\x3c\xc8\x86\x1c\x46\x8c\x62\xa7\x8f\x58\x66\x67\xd9\xf1\x33\x88\xfe\xe9\x86\x29\x50\x4f\x2c\xbd\x25\x62\x69\xc7\xdb\xd6\xe4\x45\x93\xcf\x3a\xf5\x2d\x57\x66\x85\xfa\xe8\x27\x7d\x76\x6c\x92\x86\xfb\x97\xe9\xe5\x79\x47\xd7\xa7\x3d\xb9\xdf\xf5\xf6\xe0\xbb\xc3\x33\xf5\x34\x2a\x1c\x5d\xed\xf3\x5f\xda\xbe\xf7\x5f\x6a\x1c\x9a\x7b\x8b\x86\x2f\xe0\xe3\x6f\xae\xae\x54\x0c\x3e\xb6\x6e\x97\x0a\x37\xe3\xfd\x20\x2a\x9f\x52\x75\x9e\x58\x50\xf6\x77\xb8\xf3\xb9\xbf\xd0\x50\xa0\x50\xdb\x3c\xe0\xaf\x38\xd6\xd4\xb1\x29\x9f\xe6\xbc\x6e\x0b\x2c\x85\x44\x50\xd9\x1a\x0f\x4f\xf1\x7d\xe3\xdc\x35\xc2\xae\xca\x95\xb6\xca\xbd\xb5\x0c\xa2\x1d\x35\x67\x65\x3a\xd1\x93\xfb\xa6\xc2\xb6\x8c\x93\x95\xa1\x2b\x8d\x7f\x41\x6d\x4a\xc4\x2b\xdb\x3a\x6e\x9c\xd4\x9f\x6a\x1a\xcc\x2a\x52\xf5\xdb\x6f\xe1\x9b\x69\x21\xe3\x14\x60\xaa\x2c\x16\x71\xd2\x67\x65\xdf\xf5\xad\xbd\x22\x03\x8f\x3b\x19\x23\xfd\xdd\x41\xed\xd4\xb8\x54\x1f\x98\x79\x13\x27\xc3\x4c\x3f\x91\xe2\xae\x50\x4f\xe9\x14\xaf\x93\x3d\x2d\xe6\xf0\xc7\x36\x8f\x7b\xa0\xed\x9d\xcf\xc1\x44\x34\xc8\x86\x2b\x73\xab\x65\x03\xdc\x5c\xef\x34\x0a\xe5\x89\xbf\xde\x5a\x67\x15\x2b\x32\x2d\xa4\xf2\x9d\x47\xf7\x39\xfa\xd0\x98\x70\x7d\x74\xdf\x66\x1c\x12\x16\xa6\xb0\x92\x36\xb1\x90\x04\xc8\x2f\xbd\x1e\x06\xd1\x0b\xde\xac\x12\x88\x4d\xbd\x2f\xd3\xcb\x15\xa1\xb8\xa8\x7c\x09\x37\xb1\xb3\x7e\x6a\xec\x74\xb7\x0e\x46\x83\xd9\x22\x53\xcc\x72\xb0\x32\x7d\x4d\xcf\x26\x8d\xda\x92\x6d\xa7\x8d\xdb\x8f\xdd\xa8\xe8\x94\xf6\x69\xdd\x8a\x9c\x6c\x81\xfb\xe4\xf7\xad\x5b\xc6\x04\x37\xd7\x1d\x1b\x8a\xa7\x53\x5b\x81\xca\xae\x02\x99\x56\xed\x74\x74\x29\xe2\x33\x53\xdb\x9e\xf6\x7e\x83\x32\x63\x15\x16\x26\xe5\xd9\x4b\xc6\x4f\x63\x49\x9f\xa2\x53\x78\x71\x6b\xe5\x25\xce\xb0\xf6\x80\x70\x1b\x7a\x71\x87\xc2\x76\x67\x9b\x5c\xd8\x13\xb2\xd8\xf1\x33\x7f\x30\x93\x43\x8f\xfa\x76\xa1\xbe\x3c\x27\x87\x1d\x32\xb3\x3f\xcf\x94\x01\x7a\x17\xf7\x6d\xac\x90\x2a\x7d\x87\xb7\x63\xfc\x0c\xa7\xb6\x57\xf0\x12\xbf\x34\x4c\x9a\xff\xeb\x63\x8c\x30\x74\xe9\xd3\x98\x10\x7c\x8a\xa2\x43\x8e\xe8\xe0\xa2\x63\xf7\xbc\xba\xc7\x7f\x07\x00\x00\xff\xff\xcf\xbf\xd8\x49\xae\x24\x00\x00") func templateBuilderUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -287,7 +287,7 @@ func templateBuilderUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/update.tmpl", size: 9034, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/builder/update.tmpl", size: 9390, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -592,7 +592,7 @@ func templateDialectGremlinSelectTmpl() (*asset, error) { return a, nil } -var _templateDialectGremlinUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x58\x5f\x6f\xdb\x38\x12\x7f\xb6\x3f\xc5\xac\xe1\x16\x52\xce\xcb\xa4\xfb\x76\x39\xe4\x80\x36\x71\x77\x7d\xd8\x4d\xba\x4d\xae\xf7\x50\x14\x01\x23\x8d\x6c\x22\x32\xa9\x25\x29\x35\x39\x43\xdf\xfd\x30\x24\x25\x4b\xb2\x93\x26\xed\xde\xf6\xa1\x8d\xc5\x3f\x33\xbf\x99\xf9\xcd\x70\xc8\xcd\xe6\xf0\x60\x7c\xaa\x8a\x7b\x2d\x96\x2b\x0b\x3f\x1d\xbd\xfa\xfb\x8f\x85\x46\x83\xd2\xc2\x5b\x9e\xe0\x8d\x52\xb7\xb0\x90\x09\x83\xd7\x79\x0e\x6e\x91\x01\x9a\xd7\x15\xa6\x6c\x7c\xb5\x12\x06\x8c\x2a\x75\x82\x90\xa8\x14\x41\x18\xc8\x45\x82\xd2\x60\x0a\xa5\x4c\x51\x83\x5d\x21\xbc\x2e\x78\xb2\x42\xf8\x89\x1d\x35\xb3\x90\xa9\x52\xa6\x63\x21\xdd\xfc\xaf\x8b\xd3\xf9\xf9\xe5\x1c\x32\x91\x23\x84\x31\xad\x94\x85\x54\x68\x4c\xac\xd2\xf7\xa0\x32\xb0\x1d\x65\x56\x23\xb2\xf1\xc1\x61\x5d\x8f\xc7\x9b\x0d\xa4\x98\x09\x89\x30\x49\x05\xcf\x31\xb1\x87\x4b\x8d\xeb\x5c\xc8\xc3\xb2\x48\xb9\xc5\x09\xd4\x35\xad\x9a\xde\x94\x22\x27\x4c\xc7\x27\x50\x70\x93\xf0\x1c\xa6\xec\x32\x51\x05\xb2\x37\x61\x26\x2c\xd4\x98\xa0\xa8\xfc\xca\xf6\x77\xbb\x3d\x2c\x5a\x97\x96\x5b\xa1\xa4\x13\xa7\x85\xb4\x9d\x7d\x13\xd6\xcc\xb6\xca\x95\x44\x5a\xb9\xe2\xe6\xb2\xcc\x32\x71\xb7\x95\x37\xb9\x90\x5b\x8c\xff\x45\xad\x68\xdd\x11\xd4\xf5\x66\x03\x22\xf3\x3b\xdd\x87\x9f\x3c\x81\x89\x14\xf9\xc4\x0f\xa1\x4c\x69\xe7\x38\x2b\x65\x02\x51\x0f\x7b\x5d\xc3\x41\xd7\xea\xba\x8e\x21\x38\xe6\x92\x57\x18\x25\xf6\x0e\x12\x25\x2d\xde\x59\x76\xea\xff\xc6\x24\xe2\xc7\x8e\x52\x27\x80\x9d\xf3\x75\x40\x80\xb9\xa1\x5f\x42\xda\x56\xf7\x0c\x50\x6b\xa5\x63\xd8\x8c\x47\x1a\x0d\x61\x7f\x19\xd4\xb0\xf7\x68\x0a\x25\x0d\x6e\xea\xf1\xa8\x2f\x78\x3c\x1a\x89\x74\x06\xea\x96\xd6\xf7\xbc\x59\xd7\xcc\x29\x5d\x9c\xb1\xdf\xc2\xd8\xcf\x68\xa1\xae\xa3\x98\x36\x65\xf0\x83\xba\x25\x5d\xa3\x91\x46\x5b\x6a\x09\xad\x63\x08\xcb\xcb\x0f\x3c\x17\xa9\xdb\x35\x27\x58\x1b\xc2\x7e\x0c\x93\xc5\xd9\xc4\x01\x3d\x86\x6c\x6d\x99\x9b\xca\xa2\xc9\x5a\x18\x23\xe4\x12\xba\x56\xb2\xc5\x19\x64\x4a\x43\xe0\x4e\x4c\x50\xe9\xdf\x1f\x25\xea\xfb\x19\xdc\x08\x99\x0a\xb9\x34\x0d\xee\x8e\xbb\x59\x30\x3b\x12\x69\xcc\x7e\xa7\xe5\x04\x99\xec\x0e\x6e\x7b\x9e\x94\xa1\x0c\x1f\x69\xf2\x00\x6a\xbd\x6f\x63\xaa\xe9\x17\x9b\xdf\x61\x42\xc1\x9d\xc1\x40\xd9\x8c\x32\x37\xfe\x87\xdb\xfe\xc3\x09\x48\x91\x3b\x3f\xee\x73\x23\x6a\x3d\x1e\xb5\xca\x9a\x38\x09\x73\xaa\xa4\xb1\x5c\x5a\xe7\xc0\xc8\x8b\x0b\xe1\x78\x4c\xcc\x4e\xec\x69\x60\xea\x8c\x98\xb2\xf7\x5b\x13\xdc\x0c\x4d\xd4\xb5\xe3\x51\x8f\x7d\x89\x92\x99\x58\x1e\xef\x98\xed\xc7\x6b\x4f\x8e\xae\x6b\x68\xf2\xad\x56\xeb\x86\x85\xd1\x5e\xf3\x1b\xe0\x52\xe4\x01\xb0\x0b\x77\xc7\x1c\xed\x6c\x91\x22\x1f\x06\x33\xac\xd1\x68\xd8\x7b\xe4\xe9\x42\xda\x41\xb0\x9e\x9d\x98\x51\x2f\xe5\x45\x0a\x4d\x2a\x5c\xdd\x17\xd8\xcd\xf8\x18\x0e\x52\x93\xb3\x2b\xcd\x2b\xd4\x86\x3b\x53\x48\xf1\x67\x61\x57\xc0\xce\xcb\xb5\x8b\x94\xe6\x54\x96\x1c\x56\x4b\x02\x92\xed\xa0\xb1\xba\x4c\xac\xf7\x40\xa1\x31\x1d\xca\x3b\x3c\xec\xae\xa6\x15\x22\xe1\x16\x19\xad\xb7\x68\xec\x9e\xf5\x6e\x78\xcd\x6d\xb2\x42\x03\x5c\xa6\x20\xac\xf1\x42\xb8\xb4\x2c\xf8\x75\x2b\xd4\x91\x7f\xcd\x6f\x31\xfa\xf8\xe9\x60\x3b\x3c\x83\xa3\x19\x99\xcd\xc8\xca\x3e\xf5\xe9\xf7\xe1\x01\x24\xdc\x20\x1d\x08\x3e\x43\xc1\x14\x98\x88\x4c\x24\x50\xa1\xb6\x78\x07\xee\x54\xd8\xa5\x5c\x45\xea\x96\xec\x03\x65\x67\x2b\x6a\x89\x12\x35\xcf\x1b\x51\x94\xf7\xe7\x4e\x8e\x48\xd0\x74\x24\x6d\x63\xde\x8a\x89\xd9\x2f\xdc\xfc\xca\x6f\x30\x77\xd1\x65\xef\x78\x72\xcb\x97\xae\x82\xb8\x51\xaa\x56\x24\xef\x7a\x06\x85\x3b\x47\xb8\x5c\xe2\x4e\xa9\x6b\x1d\x6b\x42\x28\xa2\x2a\xf6\x9e\xea\x1a\x5e\x71\x0d\x91\x4f\x0e\x91\x81\xd2\xc3\x08\x47\x39\x4a\x98\xb2\x79\xba\x44\x13\x7b\x9c\x23\x5d\xc1\x09\x54\xec\x34\x57\x12\x5d\xe9\x1c\x5d\xc3\x09\xe8\xca\x8b\x69\x24\x8f\xac\x36\xf0\xf1\x53\x3f\x98\xe3\x51\xf0\x90\xc7\x3c\xcd\x7c\xa2\x36\xe5\xf8\xad\xc0\x3c\x35\xdb\x44\xf6\x90\x22\xa9\x2c\x4c\x33\xb6\x58\x93\x7d\x37\x39\xc6\xf4\xf5\x6f\xe7\xd8\x33\xcc\x78\x99\x07\x26\x52\x9a\x56\x3c\x2f\xf1\xb1\xf2\x9f\xed\x14\xff\xb6\xd0\xb4\x4a\x49\xbc\x14\x7f\x94\x21\x32\xa3\x3e\xb9\x4e\x80\x17\x05\xca\x34\xea\x0c\xce\xe0\xe5\xf6\xcb\xcb\xf2\xec\x3f\xde\x86\x74\x7f\x34\x67\x30\x1c\xf6\x28\x9b\x82\xe8\x4a\x84\xb3\x2a\x66\xa7\xaa\xa4\x4a\x30\x0b\xf2\x29\x2d\x8e\xe1\xfa\x9a\x2d\x4c\x54\xb0\xf3\xf9\xef\xd1\x51\x1c\xb7\x1b\xa3\x73\xfc\x3c\xd7\xda\x1b\xe2\x3c\xfb\xcd\x00\x1a\xcd\x75\xdc\x7a\xab\x0d\xf7\x68\x54\xb1\x77\x5a\x15\xa8\xed\x7d\x44\x41\xbf\x14\x72\x99\xe3\x33\xa4\x93\x10\x27\x29\x44\x81\x12\x7d\x9a\xb9\x02\x45\xac\x44\x2d\x92\xb0\xd3\xe5\x63\x7a\xa5\xde\x70\x23\x92\x46\xfd\x97\x82\xff\x3a\x4d\x31\xf5\xca\x2f\x5d\x89\x72\x3e\x19\x32\xe0\x61\x0a\x8c\x78\x9a\x7e\x20\x05\x2e\xe7\x5a\xfe\xd3\x32\x25\xa3\xeb\x6b\xe6\x26\x77\xa3\xbc\x63\x6f\x3c\xa3\x98\xb5\x61\x0a\xae\x65\x97\xe5\x3a\x8a\xd9\x39\xde\x59\x9f\x54\x5f\xcb\xba\x3f\x91\x76\x8d\xc5\x3b\xcc\xfb\x2b\xa9\x47\x6d\xd5\xa5\x6b\x83\xb3\x68\xf2\xb7\x13\x78\x51\x4d\x5a\x3e\xb6\x80\x02\x23\x87\x94\xfc\x06\x4e\x5e\x5f\xff\xb9\x91\xf5\x00\x5b\x7e\xb7\x20\x87\xc7\xd0\xf0\x48\xca\x91\x6b\x50\x05\xb1\x98\xe7\x90\xb9\x0a\xc9\x3a\x07\x88\x3b\x97\xa7\x14\xe8\x8b\x66\x91\x3f\x4e\xb8\x86\xc2\xdb\x2e\x90\x2a\xb1\x90\x16\x75\xc6\x13\xd7\x33\x3f\xb1\x08\x77\xb2\xa1\x2f\xdd\xa5\xdb\xfe\xf2\xda\x4f\xae\x53\xc2\x8f\x69\x14\x37\xf9\xd5\xc1\xd4\x52\x7a\x3b\xf6\x84\xd0\x3c\xc5\x91\x84\x2e\x47\xd9\x11\x1c\xc3\x3f\xe1\xc8\x63\xa8\xd8\xa5\x48\x71\x9e\x65\x98\x58\x8a\xee\xbb\x76\x51\x67\x3d\x63\x2c\x66\x67\x5a\x15\x3e\x72\x7b\x82\x13\xbc\x87\xde\x7b\xee\x84\xec\xb4\xa0\xfe\x82\x19\x2e\x71\x93\x85\xbf\xad\x85\x39\x49\x7d\x67\x73\xb7\xcb\x60\xf2\xc2\xb0\x17\x66\xd2\x31\x7b\x8a\x3e\x3f\x3a\x56\x6f\x4f\xc4\x29\xb2\x85\x59\x50\x0d\x6c\x3a\x87\xa1\xc6\x13\x98\x5c\x94\x76\xd2\x9d\x74\x2a\x77\x35\xa2\xaf\xae\x5f\xd6\xdb\xf3\xf2\xe1\x01\x68\x5c\xab\x0a\x01\x9d\xd5\x9e\x8c\x1d\x7c\xdd\xca\xf9\x00\x4f\xf0\x51\x9e\xf4\x3b\xa3\xd0\xec\x88\xf4\xe1\x6e\xe7\xbd\xc3\x93\xee\x93\xbc\x38\x33\x5d\xa9\x5d\x43\x3c\xda\x37\x22\x15\xc1\x57\x56\x0f\x8a\xfb\x1b\x65\x57\x73\x97\xf8\xd2\x5f\x16\x62\xdf\x29\xb9\x96\xa4\x63\x28\xfb\xcf\x0a\x35\x12\x9b\x2e\x34\xfd\xbf\x90\xa1\xfa\x2e\xce\xa8\x2d\x74\x75\xe1\xa2\xb4\xbd\xc1\x38\x6e\xdb\xa5\xc0\x34\xb6\xb0\xa8\xb9\xf5\x5d\x55\xeb\x83\xfd\x31\xdf\x81\xba\x90\xcf\x04\x6a\x57\xa8\xfb\x80\x9e\x86\xe7\x01\xfd\x17\xa5\xfd\x0b\x00\xb4\xb5\x9d\xda\xcb\xb6\x80\x58\x6d\x66\x60\x75\xc8\xd4\x86\xa4\xa1\xf7\xee\x91\xf4\x09\x5c\xfa\x32\x89\xf6\x47\xa4\xa2\x16\xa3\xef\x02\x77\x4b\x8c\xc2\xdd\x20\xf6\xac\xd8\x75\xe5\xbe\x8d\x57\x6a\xbb\xcd\x13\xe7\x61\x02\xff\xc2\xcd\xf0\x52\xb6\x9f\xde\x5f\xd5\x50\xf8\x76\x62\x90\x13\x7d\xb0\xfd\xee\xe0\x19\xbd\x01\x55\xcd\xc7\x5a\x83\xa0\x81\xe2\xd5\x9c\xf5\xa1\xfe\x7f\xbd\x25\x4b\x36\x1f\x5e\xb1\x5a\x43\xbe\x2a\x8b\xbf\x83\xf9\x03\x02\xfd\x9f\xbc\x41\x1f\xdb\x53\xa5\xae\x7b\x76\x7f\x2f\xab\xf7\x1e\xf7\x3b\xc7\x73\xe7\x86\x5e\xf9\xf6\xed\x37\x5e\x44\x56\x97\x18\x6f\x1f\x1b\xab\xc6\x86\xce\xb5\xf5\xd1\xa7\x8e\xd0\x55\x74\x1c\xdb\x69\x2b\x42\xd1\x59\xf3\x5b\x04\x53\x6a\x74\x8f\xcd\xb6\x7d\xc6\x48\x15\x1a\x57\x0c\x13\x25\x2d\x17\x12\xd6\xca\xad\xe1\x12\x08\x67\x78\x62\x10\x19\x7c\x46\x58\xf1\xaa\xf7\xa4\x12\x6a\x57\x93\xd4\xae\xa4\xb6\xcf\x0f\xdf\x9a\xd5\x8f\x84\xf1\xe7\xab\xe8\x55\x37\x8a\x2f\xb7\x0e\xf1\x6f\xa0\x6b\xb3\x3c\x86\x49\xa8\xb3\x5b\x5b\x83\x89\x66\xaf\x8d\x93\xfa\xe1\xa0\x8e\x2a\x38\xe9\x18\x6e\x3e\x1e\x7d\x72\x0f\x19\xec\x54\xf1\x1c\x4d\x82\xd1\x60\x92\xf0\xce\xc0\xbd\x6c\x34\xa5\x3d\xd1\xdb\xd2\xde\x5d\xfd\xea\xf8\x53\xe8\x41\x9d\x12\x3d\x14\xac\x7b\xc2\xf6\xb0\x6a\xf7\xc4\xa1\xa5\xe1\xa9\x8e\x6e\x17\xff\x52\x42\xd2\x04\xf5\x8e\x63\xf7\xe8\x1e\xb6\xfe\x2f\x00\x00\xff\xff\xb3\x7b\x20\xb8\x0d\x19\x00\x00") +var _templateDialectGremlinUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x59\xdd\x6f\xdb\x38\x12\x7f\xb6\xff\x8a\x59\xc3\x2d\xa4\xac\x97\x49\xf7\xed\x72\xc8\x01\x6d\xe2\xee\xfa\xb0\x9b\x74\x9b\x5c\xef\xa1\x28\x02\x46\x1a\xd9\x44\x64\x52\x4b\x52\x6a\x72\x86\xfe\xf7\xc3\x90\x94\x2c\xc9\x4e\x9a\xb4\xfb\xf1\xd0\xd6\x22\x87\xf3\xf9\x9b\x0f\xb2\x9b\xcd\xe1\xc1\xf8\x54\x15\xf7\x5a\x2c\x57\x16\x7e\x3c\x7a\xf5\x8f\x1f\x0a\x8d\x06\xa5\x85\xb7\x3c\xc1\x1b\xa5\x6e\x61\x21\x13\x06\xaf\xf3\x1c\x1c\x91\x01\xda\xd7\x15\xa6\x6c\x7c\xb5\x12\x06\x8c\x2a\x75\x82\x90\xa8\x14\x41\x18\xc8\x45\x82\xd2\x60\x0a\xa5\x4c\x51\x83\x5d\x21\xbc\x2e\x78\xb2\x42\xf8\x91\x1d\x35\xbb\x90\xa9\x52\xa6\x63\x21\xdd\xfe\x2f\x8b\xd3\xf9\xf9\xe5\x1c\x32\x91\x23\x84\x35\xad\x94\x85\x54\x68\x4c\xac\xd2\xf7\xa0\x32\xb0\x1d\x61\x56\x23\xb2\xf1\xc1\x61\x5d\x8f\xc7\x9b\x0d\xa4\x98\x09\x89\x30\x49\x05\xcf\x31\xb1\x87\x4b\x8d\xeb\x5c\xc8\xc3\xb2\x48\xb9\xc5\x09\xd4\x35\x51\x4d\x6f\x4a\x91\x93\x4e\xc7\x27\x50\x70\x93\xf0\x1c\xa6\xec\x32\x51\x05\xb2\x37\x61\x27\x10\x6a\x4c\x50\x54\x9e\xb2\xfd\xdd\x1e\x0f\x44\xeb\xd2\x72\x2b\x94\x74\xec\xb4\x90\xb6\x73\x6e\xc2\x9a\xdd\x56\xb8\x92\x48\x94\x2b\x6e\x2e\xcb\x2c\x13\x77\x5b\x7e\x93\x0b\xb9\xd5\xf1\x7f\xa8\x15\xd1\x1d\x41\x5d\x6f\x36\x20\x32\x7f\xd2\x7d\xf8\xcd\x13\x98\x48\x91\x4f\xfc\x12\xca\x94\x4e\x8e\xb3\x52\x26\x10\xf5\x74\xaf\x6b\x38\xe8\x5a\x5d\xd7\x31\x04\xc7\x5c\xf2\x0a\xa3\xc4\xde\x41\xa2\xa4\xc5\x3b\xcb\x4e\xfd\xbf\x31\xb1\xf8\xa1\x23\xd4\x31\x60\xe7\x7c\x1d\x34\xc0\xdc\xd0\x2f\x21\x6d\x2b\x7b\x06\xa8\xb5\xd2\x31\x6c\xc6\x23\x8d\x86\x74\x7f\x19\xc4\xb0\xf7\x68\x0a\x25\x0d\x6e\xea\xf1\xa8\xcf\x78\x3c\x1a\x89\x74\x06\xea\x96\xe8\x7b\xde\xac\x6b\xe6\x84\x2e\xce\xd8\xaf\x61\xed\x27\xb4\x50\xd7\x51\x4c\x87\x32\xf8\x4e\xdd\x92\xac\xd1\x48\xa3\x2d\xb5\x84\xd6\x31\xa4\xcb\xcb\x0f\x3c\x17\xa9\x3b\x35\x27\xb5\x36\xa4\xfb\x31\x4c\x16\x67\x13\xa7\xe8\x31\x64\x6b\xcb\xdc\x56\x16\x4d\xd6\xc2\x18\x21\x97\xd0\xb5\x92\x2d\xce\x20\x53\x1a\x02\x76\x62\x52\x95\xfe\xfc\x5e\xa2\xbe\x9f\xc1\x8d\x90\xa9\x90\x4b\xd3\xe8\xdd\x71\x37\x0b\x66\x47\x22\x8d\xd9\x6f\x44\x4e\x2a\x93\xdd\xc1\x6d\xcf\xe3\x32\xe4\xe1\x23\x4d\x1e\x40\xad\xf7\x1d\x4c\x35\xfd\x62\xf3\x3b\x4c\x28\xb8\x33\x18\x08\x9b\x51\xe6\xc6\xff\x74\xc7\xbf\x3b\x01\x29\x72\xe7\xc7\x7d\x6e\x44\xad\xc7\xa3\x56\x58\x13\x27\x61\x4e\x95\x34\x96\x4b\xeb\x1c\x18\x79\x76\x21\x1c\x8f\xb1\xd9\x89\x3d\x2d\x4c\x9d\x11\x53\xf6\x7e\x6b\x82\xdb\xa1\x8d\xba\x76\x38\xea\xa1\x2f\x51\x32\x13\xcb\xe3\x1d\xb3\xfd\x7a\xed\xc1\xd1\x75\x0d\x6d\xbe\xd5\x6a\xdd\xa0\x30\xda\x6b\x7e\xa3\xb8\x14\x79\x50\xd8\x85\xbb\x63\x8e\x76\xb6\x48\x91\x0f\x83\x19\x68\x34\x1a\xf6\x1e\x79\xba\x90\x76\x10\xac\x67\x27\x66\xd4\x4b\x79\x91\x42\x93\x0a\x57\xf7\x05\x76\x33\x3e\x86\x83\xd4\xe4\xec\x4a\xf3\x0a\xb5\xe1\xce\x14\x12\xfc\x59\xd8\x15\xb0\xf3\x72\xed\x22\xa5\x39\x95\x25\xa7\xab\x25\x06\xc9\x76\xd1\x58\x5d\x26\xd6\x7b\xa0\xd0\x98\x0e\xf9\x1d\x1e\x76\xa9\x89\x42\x24\xdc\x22\x23\x7a\x8b\xc6\xee\xa1\x77\xcb\x6b\x6e\x93\x15\x1a\xe0\x32\x05\x61\x8d\x67\xc2\xa5\x65\xc1\xaf\x5b\xa6\x0e\xfc\x6b\x7e\x8b\xd1\xc7\x4f\x07\xdb\xe5\x19\x1c\xcd\xc8\x6c\x46\x56\xf6\xa1\x4f\xbf\x0f\x0f\x20\xe1\x06\xa9\x21\xf8\x0c\x05\x53\x60\x22\x32\x91\x40\x85\xda\xe2\x1d\xb8\xae\xb0\x0b\xb9\x8a\xc4\x2d\xd9\x07\xca\xce\x96\xd5\x12\x25\x6a\x9e\x37\xac\x28\xef\xcf\x1d\x1f\x91\xa0\xe9\x70\xda\xc6\xbc\x65\x13\xb3\x9f\xb9\xf9\x85\xdf\x60\xee\xa2\xcb\xde\xf1\xe4\x96\x2f\x5d\x05\x71\xab\x54\xad\x88\xdf\xf5\x0c\x0a\xd7\x47\xb8\x5c\xe2\x4e\xa9\x6b\x1d\x6b\x42\x28\xa2\x2a\xf6\x9e\xea\x1a\x5e\x71\x0d\x91\x4f\x0e\x91\x81\xd2\xc3\x08\x47\x39\x4a\x98\xb2\x79\xba\x44\x13\x7b\x3d\x47\xba\x82\x13\xa8\xd8\x69\xae\x24\xba\xd2\x39\xba\x86\x13\xd0\x95\x67\xd3\x70\x1e\x59\x6d\xe0\xe3\xa7\x7e\x30\xc7\xa3\xe0\x21\xaf\xf3\x34\xf3\x89\xda\x94\xe3\xb7\x02\xf3\xd4\x6c\x13\xd9\xab\x14\x49\x65\x61\x9a\xb1\xc5\x9a\xec\xbb\xc9\x31\xa6\xaf\xff\x38\xc7\x9e\x61\xc6\xcb\x3c\x20\x91\xd2\xb4\xe2\x79\x89\x8f\x95\xff\x6c\xa7\xf8\xb7\x85\xa6\x15\x4a\xec\xa5\xf8\xbd\x0c\x91\x19\xf5\xc1\x75\x02\xbc\x28\x50\xa6\x51\x67\x71\x06\x2f\xb7\x5f\x9e\x97\x47\xff\xf1\x36\xa4\xfb\xa3\x39\x83\xe1\xb2\xd7\xb2\x29\x88\xae\x44\x38\xab\x62\x76\xaa\x4a\xaa\x04\xb3\xc0\x9f\xd2\xe2\x18\xae\xaf\xd9\xc2\x44\x05\x3b\x9f\xff\x16\x1d\xc5\x71\x7b\x30\x3a\xc7\xcf\x73\xad\xbd\x21\xce\xb3\xdf\xac\x40\x23\xb9\x8e\x5b\x6f\xb5\xe1\x1e\x8d\x2a\xf6\x4e\xab\x02\xb5\xbd\x8f\x28\xe8\x97\x42\x2e\x73\x7c\x06\x77\x62\xe2\x38\x85\x28\x50\xa2\x4f\x33\x57\xa0\x08\x95\xa8\x45\x12\x4e\xba\x7c\x4c\xaf\xd4\x1b\x6e\x44\xd2\x88\xff\x52\xf0\x5f\xa7\x29\xa6\x5e\xf8\xa5\x2b\x51\xce\x27\x43\x04\x3c\x0c\x81\x11\x4f\xd3\x0f\x24\xc0\xe5\x5c\x8b\x7f\x22\x53\x32\xba\xbe\x66\x6e\x73\x37\xca\x3b\xf6\xc6\x33\x8a\x59\x1b\xa6\xe0\x5a\x76\x59\xae\xa3\x98\x9d\xe3\x9d\xf5\x49\xf5\xb5\xa8\xfb\x03\x61\xd7\x58\xbc\x83\xbc\xbf\x12\x7a\x34\x56\x5d\xba\x31\x38\x8b\x26\xdf\x9f\xc0\x8b\x6a\xd2\xe2\xb1\x55\x28\x20\x72\x08\xc9\x6f\xc0\xe4\xf5\xf5\x1f\x1b\x59\xaf\x60\x8b\xef\x56\xc9\x61\x1b\x1a\xb6\xa4\x1c\xb9\x06\x55\x10\x8a\x79\x0e\x99\xab\x90\xac\xd3\x40\x5c\x5f\x9e\x52\xa0\x2f\x1a\x22\xdf\x4e\xb8\x86\xc2\xdb\x2e\x90\x2a\xb1\x90\x16\x75\xc6\x13\x37\x33\x3f\xb1\x08\x77\xb2\xa1\xcf\xdd\xa5\xdb\xfe\xf2\xda\x4f\xae\x53\xd2\x1f\xd3\x28\x6e\xf2\xab\xa3\x53\x0b\xe9\xed\xda\x13\x42\xf3\x14\x47\x92\x76\x39\xca\x0e\xe3\x18\xfe\x05\x47\x5e\x87\x8a\x5d\x8a\x14\xe7\x59\x86\x89\xa5\xe8\xbe\x6b\x89\x3a\xf4\x8c\xb1\x98\x9d\x69\x55\xf8\xc8\xed\x09\x4e\xf0\x1e\x7a\xef\xb9\x0e\xd9\x19\x41\xfd\x05\x33\x5c\xe2\x26\x0b\x7f\x5b\x0b\x7b\x92\xe6\xce\xe6\x6e\x97\xc1\xe4\x85\x61\x2f\xcc\xa4\x63\xf6\x14\x7d\x7e\x74\xac\xde\x76\xc4\x29\xb2\x85\x59\x50\x0d\x6c\x26\x87\xa1\xc4\x13\x98\x5c\x94\x76\xd2\xdd\x74\x22\x77\x25\xa2\xaf\xae\x5f\x96\xdb\xf3\xf2\xe1\x01\x68\x5c\xab\x0a\x01\x9d\xd5\x1e\x8c\x1d\xfd\xba\x95\xf3\x01\x9c\xe0\xa3\x38\xe9\x4f\x46\x61\xd8\x11\xe9\xc3\xd3\xce\x7b\xa7\x4f\xba\x8f\xf3\xe2\xcc\x74\xb9\x76\x0d\xf1\xda\xbe\x11\xa9\x08\xbe\xb2\x7a\x50\xdc\xdf\x28\xbb\x9a\xbb\xc4\x97\xfe\xb2\x10\xfb\x49\xc9\x8d\x24\x1d\x43\xd9\x7f\x57\xa8\x91\xd0\x74\xa1\xe9\xef\x85\x0c\xd5\x77\x71\x46\x63\xa1\xab\x0b\x17\xa5\xed\x2d\xc6\x71\x3b\x2e\x05\xa4\xb1\x85\x45\xcd\xad\x9f\xaa\x5a\x1f\xec\x8f\xf9\x8e\xaa\x0b\xf9\x4c\x45\xed\x0a\x75\x5f\xa1\xa7\xe9\xf3\x80\xfc\x8b\xd2\xfe\x05\x0a\xb4\xb5\x9d\xc6\xcb\xb6\x80\x58\x6d\x66\x60\x75\xc8\xd4\x06\xa4\x61\xf6\xee\x81\xf4\x09\x58\xfa\x32\x88\xf6\x47\xa4\xa2\x11\xa3\xef\x02\x77\x4b\x8c\xc2\xdd\x20\xf6\xa8\xd8\x75\xe5\xbe\x83\x57\x6a\x7b\xcc\x03\xe7\x61\x00\xff\xcc\xcd\xf0\x52\xb6\x1f\xde\x5f\x35\x50\xf8\x71\x62\x90\x13\x7d\x65\xfb\xd3\xc1\x33\x66\x03\xaa\x9a\x8f\x8d\x06\x41\x02\xc5\xab\xe9\xf5\xa1\xfe\x7f\xbd\x25\x4b\x36\x1f\x5e\xb1\x5a\x43\xbe\x2a\x8b\xff\x06\xf3\x07\x00\xfa\x93\xbc\x41\x1f\xdb\xae\x52\xd7\x3d\xbb\xff\x2e\xab\xf7\xb6\xfb\x3d\xed\xb9\xff\x22\xe8\xc7\x81\xe1\x03\x8f\x9f\xa6\x3a\xa3\x81\x5f\xe8\x3c\x1f\x74\x86\x26\xf7\x7c\xf0\x08\x97\xef\x5f\xc5\x1d\x16\x6d\x14\xfc\x37\x55\xa7\x70\xc5\x09\x15\x28\xeb\x17\xa0\x5d\x86\x61\x60\x7a\x88\x5f\xb6\xbd\x2f\x55\x7e\x40\xfd\x95\x17\x61\x97\x86\x17\xf2\x8a\xc7\xc8\x66\x40\xd3\x68\xb2\xfb\x02\xd1\xc4\x74\xd7\x9b\x0f\xbe\xfe\x04\xcf\x76\xb0\xd6\x71\x67\xa8\xc3\xe4\x4b\x30\xa5\x46\xf7\xfe\x6e\xdb\x97\x9d\x54\xa1\x71\xfd\x21\x51\xd2\x72\x21\x61\xad\x1c\x0d\x97\x40\x91\x0b\xaf\x2e\x22\x83\xcf\x08\x2b\x5e\xf5\x5e\x99\x42\x39\x6f\x42\xed\xba\x4c\x1b\xee\x6f\x2d\x74\x8f\x20\xfb\xa7\xab\xe8\x55\x17\xd8\x2f\xb7\x0e\xf1\xcf\xc2\x6b\xb3\x3c\x86\x49\x68\x3d\x5b\x5b\x83\x89\x66\xaf\x8d\x93\xfa\x61\x9c\x8f\x2a\x38\xe9\x18\x6e\x3e\x1e\x7d\x72\x6f\x3b\xec\x54\xf1\x1c\x4d\x82\xd1\x60\x93\xf4\x9d\x41\xd5\xc5\x5a\xa2\xb7\x60\xeb\x52\xbf\x3a\xfe\x14\x50\xe6\x84\xe8\x21\x63\xdd\x63\xb6\x27\xd1\x76\x9b\x30\x91\x86\xd7\x4b\xba\x70\xfd\x5b\x09\x49\x1b\x0e\x91\xee\xff\x21\xc2\xd1\xff\x07\x00\x00\xff\xff\xed\x2d\x99\x76\x20\x1a\x00\x00") func templateDialectGremlinUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -607,7 +607,7 @@ func templateDialectGremlinUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/gremlin/update.tmpl", size: 6413, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/gremlin/update.tmpl", size: 6688, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -932,7 +932,7 @@ func templateDialectSqlTxTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x57\xdd\x6e\xdb\xb8\x12\xbe\xb6\x9f\x62\x2a\x18\x81\x1d\xb8\x4a\x4e\xef\x8e\x0b\x1f\x20\x4d\xd2\x03\x63\xdb\xb4\x5b\xa7\xbd\xd8\xa2\x08\x18\x71\x64\x13\xa1\x49\x85\xa4\xd2\x64\x0d\xbf\xfb\x62\x48\x4a\x96\x2d\x3b\x69\xba\xdd\xbd\x68\x2a\x73\x7e\x38\xf3\xcd\x0f\x67\x96\xcb\xa3\xc3\xee\xa9\x2e\x1e\x8c\x98\xcd\x1d\xbc\x3a\xfe\xcf\x7f\x5f\x16\x06\x2d\x2a\x07\x6f\x59\x86\xd7\x5a\xdf\xc0\x44\x65\x29\x9c\x48\x09\x9e\xc9\x02\xd1\xcd\x1d\xf2\xb4\x7b\x39\x17\x16\xac\x2e\x4d\x86\x90\x69\x8e\x20\x2c\x48\x91\xa1\xb2\xc8\xa1\x54\x1c\x0d\xb8\x39\xc2\x49\xc1\xb2\x39\xc2\xab\xf4\xb8\xa2\x42\xae\x4b\xc5\xbb\x42\x79\xfa\xbb\xc9\xe9\xf9\xc5\xf4\x1c\x72\x21\x11\xe2\x99\xd1\xda\x01\x17\x06\x33\xa7\xcd\x03\xe8\x1c\x5c\xe3\x32\x67\x10\xd3\xee\xe1\xd1\x6a\xd5\xed\x2e\x97\xc0\x31\x17\x0a\x21\xe1\x82\x49\xcc\xdc\x91\xbd\x95\x47\x65\xc1\x99\xc3\x04\x56\x2b\xe2\xe8\x15\x37\x33\x18\x8d\xa1\x97\x4e\x33\x5d\x60\xfa\x91\x65\x37\x6c\x86\x15\xf5\xba\x14\x92\xac\x1d\x8d\xa1\x60\x36\x63\xb2\x66\x7c\x13\x29\x91\xd1\x60\x86\xe2\x2e\x70\xd6\xdf\xb5\x78\x64\x5a\x94\x8e\x39\xa1\x95\x57\x67\x84\x72\x0d\xb9\x24\xad\xa8\xb5\x69\x5a\x21\x71\xce\x99\x9d\x96\x79\x2e\xee\xd7\xfa\x92\x0f\xaa\xf2\xe0\x25\xf4\xfe\x44\xa3\x89\xf1\x18\x56\xab\xe5\x12\x44\x1e\x44\xfd\x8f\x40\x1c\x43\xa2\x84\x4c\xc2\x11\x2a\x5e\x8b\x1a\x74\x24\x99\xa8\x64\x97\x2c\x51\xc7\x90\x5c\x29\xcd\x71\x53\xb8\x9b\x97\x2a\x83\xfe\x86\xe7\xab\x15\x1c\x36\x31\x5b\xad\x06\x60\x6f\xe5\x94\xdd\x61\x3f\x73\xf7\x90\x69\xe5\xf0\xde\xa5\xa7\xe1\xff\x41\x25\xee\x48\x72\xe3\x6e\xaf\x26\xbd\x60\x8b\x68\x08\x4a\x4b\x5f\x42\xb9\xda\x82\x21\xa0\x31\xf4\x4f\x9b\x01\x2c\xbb\x9d\x2b\x5b\x60\x46\xae\x1c\xd8\x5b\x39\x33\xac\x98\xa7\x9f\x7d\xa0\xa7\x05\x66\xcb\x6e\xa7\x73\xa1\x39\x8e\x1a\x54\xfa\x5d\xd1\x3a\x97\xec\x5a\xe2\x08\xfc\xb5\xeb\x0c\x48\xfd\xf1\x90\x18\x4e\xb5\x2c\x17\xca\xb6\x59\x22\xc1\x33\x4d\xce\x9a\x17\xbc\x15\x28\x79\x7d\x43\xe7\xf2\xa1\xc0\x11\xe4\x74\x98\x7a\x25\x93\xb3\x94\xce\x08\x0e\xeb\xa2\xaf\x5e\x4d\xbc\xac\x7d\x57\x25\xe6\x25\x98\x72\x95\x80\xff\x4b\x7f\x56\xdd\x0e\x45\x75\x0d\x64\xb7\xd3\x11\x7c\x08\xfa\x86\x90\xd9\xc8\xc0\x86\xba\xf7\xf1\xec\xff\x3e\x12\xfd\x01\x09\xe5\xf0\x42\xdf\x80\xb7\xdc\xa0\x2b\x8d\x82\x3a\x97\x08\xfb\x83\x2f\x4c\x0a\xee\xa5\xce\x29\x04\x4b\xb2\x7f\x04\xc9\xe4\x2c\xf1\x81\x19\x41\xbe\x70\xa9\x27\xe5\xfd\x64\x21\xac\x15\x6a\x06\xcd\xa8\xa6\x93\x33\xc8\xb5\x81\x58\x8d\x03\x32\x95\xfe\xf9\x38\xfa\xe0\x90\x69\x5f\x98\x2c\x11\xc6\x20\x78\xf0\x2c\x66\x1f\xd9\x57\xd8\x5d\x3e\x15\x06\xb9\xc8\x98\x43\xfb\x1a\x24\xaa\x7e\x61\x07\xf0\x3f\x38\xf6\x9e\x04\xd5\x1f\x2b\x0e\x18\x03\x25\x71\xdf\xa2\xf4\xbd\x04\x0e\xed\xad\x4c\xa7\xf1\xd7\x20\x38\x4f\x26\x0a\x5f\xd3\x4c\xcd\x90\x2e\x0d\xd1\x2c\xec\x57\xf1\xad\x16\x1d\xf8\x28\x04\x0f\x62\x0c\x02\x7f\x2f\x0f\xbd\xa5\x82\xd8\xe7\x84\x0d\x81\xa9\x42\xa5\x0d\xf4\x95\x76\xd0\xcb\xd3\xc9\x82\x7c\xb9\x96\x38\xa0\x5f\x21\x7f\xcf\x30\x67\xa5\x74\x51\x86\x3c\xbf\x23\x50\x1e\x0b\x6a\xde\x0a\xe9\x6b\xa8\xa2\x59\xc1\x10\x2c\x49\xa7\xbe\xc2\x59\x51\xa0\xe2\xfd\x6d\xca\x70\x7f\x36\xb7\xf3\x39\xdf\x97\xcd\x9d\x8e\x8f\xe2\x28\xda\x1d\xcf\x1e\xcb\xf1\xbc\x95\xe1\x9d\xce\xca\x63\xdc\x09\x20\x44\xe4\x98\xe2\xf5\xbd\x17\xe5\x02\x8d\xc8\xa2\xf0\x1d\x1a\x87\xfc\x52\xbf\x61\x56\x64\x15\x74\x4f\x62\x77\xc2\x39\xf2\x60\xc0\xd4\x99\x32\x73\xde\xe9\x16\x80\x9b\x08\x9e\x70\xbe\x07\xc1\x13\xce\x1f\x45\xf0\x39\x10\xee\xc4\xf0\xd9\x20\x56\x28\x36\x60\xac\x2a\x6a\xd7\x2f\xea\x23\x79\xfa\xa1\x20\x7c\x98\x6c\x64\xe0\xee\xa4\xdb\xc4\xec\x54\x22\x33\xc8\xfb\x83\x9d\x79\xe7\xa9\x7b\x70\xf3\xb4\x5f\x95\x7b\x7f\x27\xcf\x9a\x88\x6c\x7f\xc7\xfa\xc6\x50\xdf\xe7\x7c\x86\xb1\xac\xf7\xc0\x83\x75\x4d\x46\x60\x7c\x5a\x05\x6c\x48\xdf\x77\xe1\xe6\x80\xf7\x8e\xee\xe8\x41\x42\x0a\x13\x52\xbf\xaa\x42\x05\x0e\x17\x85\xa4\xbe\xb5\x31\xcd\x70\xcc\xd1\xf3\xa6\x3b\xc3\x18\x80\xf5\xe6\xed\xc6\xbc\x41\x1a\x02\x69\x1a\xc4\x46\x1c\x13\xc0\x77\x26\x4c\x3f\x2b\x71\x5b\x56\xd6\xf8\x63\x8e\x3b\x1b\xf0\x27\x5c\xe8\xbb\x50\x45\xb8\x95\x11\x93\x33\x4b\x85\x44\x6d\xd9\x8b\x87\xce\x7c\x70\x00\x2f\x9e\x0b\xd8\xa3\x88\x25\xf4\x78\xd8\x04\x9c\x29\x11\x92\x3f\xd0\xe8\xa4\x7e\xb9\x42\x8c\x7f\x1c\xcc\x2d\x34\x7f\x12\xce\x1a\xcf\x5a\xd3\x63\x08\xfe\x38\x74\x4f\x26\xcf\x93\x50\xfc\x8a\xb4\xda\xd1\x00\x6b\xc2\x46\x4a\x6d\x97\xd0\xd1\x21\x2d\x0f\xfa\x3b\x04\xef\xd5\xcc\xcf\xf7\x3b\xc6\x37\xb8\x7e\x00\x5a\x3c\xbc\x87\x56\x68\x65\xe9\xd1\x2c\x2d\x6d\x11\xd1\x7a\x9b\xfa\x99\x7f\x8d\x46\xcf\x2d\x0a\xe9\xf1\x5d\x30\x97\xcd\x2f\x77\x7a\x19\x86\x8f\x23\xb2\xf9\xe8\x30\x09\xbe\x35\x8a\x9b\x54\xf8\xfa\x0e\xba\xd6\x40\xdc\xd7\xa0\x05\x9e\xde\x5a\x74\x5f\xbf\xd8\x98\xc9\x1a\x73\xef\x18\x0e\x36\x86\xdd\x4c\xab\x5c\xcc\x42\xbf\x6a\x4c\xd6\x69\x38\x5f\x4f\x48\x27\xd6\x8a\x99\x82\x31\xac\x75\xa5\xcc\x9f\xf9\x97\xc2\xd6\x8c\xd3\x8c\xc5\xa3\x4d\x66\x5b\x9f\x3f\x61\xac\xc8\xfd\xa8\x3d\xde\x8e\x0c\xe5\x16\xcd\xf5\xc3\x96\xad\xdc\xd0\xd7\x10\xbc\x01\x83\xd7\x5e\xfc\xc5\x18\x94\x90\x94\xb2\xfe\xb2\x30\xd0\xaf\xdb\x65\x30\x6a\xb8\xff\x26\xfb\xd3\x57\x35\x6a\xee\xaa\x7a\xf9\xd1\x98\xb4\x7f\xd8\xd8\x05\xdc\x5b\xda\x3b\xfd\xc0\xda\x78\xeb\x83\x35\x07\x1b\xe4\x65\xeb\x29\x79\xc7\xae\x51\xfa\xe9\x2f\xf8\x25\x72\xc8\xd0\x98\xea\x2e\x61\xa7\xbf\xbf\xf3\x0f\x8d\x61\x42\x39\xaf\xa4\x8f\xa6\x7d\x0f\x09\xc5\xe6\xbb\x6b\xe6\xf6\xd4\x55\xb7\x49\xab\x50\x53\x42\x76\xfd\xca\x58\x6d\x67\x7b\x56\xdf\xba\xaa\xab\x40\x57\xef\x57\x58\x69\xa9\x6c\xe1\x25\xd1\x88\x6b\x73\x99\x22\x5a\xf5\x04\x7f\x42\x39\x5a\xc7\x28\xf4\xab\x4f\x28\xfd\x23\x1c\x5f\xd2\x09\x8d\x60\x36\xae\x54\x98\x4e\x6c\x3c\x88\xe4\x3d\xfb\x56\x60\xf6\xc4\xad\x97\xb9\xb9\x7f\x51\x76\x62\xfa\xfe\xd5\xfb\xb8\xa5\xb6\x35\x7c\xfc\xad\x21\xbe\xde\x1f\xbf\x7e\xb3\xce\x08\x35\x6b\x87\x30\x88\x85\x4b\x1a\xa2\xb0\xde\x78\xc9\x88\x37\x82\x8b\xca\x23\xfa\xae\x9d\x31\x33\x74\xa3\x2d\xb0\xc2\xe9\x32\xec\x85\x84\xdc\x33\x76\x43\x0c\xf3\xcc\x8f\x6d\x88\x91\xb9\x0d\x63\x54\xf1\xd4\xb6\xf8\x44\x1b\xae\x02\xff\x8f\x35\xe1\x98\x94\xff\x4a\x17\x0e\x56\xc5\x74\xf7\x6d\x25\xc8\xd0\x9a\x77\x35\x84\x9b\xf5\xa6\x17\x9e\xe7\x50\x9d\x7c\x46\x49\x49\xe1\x8c\x32\xf5\x73\xd7\x22\x0d\xe1\xa6\xfd\xda\x35\x3e\xff\x0a\x00\x00\xff\xff\xd0\x8a\x25\xfa\x58\x13\x00\x00") +var _templateDialectSqlUpdateTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x58\x5b\x6f\xdb\xb8\x12\x7e\xb6\x7f\xc5\x54\xf0\x09\xec\xc0\x55\x72\xfa\x76\x5c\xf8\x00\x69\x2e\x07\xc6\x69\xd3\x6e\x9d\xf6\x61\x8b\x22\x50\xc4\x91\x4d\x58\x26\x15\x92\x4a\x93\x35\xf4\xdf\x17\xc3\x8b\x2c\x5b\x76\x2e\xdd\xee\x3e\x34\x95\x39\x17\x0e\xbf\xb9\x71\xb8\x5a\x1d\x1d\x76\x4f\x65\xf1\xa0\xf8\x6c\x6e\xe0\xcd\xf1\xbf\xff\xf3\xba\x50\xa8\x51\x18\xb8\x48\x52\xbc\x91\x72\x01\x13\x91\xc6\x70\x92\xe7\x60\x99\x34\x10\x5d\xdd\x21\x8b\xbb\x57\x73\xae\x41\xcb\x52\xa5\x08\xa9\x64\x08\x5c\x43\xce\x53\x14\x1a\x19\x94\x82\xa1\x02\x33\x47\x38\x29\x92\x74\x8e\xf0\x26\x3e\x0e\x54\xc8\x64\x29\x58\x97\x0b\x4b\x7f\x3f\x39\x3d\xbf\x9c\x9e\x43\xc6\x73\x04\xbf\xa6\xa4\x34\xc0\xb8\xc2\xd4\x48\xf5\x00\x32\x03\xd3\xd8\xcc\x28\xc4\xb8\x7b\x78\x54\x55\xdd\xee\x6a\x05\x0c\x33\x2e\x10\x22\xc6\x93\x1c\x53\x73\xa4\x6f\xf3\xa3\xb2\x60\x89\xc1\x08\xaa\x8a\x38\x7a\xc5\x62\x06\xa3\x31\xf4\xe2\x69\x2a\x0b\x8c\x3f\x25\xe9\x22\x99\x61\xa0\xde\x94\x3c\x27\x6b\x47\x63\x28\x12\x9d\x26\x79\xcd\xf8\xce\x53\x3c\xa3\xc2\x14\xf9\x9d\xe3\xac\xbf\x6b\x71\xcf\xb4\x2c\x4d\x62\xb8\x14\x56\x9d\xe2\xc2\x34\xe4\xa2\x38\x50\x6b\xd3\xa4\x40\xe2\x9c\x27\x7a\x5a\x66\x19\xbf\x5f\xeb\x8b\x3e\x8a\x70\x82\xd7\xd0\xfb\x03\x95\x24\xc6\x63\xa8\xaa\xd5\x0a\x78\xe6\x44\xed\x0f\x47\x1c\x43\x24\x78\x1e\xb9\x25\x14\xac\x16\x55\x68\x48\x32\x12\xd1\x2e\x59\xa2\x8e\x21\xba\x16\x92\xe1\xa6\x70\x37\x2b\x45\x0a\xfd\x8d\x93\x57\x15\x1c\x36\x31\xab\xaa\x01\xe8\xdb\x7c\x9a\xdc\x61\x3f\x35\xf7\x90\x4a\x61\xf0\xde\xc4\xa7\xee\xff\x41\x10\x37\x24\xb9\xb1\xb7\x55\x13\x5f\x26\x4b\x6f\x08\xe6\x9a\xbe\xb8\x30\xb5\x05\x43\x40\xa5\xe8\x9f\x54\x03\x58\x75\x3b\xd7\xba\xc0\x94\x8e\x72\xa0\x6f\xf3\x99\x4a\x8a\x79\xfc\xc5\x3a\x7a\x5a\x60\xba\xea\x76\x3a\x97\x92\xe1\xa8\x41\xa5\xdf\x81\xd6\xb9\x4a\x6e\x72\x1c\x81\xdd\x76\x1d\x01\xb1\x5d\x1e\x12\xc3\xa9\xcc\xcb\xa5\xd0\x6d\x16\x4f\xb0\x4c\x93\xb3\xe6\x06\x17\x1c\x73\x56\xef\xd0\xb9\x7a\x28\x70\x04\x19\x2d\xc6\x56\xc9\xe4\x2c\xa6\x35\x82\x43\x1b\x7f\x56\xab\xc6\x6f\xd6\xde\x2b\x88\x59\x89\x44\x98\x20\x60\xff\xd2\x9f\xaa\xdb\x21\xaf\xae\x81\xec\x76\x3a\x9c\x0d\x41\x2e\x08\x99\x8d\x08\x6c\xa8\xfb\xe0\xd7\xfe\x67\x3d\xd1\x1f\x90\x50\x06\xaf\xe4\x02\xac\xe5\x0a\x4d\xa9\x04\xd4\xb1\x44\xd8\x1f\x7c\x4d\x72\xce\xac\xd4\x39\xb9\x60\x45\xf6\x8f\x20\x9a\x9c\x45\xd6\x31\x23\xc8\x96\x26\xb6\xa4\xac\x1f\x2d\xb9\xd6\x5c\xcc\xa0\xe9\xd5\x78\x72\x06\x99\x54\xe0\xb3\x71\x40\xa6\xd2\x3f\xeb\x47\xeb\x1c\x32\xed\x6b\x92\x97\x08\x63\xe0\xcc\x19\x65\xe1\xd3\xe1\x30\x8d\xc8\x8b\x1d\xe5\x2d\xe4\x28\xfa\xee\x7b\x00\xff\x85\x63\x77\x84\x86\x52\xef\x2f\x18\xc3\x32\x59\x60\xff\xdb\x77\x6d\x14\x17\xb3\x21\x1c\x0f\x9b\xb2\x83\xbd\x62\x49\x51\xa0\x60\xfd\x36\x6d\xf8\x1c\x7f\x59\xbd\x74\xee\xeb\x21\x64\xb6\x56\x24\x62\x86\xe1\x5c\x2e\x52\x08\xfc\x6d\x55\x16\x6f\xb7\x51\x3f\x1b\x78\xc6\xe0\x1a\xc1\xf3\xbd\x2e\xc9\x76\xf8\x23\x94\xbd\xaa\x1a\x01\x17\x77\x24\xe7\x2c\x80\x7f\xdd\x5a\xa7\xdc\x96\xa8\x1e\xa2\x21\x64\xd6\x2d\xce\x31\x0e\x7f\x78\x35\x7e\xce\x31\x83\x81\x2f\x45\x30\x1b\xac\xf7\xf3\x11\x41\x01\xed\x8b\x0e\x59\x50\xe8\x5d\xa1\x5c\x28\x64\x3c\x4d\x0c\xfa\x08\x28\x1a\xde\x77\xfb\x7c\x0a\x1c\x30\x06\xaa\x5d\x7d\x8d\xb9\x6d\x21\x70\xa8\x6f\xf3\x78\xea\x7f\x79\x68\x09\x04\xbe\x76\x4f\x11\x5c\x53\xe8\x6f\xfc\x7b\x2d\x3a\x68\x98\xe9\x2d\x75\xfc\xbd\xcc\xb5\x94\x90\x59\x17\xce\xbd\x36\x1f\x43\x86\x4a\x05\x7d\x21\x0d\xf4\xb2\x78\xb2\xa4\xb3\xdc\xe4\x38\xa0\x5f\xae\x6c\x9d\x61\x96\x94\xb9\xf1\x32\x74\xf2\x3b\xca\x85\xc7\x72\x39\x6b\x65\xf2\x5b\x08\x49\x1c\x60\x70\x96\xc4\x53\x5b\xd8\x37\x1c\xb1\xa6\x0c\xf7\x17\xb1\x76\x19\xcb\xf6\x15\xb1\x4e\xc7\x26\xef\xc8\xdb\xed\xd7\x1e\x2b\x6d\x59\xab\xb0\x75\x3a\x55\x23\x20\x02\x72\x89\x60\xf5\xbe\x97\xe5\x12\x15\x4f\xbd\xf0\x1d\x2a\x83\xec\x4a\xbe\x4b\x34\x4f\x03\x74\x4f\x62\x77\xc2\x18\x32\x67\xc0\xd4\xa8\x32\x35\xf6\xd0\x2d\x00\x37\x11\x3c\x61\x6c\x0f\x82\x27\x8c\x3d\x8a\xe0\x4b\x20\xdc\x89\xe1\x8b\x41\x0c\x28\x36\x60\x0c\x19\xb5\xeb\x17\xb5\x8f\x2c\xfe\x58\x10\x3e\x49\xde\x88\xc0\xdd\x41\xb7\x89\xd9\x69\x8e\x89\x42\xd6\x1f\xec\x8c\x3b\x4b\xdd\x83\x9b\xa5\xfd\xaa\xd8\xfb\x2b\x71\xd6\x44\x64\xfb\xdb\xe7\x37\xba\xfc\x3e\x67\x33\xf4\x69\xbd\x07\x1e\xac\x73\xd2\x03\x63\xc3\xca\x61\x43\xfa\x7e\x70\x33\x07\xbc\x37\xb4\x47\x0f\x22\x52\x18\x91\xfa\x2a\xb8\x0a\x0c\x2e\x8b\x9c\xea\xd6\xc6\x25\x96\x61\x86\x96\x37\xde\xe9\x46\x07\xac\x35\x6f\x37\xe6\x0d\xd2\x10\x48\xd3\xc0\xf7\x5f\x1f\x00\xb6\x32\x61\xfc\x45\xf0\xdb\x32\x58\x63\x97\x19\xee\x2c\xc0\x9f\x71\x29\xef\x5c\x16\xe1\x56\x44\x4c\xce\x34\x25\x12\x95\x65\x2b\xee\x2a\xf3\xc1\x81\x6b\x72\x2f\x01\xec\x51\xc4\x22\xea\x24\x3a\x02\xa3\x4a\x84\xe8\x77\x54\x32\xaa\x2f\x2c\xce\xc7\xcf\x07\x73\x0b\xcd\x9f\x84\xb3\xc6\xb3\xd6\xf4\x18\x82\xcf\x87\xee\xc9\xe0\x79\x12\x8a\x5f\x11\x56\x3b\x0a\x60\x4d\xd8\x08\xa9\xed\x14\x3a\x3a\xa4\x99\x51\xfe\x00\x77\x7a\x31\xb3\x63\xdd\x8e\x5b\x3b\xdc\x3c\x00\xcd\x9b\xf6\x84\x9a\x4b\xa1\xa9\x69\x96\x9a\x86\x47\x6f\xbd\x8e\xed\xa8\xb7\x46\xa3\x67\x96\x45\x6e\xf1\x5d\x26\x26\x9d\x5f\xed\x3c\xa5\xbb\x73\x1e\x91\xcd\x47\x87\x91\x3b\x5b\x23\xb9\x49\x85\xcd\x6f\xa7\x6b\x0d\xc4\x7d\x0d\x9a\xe3\xe9\xad\x45\xf7\xd5\x8b\x8d\xab\x78\x63\xdc\x19\xc3\xc1\xc6\x8c\x93\x4a\x91\xf1\xd9\xa8\x75\xad\x75\xeb\xeb\x8b\xf1\x89\xd6\x7c\x26\x20\xdc\x7f\x49\x57\x9c\xd8\x35\xdb\x29\x74\xcd\x38\x4d\x13\xbf\xb4\xc9\xac\xeb\xf5\x27\x8c\xe5\x99\x9d\xb0\xc6\xdb\x9e\xa1\xd8\xa2\x71\x6e\xd8\xb2\x95\x29\xfa\x1a\x82\x35\x60\xf0\xd6\x8a\xbf\x1a\xd3\xed\x94\x42\xd6\x6e\xe6\xe6\xb8\x75\xb9\x74\x46\x0d\xf7\xef\xa4\x7f\x7a\xab\x46\xce\x5d\x87\xce\x8f\x4a\xc5\xfd\xc3\xc6\x08\x68\x2e\x64\x29\x98\xbd\x17\x37\x7a\xbd\xb3\xe6\x60\x83\xbc\x6a\xb5\x92\xf7\xc9\x0d\xe6\xf6\xf6\xe7\xce\xc5\x33\x48\x51\xa9\xb0\x17\xd7\xd3\xdf\xde\xdb\x46\xa3\x12\x2e\x8c\x55\xd2\x47\xd5\xde\x87\x84\x7c\xf1\xdd\x35\x6a\x59\x6a\xd5\x6d\xd2\x02\x6a\x82\xe7\x5d\xfb\x52\x10\x86\xf2\x3d\x2f\x1e\x75\x56\x07\x47\x87\xfe\xe5\x5e\x32\x28\x6d\xe1\x35\xd1\x88\x6b\x73\x86\x26\x5a\x68\xc1\x9f\x31\x1f\xad\x7d\xe4\xea\xd5\x67\xcc\x6d\x13\xf6\x9d\x74\x42\x57\x30\xed\x27\x69\x8c\x27\xda\x2f\x78\xf2\x9e\x31\xdb\x31\x5b\xe2\x56\x67\x6e\x8e\xdd\x14\x9d\x18\x7f\x78\xf3\xc1\x3f\x4e\xb4\x35\x7c\xfa\x7f\x43\x7c\xfd\x6c\x10\x66\xbc\xb6\x0b\x9d\x98\xdb\xa4\x39\xbd\xac\x1f\x3a\xc8\x88\x77\x9c\xf1\x70\x22\xfa\xae\x0f\xa3\x66\x68\x46\x5b\x60\xb9\xd5\x95\x7b\x0e\x20\xe4\x5e\xf0\x24\x80\xee\x3e\xf3\xbc\x87\x01\xcf\xdc\x86\xd1\xab\x78\xea\x91\xe0\x89\x32\x1c\x1c\xff\xb7\x15\x61\x1f\x94\xff\x48\x15\x76\x56\xf9\x70\xb7\x65\xc5\xc9\xf8\x41\x7c\xb1\x9e\xf4\x5c\x7b\x76\xd9\xc9\x66\x14\x94\xe4\x4e\x2f\x53\xb7\xbb\x16\x69\x08\x8b\x76\xb7\x6b\x7c\xfe\x19\x00\x00\xff\xff\x74\x6d\x9c\xa5\x4f\x15\x00\x00") func templateDialectSqlUpdateTmplBytes() ([]byte, error) { return bindataRead( @@ -947,7 +947,7 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 4952, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/update.tmpl", size: 5455, 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/update.tmpl b/entc/gen/template/builder/update.tmpl index 0b78c1b5e..92305b122 100644 --- a/entc/gen/template/builder/update.tmpl +++ b/entc/gen/template/builder/update.tmpl @@ -121,6 +121,7 @@ func ({{ $receiver }} *{{ $builder }}) ExecX(ctx context.Context) { // {{ $onebuilder }} is the builder for updating a single {{ $.Name }} entity. type {{ $onebuilder }} struct { config + fields []string {{- template "update/fields" $ }} } @@ -133,6 +134,13 @@ type {{ $onebuilder }} struct { {{ template "update/edges" . }} {{ end }} +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func ({{ $receiver }} *{{ $onebuilder }}) Select(field string, fields ...string) *{{ $onebuilder }} { + {{ $receiver }}.fields = append([]string{field}, fields...) + return {{ $receiver }} +} + // Save executes the query and returns the updated {{ $.Name }} entity. func ({{ $receiver }} *{{ $onebuilder }} ) Save(ctx context.Context) (*{{ $.Name }}, error) { var ( diff --git a/entc/gen/template/dialect/gremlin/update.tmpl b/entc/gen/template/dialect/gremlin/update.tmpl index 8c59133f7..bce99e319 100644 --- a/entc/gen/template/dialect/gremlin/update.tmpl +++ b/entc/gen/template/dialect/gremlin/update.tmpl @@ -152,7 +152,20 @@ func ({{ $receiver }} *{{ $builder }}) gremlin({{ if $one }}id {{ $.ID.Type }}{{ {{- end }} } {{- end }} - {{ if $one }}v.ValueMap(true){{ else }}v.Count(){{ end }} + {{- if $one }} + if len({{ $receiver }}.fields) > 0 { + fields := make([]interface{}, 0, len({{ $receiver }}.fields)+1) + fields = append(fields, true) + for _, f := range {{ $receiver }}.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } + {{- else }} + v.Count() + {{- end }} {{- with .NumConstraint }} if len(constraints) > 0 { {{- /* make sure the traversal does not contain more than one vertex if we have constraint */}} diff --git a/entc/gen/template/dialect/sql/update.tmpl b/entc/gen/template/dialect/sql/update.tmpl index 892d5fcac..78fdb8060 100644 --- a/entc/gen/template/dialect/sql/update.tmpl +++ b/entc/gen/template/dialect/sql/update.tmpl @@ -30,6 +30,18 @@ func ({{ $receiver }} *{{ $builder }}) sqlSave(ctx context.Context) ({{ $ret }} return {{ $zero }}, &ValidationError{Name: "ID", err: fmt.Errorf("missing {{ $.Name }}.ID for update")} } _spec.Node.ID.Value = id + if fields := {{ $receiver }}.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, {{ $.Package }}.{{ $.ID.Constant }}) + for _, f := range fields { + if !{{ $.Package }}.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("{{ $pkg }}: invalid field %q for query", f)} + } + if f != {{ $.Package }}.{{ $.ID.Constant }} { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } {{- end }} if ps := {{ $mutation }}.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { diff --git a/entc/integration/README.md b/entc/integration/README.md index 81906dea7..474aedc2d 100644 --- a/entc/integration/README.md +++ b/entc/integration/README.md @@ -12,7 +12,7 @@ go generate ./... #### Running the integration tests ``` -docker-compose -f compose/docker-compose.yaml up -d --scale test=0 +docker-compose -f compose/docker-compose.yaml up -d --scale gremlin=0 go test ``` diff --git a/entc/integration/config/ent/user_update.go b/entc/integration/config/ent/user_update.go index 848632800..fb9d96463 100644 --- a/entc/integration/config/ent/user_update.go +++ b/entc/integration/config/ent/user_update.go @@ -184,6 +184,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -233,6 +234,13 @@ func (uuo *UserUpdateOne) Mutation() *UserMutation { return uuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -300,6 +308,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/blob_update.go b/entc/integration/customid/ent/blob_update.go index afeb1b4bf..664f51a1e 100644 --- a/entc/integration/customid/ent/blob_update.go +++ b/entc/integration/customid/ent/blob_update.go @@ -282,6 +282,7 @@ func (bu *BlobUpdate) sqlSave(ctx context.Context) (n int, err error) { // BlobUpdateOne is the builder for updating a single Blob entity. type BlobUpdateOne struct { config + fields []string hooks []Hook mutation *BlobMutation } @@ -358,6 +359,13 @@ func (buo *BlobUpdateOne) RemoveLinks(b ...*Blob) *BlobUpdateOne { return buo.RemoveLinkIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (buo *BlobUpdateOne) Select(field string, fields ...string) *BlobUpdateOne { + buo.fields = append([]string{field}, fields...) + return buo +} + // Save executes the query and returns the updated Blob entity. func (buo *BlobUpdateOne) Save(ctx context.Context) (*Blob, error) { var ( @@ -425,6 +433,18 @@ func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (_node *Blob, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Blob.ID for update")} } _spec.Node.ID.Value = id + if fields := buo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, blob.FieldID) + for _, f := range fields { + if !blob.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != blob.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := buo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/car_update.go b/entc/integration/customid/ent/car_update.go index fd53d81c2..6b6b3fd13 100644 --- a/entc/integration/customid/ent/car_update.go +++ b/entc/integration/customid/ent/car_update.go @@ -307,6 +307,7 @@ func (cu *CarUpdate) sqlSave(ctx context.Context) (n int, err error) { // CarUpdateOne is the builder for updating a single Car entity. type CarUpdateOne struct { config + fields []string hooks []Hook mutation *CarMutation } @@ -401,6 +402,13 @@ func (cuo *CarUpdateOne) ClearOwner() *CarUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CarUpdateOne) Select(field string, fields ...string) *CarUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Car entity. func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { var ( @@ -489,6 +497,18 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Car.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, car.FieldID) + for _, f := range fields { + if !car.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != car.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/group_update.go b/entc/integration/customid/ent/group_update.go index 5a4453494..d2c6d4f5f 100644 --- a/entc/integration/customid/ent/group_update.go +++ b/entc/integration/customid/ent/group_update.go @@ -209,6 +209,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -254,6 +255,13 @@ func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne { return guo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -321,6 +329,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/mixinid_update.go b/entc/integration/customid/ent/mixinid_update.go index fb63194d0..e88cf1e51 100644 --- a/entc/integration/customid/ent/mixinid_update.go +++ b/entc/integration/customid/ent/mixinid_update.go @@ -144,6 +144,7 @@ func (miu *MixinIDUpdate) sqlSave(ctx context.Context) (n int, err error) { // MixinIDUpdateOne is the builder for updating a single MixinID entity. type MixinIDUpdateOne struct { config + fields []string hooks []Hook mutation *MixinIDMutation } @@ -165,6 +166,13 @@ func (miuo *MixinIDUpdateOne) Mutation() *MixinIDMutation { return miuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (miuo *MixinIDUpdateOne) Select(field string, fields ...string) *MixinIDUpdateOne { + miuo.fields = append([]string{field}, fields...) + return miuo +} + // Save executes the query and returns the updated MixinID entity. func (miuo *MixinIDUpdateOne) Save(ctx context.Context) (*MixinID, error) { var ( @@ -232,6 +240,18 @@ func (miuo *MixinIDUpdateOne) sqlSave(ctx context.Context) (_node *MixinID, err return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing MixinID.ID for update")} } _spec.Node.ID.Value = id + if fields := miuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, mixinid.FieldID) + for _, f := range fields { + if !mixinid.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != mixinid.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := miuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/pet_update.go b/entc/integration/customid/ent/pet_update.go index ee451a6a7..af27eb7a4 100644 --- a/entc/integration/customid/ent/pet_update.go +++ b/entc/integration/customid/ent/pet_update.go @@ -420,6 +420,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -551,6 +552,13 @@ func (puo *PetUpdateOne) ClearBestFriend() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -618,6 +626,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/customid/ent/user_update.go b/entc/integration/customid/ent/user_update.go index b90ec7a17..cd51927ca 100644 --- a/entc/integration/customid/ent/user_update.go +++ b/entc/integration/customid/ent/user_update.go @@ -450,6 +450,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -592,6 +593,13 @@ func (uuo *UserUpdateOne) RemovePets(p ...*Pet) *UserUpdateOne { return uuo.RemovePetIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -659,6 +667,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/card_update.go b/entc/integration/edgefield/ent/card_update.go index 0ba35fa1d..1bbde79ce 100644 --- a/entc/integration/edgefield/ent/card_update.go +++ b/entc/integration/edgefield/ent/card_update.go @@ -186,6 +186,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) { // CardUpdateOne is the builder for updating a single Card entity. type CardUpdateOne struct { config + fields []string hooks []Hook mutation *CardMutation } @@ -227,6 +228,13 @@ func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Card entity. func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { var ( @@ -294,6 +302,18 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Card.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, card.FieldID) + for _, f := range fields { + if !card.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != card.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/info_update.go b/entc/integration/edgefield/ent/info_update.go index b7146ac5a..5f06346bf 100644 --- a/entc/integration/edgefield/ent/info_update.go +++ b/entc/integration/edgefield/ent/info_update.go @@ -193,6 +193,7 @@ func (iu *InfoUpdate) sqlSave(ctx context.Context) (n int, err error) { // InfoUpdateOne is the builder for updating a single Info entity. type InfoUpdateOne struct { config + fields []string hooks []Hook mutation *InfoMutation } @@ -233,6 +234,13 @@ func (iuo *InfoUpdateOne) ClearUser() *InfoUpdateOne { return iuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (iuo *InfoUpdateOne) Select(field string, fields ...string) *InfoUpdateOne { + iuo.fields = append([]string{field}, fields...) + return iuo +} + // Save executes the query and returns the updated Info entity. func (iuo *InfoUpdateOne) Save(ctx context.Context) (*Info, error) { var ( @@ -300,6 +308,18 @@ func (iuo *InfoUpdateOne) sqlSave(ctx context.Context) (_node *Info, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Info.ID for update")} } _spec.Node.ID.Value = id + if fields := iuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, info.FieldID) + for _, f := range fields { + if !info.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != info.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := iuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/metadata_update.go b/entc/integration/edgefield/ent/metadata_update.go index 7e20701b8..6cd71b1ca 100644 --- a/entc/integration/edgefield/ent/metadata_update.go +++ b/entc/integration/edgefield/ent/metadata_update.go @@ -214,6 +214,7 @@ func (mu *MetadataUpdate) sqlSave(ctx context.Context) (n int, err error) { // MetadataUpdateOne is the builder for updating a single Metadata entity. type MetadataUpdateOne struct { config + fields []string hooks []Hook mutation *MetadataMutation } @@ -269,6 +270,13 @@ func (muo *MetadataUpdateOne) ClearUser() *MetadataUpdateOne { return muo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (muo *MetadataUpdateOne) Select(field string, fields ...string) *MetadataUpdateOne { + muo.fields = append([]string{field}, fields...) + return muo +} + // Save executes the query and returns the updated Metadata entity. func (muo *MetadataUpdateOne) Save(ctx context.Context) (*Metadata, error) { var ( @@ -336,6 +344,18 @@ func (muo *MetadataUpdateOne) sqlSave(ctx context.Context) (_node *Metadata, err return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Metadata.ID for update")} } _spec.Node.ID.Value = id + if fields := muo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, metadata.FieldID) + for _, f := range fields { + if !metadata.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != metadata.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := muo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/pet_update.go b/entc/integration/edgefield/ent/pet_update.go index e46c7bd92..4e0d6d2ae 100644 --- a/entc/integration/edgefield/ent/pet_update.go +++ b/entc/integration/edgefield/ent/pet_update.go @@ -186,6 +186,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -227,6 +228,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -294,6 +302,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/post_update.go b/entc/integration/edgefield/ent/post_update.go index 75c6210f1..dc4567ae3 100644 --- a/entc/integration/edgefield/ent/post_update.go +++ b/entc/integration/edgefield/ent/post_update.go @@ -199,6 +199,7 @@ func (pu *PostUpdate) sqlSave(ctx context.Context) (n int, err error) { // PostUpdateOne is the builder for updating a single Post entity. type PostUpdateOne struct { config + fields []string hooks []Hook mutation *PostMutation } @@ -246,6 +247,13 @@ func (puo *PostUpdateOne) ClearAuthor() *PostUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PostUpdateOne) Select(field string, fields ...string) *PostUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Post entity. func (puo *PostUpdateOne) Save(ctx context.Context) (*Post, error) { var ( @@ -313,6 +321,18 @@ func (puo *PostUpdateOne) sqlSave(ctx context.Context) (_node *Post, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Post.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, post.FieldID) + for _, f := range fields { + if !post.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != post.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/edgefield/ent/user_update.go b/entc/integration/edgefield/ent/user_update.go index 2a298b10d..076bf2b33 100644 --- a/entc/integration/edgefield/ent/user_update.go +++ b/entc/integration/edgefield/ent/user_update.go @@ -646,6 +646,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -877,6 +878,13 @@ func (uuo *UserUpdateOne) RemoveInfo(i ...*Info) *UserUpdateOne { return uuo.RemoveInfoIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -944,6 +952,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/card_update.go b/entc/integration/ent/card_update.go index 6e52cde5c..057647019 100644 --- a/entc/integration/ent/card_update.go +++ b/entc/integration/ent/card_update.go @@ -370,6 +370,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) { // CardUpdateOne is the builder for updating a single Card entity. type CardUpdateOne struct { config + fields []string hooks []Hook mutation *CardMutation } @@ -481,6 +482,13 @@ func (cuo *CardUpdateOne) RemoveSpec(s ...*Spec) *CardUpdateOne { return cuo.RemoveSpecIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Card entity. func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { var ( @@ -573,6 +581,18 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Card.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, card.FieldID) + for _, f := range fields { + if !card.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != card.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/comment_update.go b/entc/integration/ent/comment_update.go index 548cc0857..4dc7e80be 100644 --- a/entc/integration/ent/comment_update.go +++ b/entc/integration/ent/comment_update.go @@ -219,6 +219,7 @@ func (cu *CommentUpdate) sqlSave(ctx context.Context) (n int, err error) { // CommentUpdateOne is the builder for updating a single Comment entity. type CommentUpdateOne struct { config + fields []string hooks []Hook mutation *CommentMutation } @@ -281,6 +282,13 @@ func (cuo *CommentUpdateOne) Mutation() *CommentMutation { return cuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Comment entity. func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) { var ( @@ -348,6 +356,18 @@ func (cuo *CommentUpdateOne) sqlSave(ctx context.Context) (_node *Comment, err e return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Comment.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, comment.FieldID) + for _, f := range fields { + if !comment.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != comment.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/fieldtype_update.go b/entc/integration/ent/fieldtype_update.go index 943204551..51a79ad55 100644 --- a/entc/integration/ent/fieldtype_update.go +++ b/entc/integration/ent/fieldtype_update.go @@ -1996,6 +1996,7 @@ func (ftu *FieldTypeUpdate) sqlSave(ctx context.Context) (n int, err error) { // FieldTypeUpdateOne is the builder for updating a single FieldType entity. type FieldTypeUpdateOne struct { config + fields []string hooks []Hook mutation *FieldTypeMutation } @@ -3025,6 +3026,13 @@ func (ftuo *FieldTypeUpdateOne) Mutation() *FieldTypeMutation { return ftuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ftuo *FieldTypeUpdateOne) Select(field string, fields ...string) *FieldTypeUpdateOne { + ftuo.fields = append([]string{field}, fields...) + return ftuo +} + // Save executes the query and returns the updated FieldType entity. func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error) { var ( @@ -3133,6 +3141,18 @@ func (ftuo *FieldTypeUpdateOne) sqlSave(ctx context.Context) (_node *FieldType, return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing FieldType.ID for update")} } _spec.Node.ID.Value = id + if fields := ftuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, fieldtype.FieldID) + for _, f := range fields { + if !fieldtype.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != fieldtype.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := ftuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/file_update.go b/entc/integration/ent/file_update.go index 14b7e8841..0432b66ca 100644 --- a/entc/integration/ent/file_update.go +++ b/entc/integration/ent/file_update.go @@ -494,6 +494,7 @@ func (fu *FileUpdate) sqlSave(ctx context.Context) (n int, err error) { // FileUpdateOne is the builder for updating a single File entity. type FileUpdateOne struct { config + fields []string hooks []Hook mutation *FileMutation } @@ -676,6 +677,13 @@ func (fuo *FileUpdateOne) RemoveField(f ...*FieldType) *FileUpdateOne { return fuo.RemoveFieldIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne { + fuo.fields = append([]string{field}, fields...) + return fuo +} + // Save executes the query and returns the updated File entity. func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { var ( @@ -759,6 +767,18 @@ func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (_node *File, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing File.ID for update")} } _spec.Node.ID.Value = id + if fields := fuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, file.FieldID) + for _, f := range fields { + if !file.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != file.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := fuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/filetype_update.go b/entc/integration/ent/filetype_update.go index d02646cbf..c7853b069 100644 --- a/entc/integration/ent/filetype_update.go +++ b/entc/integration/ent/filetype_update.go @@ -285,6 +285,7 @@ func (ftu *FileTypeUpdate) sqlSave(ctx context.Context) (n int, err error) { // FileTypeUpdateOne is the builder for updating a single FileType entity. type FileTypeUpdateOne struct { config + fields []string hooks []Hook mutation *FileTypeMutation } @@ -364,6 +365,13 @@ func (ftuo *FileTypeUpdateOne) RemoveFiles(f ...*File) *FileTypeUpdateOne { return ftuo.RemoveFileIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ftuo *FileTypeUpdateOne) Select(field string, fields ...string) *FileTypeUpdateOne { + ftuo.fields = append([]string{field}, fields...) + return ftuo +} + // Save executes the query and returns the updated FileType entity. func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error) { var ( @@ -452,6 +460,18 @@ func (ftuo *FileTypeUpdateOne) sqlSave(ctx context.Context) (_node *FileType, er return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing FileType.ID for update")} } _spec.Node.ID.Value = id + if fields := ftuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, filetype.FieldID) + for _, f := range fields { + if !filetype.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != filetype.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := ftuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/goods_update.go b/entc/integration/ent/goods_update.go index efa6cafa4..bd7edfe6c 100644 --- a/entc/integration/ent/goods_update.go +++ b/entc/integration/ent/goods_update.go @@ -118,6 +118,7 @@ func (gu *GoodsUpdate) sqlSave(ctx context.Context) (n int, err error) { // GoodsUpdateOne is the builder for updating a single Goods entity. type GoodsUpdateOne struct { config + fields []string hooks []Hook mutation *GoodsMutation } @@ -127,6 +128,13 @@ func (guo *GoodsUpdateOne) Mutation() *GoodsMutation { return guo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GoodsUpdateOne) Select(field string, fields ...string) *GoodsUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Goods entity. func (guo *GoodsUpdateOne) Save(ctx context.Context) (*Goods, error) { var ( @@ -194,6 +202,18 @@ func (guo *GoodsUpdateOne) sqlSave(ctx context.Context) (_node *Goods, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Goods.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, goods.FieldID) + for _, f := range fields { + if !goods.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != goods.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/group_update.go b/entc/integration/ent/group_update.go index b1622e61c..746f3d5a4 100644 --- a/entc/integration/ent/group_update.go +++ b/entc/integration/ent/group_update.go @@ -601,6 +601,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -808,6 +809,13 @@ func (guo *GroupUpdateOne) ClearInfo() *GroupUpdateOne { return guo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -904,6 +912,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/groupinfo_update.go b/entc/integration/ent/groupinfo_update.go index f9a0bacec..e6921b48d 100644 --- a/entc/integration/ent/groupinfo_update.go +++ b/entc/integration/ent/groupinfo_update.go @@ -257,6 +257,7 @@ func (giu *GroupInfoUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupInfoUpdateOne is the builder for updating a single GroupInfo entity. type GroupInfoUpdateOne struct { config + fields []string hooks []Hook mutation *GroupInfoMutation } @@ -329,6 +330,13 @@ func (giuo *GroupInfoUpdateOne) RemoveGroups(g ...*Group) *GroupInfoUpdateOne { return giuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (giuo *GroupInfoUpdateOne) Select(field string, fields ...string) *GroupInfoUpdateOne { + giuo.fields = append([]string{field}, fields...) + return giuo +} + // Save executes the query and returns the updated GroupInfo entity. func (giuo *GroupInfoUpdateOne) Save(ctx context.Context) (*GroupInfo, error) { var ( @@ -396,6 +404,18 @@ func (giuo *GroupInfoUpdateOne) sqlSave(ctx context.Context) (_node *GroupInfo, return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing GroupInfo.ID for update")} } _spec.Node.ID.Value = id + if fields := giuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, groupinfo.FieldID) + for _, f := range fields { + if !groupinfo.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != groupinfo.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := giuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/item_update.go b/entc/integration/ent/item_update.go index 90592a243..334862b09 100644 --- a/entc/integration/ent/item_update.go +++ b/entc/integration/ent/item_update.go @@ -118,6 +118,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { // ItemUpdateOne is the builder for updating a single Item entity. type ItemUpdateOne struct { config + fields []string hooks []Hook mutation *ItemMutation } @@ -127,6 +128,13 @@ func (iuo *ItemUpdateOne) Mutation() *ItemMutation { return iuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (iuo *ItemUpdateOne) Select(field string, fields ...string) *ItemUpdateOne { + iuo.fields = append([]string{field}, fields...) + return iuo +} + // Save executes the query and returns the updated Item entity. func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) { var ( @@ -194,6 +202,18 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Item.ID for update")} } _spec.Node.ID.Value = id + if fields := iuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, item.FieldID) + for _, f := range fields { + if !item.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != item.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := iuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/node_update.go b/entc/integration/ent/node_update.go index 5dc67b1f0..08abcc8ab 100644 --- a/entc/integration/ent/node_update.go +++ b/entc/integration/ent/node_update.go @@ -285,6 +285,7 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { // NodeUpdateOne is the builder for updating a single Node entity. type NodeUpdateOne struct { config + fields []string hooks []Hook mutation *NodeMutation } @@ -371,6 +372,13 @@ func (nuo *NodeUpdateOne) ClearNext() *NodeUpdateOne { return nuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne { + nuo.fields = append([]string{field}, fields...) + return nuo +} + // Save executes the query and returns the updated Node entity. func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { var ( @@ -438,6 +446,18 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Node.ID for update")} } _spec.Node.ID.Value = id + if fields := nuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, node.FieldID) + for _, f := range fields { + if !node.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != node.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := nuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/pet_update.go b/entc/integration/ent/pet_update.go index b97cdc94e..b8d3addea 100644 --- a/entc/integration/ent/pet_update.go +++ b/entc/integration/ent/pet_update.go @@ -278,6 +278,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -355,6 +356,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -422,6 +430,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/spec_update.go b/entc/integration/ent/spec_update.go index f90f19335..4d58f5365 100644 --- a/entc/integration/ent/spec_update.go +++ b/entc/integration/ent/spec_update.go @@ -209,6 +209,7 @@ func (su *SpecUpdate) sqlSave(ctx context.Context) (n int, err error) { // SpecUpdateOne is the builder for updating a single Spec entity. type SpecUpdateOne struct { config + fields []string hooks []Hook mutation *SpecMutation } @@ -254,6 +255,13 @@ func (suo *SpecUpdateOne) RemoveCard(c ...*Card) *SpecUpdateOne { return suo.RemoveCardIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (suo *SpecUpdateOne) Select(field string, fields ...string) *SpecUpdateOne { + suo.fields = append([]string{field}, fields...) + return suo +} + // Save executes the query and returns the updated Spec entity. func (suo *SpecUpdateOne) Save(ctx context.Context) (*Spec, error) { var ( @@ -321,6 +329,18 @@ func (suo *SpecUpdateOne) sqlSave(ctx context.Context) (_node *Spec, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Spec.ID for update")} } _spec.Node.ID.Value = id + if fields := suo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, spec.FieldID) + for _, f := range fields { + if !spec.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != spec.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := suo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/task_update.go b/entc/integration/ent/task_update.go index 285bd0dd7..633000798 100644 --- a/entc/integration/ent/task_update.go +++ b/entc/integration/ent/task_update.go @@ -170,6 +170,7 @@ func (tu *TaskUpdate) sqlSave(ctx context.Context) (n int, err error) { // TaskUpdateOne is the builder for updating a single Task entity. type TaskUpdateOne struct { config + fields []string hooks []Hook mutation *TaskMutation } @@ -200,6 +201,13 @@ func (tuo *TaskUpdateOne) Mutation() *TaskMutation { return tuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne { + tuo.fields = append([]string{field}, fields...) + return tuo +} + // Save executes the query and returns the updated Task entity. func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error) { var ( @@ -283,6 +291,18 @@ func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (_node *Task, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Task.ID for update")} } _spec.Node.ID.Value = id + if fields := tuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, task.FieldID) + for _, f := range fields { + if !task.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != task.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := tuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/ent/user_update.go b/entc/integration/ent/user_update.go index ebfde8b2e..036e1b932 100644 --- a/entc/integration/ent/user_update.go +++ b/entc/integration/ent/user_update.go @@ -1307,6 +1307,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -1842,6 +1843,13 @@ func (uuo *UserUpdateOne) ClearParent() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -1930,6 +1938,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/gremlin/ent/card_update.go b/entc/integration/gremlin/ent/card_update.go index c3c72013b..58f61363d 100644 --- a/entc/integration/gremlin/ent/card_update.go +++ b/entc/integration/gremlin/ent/card_update.go @@ -300,6 +300,7 @@ func (cu *CardUpdate) gremlin() *dsl.Traversal { // CardUpdateOne is the builder for updating a single Card entity. type CardUpdateOne struct { config + fields []string hooks []Hook mutation *CardMutation } @@ -411,6 +412,13 @@ func (cuo *CardUpdateOne) RemoveSpec(s ...*Spec) *CardUpdateOne { return cuo.RemoveSpecIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Card entity. func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { var ( @@ -557,7 +565,16 @@ func (cuo *CardUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range cuo.mutation.SpecIDs() { v.AddE(spec.CardLabel).From(g.V(id)).InV() } - v.ValueMap(true) + if len(cuo.fields) > 0 { + fields := make([]interface{}, 0, len(cuo.fields)+1) + fields = append(fields, true) + for _, f := range cuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/comment_update.go b/entc/integration/gremlin/ent/comment_update.go index b822db809..c5e60dfdb 100644 --- a/entc/integration/gremlin/ent/comment_update.go +++ b/entc/integration/gremlin/ent/comment_update.go @@ -230,6 +230,7 @@ func (cu *CommentUpdate) gremlin() *dsl.Traversal { // CommentUpdateOne is the builder for updating a single Comment entity. type CommentUpdateOne struct { config + fields []string hooks []Hook mutation *CommentMutation } @@ -292,6 +293,13 @@ func (cuo *CommentUpdateOne) Mutation() *CommentMutation { return cuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Comment entity. func (cuo *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) { var ( @@ -419,7 +427,16 @@ func (cuo *CommentUpdateOne) gremlin(id string) *dsl.Traversal { if len(properties) > 0 { v.SideEffect(__.Properties(properties...).Drop()) } - v.ValueMap(true) + if len(cuo.fields) > 0 { + fields := make([]interface{}, 0, len(cuo.fields)+1) + fields = append(fields, true) + for _, f := range cuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/fieldtype_update.go b/entc/integration/gremlin/ent/fieldtype_update.go index 88f137b98..af547bc4d 100644 --- a/entc/integration/gremlin/ent/fieldtype_update.go +++ b/entc/integration/gremlin/ent/fieldtype_update.go @@ -1553,6 +1553,7 @@ func (ftu *FieldTypeUpdate) gremlin() *dsl.Traversal { // FieldTypeUpdateOne is the builder for updating a single FieldType entity. type FieldTypeUpdateOne struct { config + fields []string hooks []Hook mutation *FieldTypeMutation } @@ -2582,6 +2583,13 @@ func (ftuo *FieldTypeUpdateOne) Mutation() *FieldTypeMutation { return ftuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ftuo *FieldTypeUpdateOne) Select(field string, fields ...string) *FieldTypeUpdateOne { + ftuo.fields = append([]string{field}, fields...) + return ftuo +} + // Save executes the query and returns the updated FieldType entity. func (ftuo *FieldTypeUpdateOne) Save(ctx context.Context) (*FieldType, error) { var ( @@ -3069,7 +3077,16 @@ func (ftuo *FieldTypeUpdateOne) gremlin(id string) *dsl.Traversal { if len(properties) > 0 { v.SideEffect(__.Properties(properties...).Drop()) } - v.ValueMap(true) + if len(ftuo.fields) > 0 { + fields := make([]interface{}, 0, len(ftuo.fields)+1) + fields = append(fields, true) + for _, f := range ftuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/file_update.go b/entc/integration/gremlin/ent/file_update.go index c76ccd80f..291a90312 100644 --- a/entc/integration/gremlin/ent/file_update.go +++ b/entc/integration/gremlin/ent/file_update.go @@ -381,6 +381,7 @@ func (fu *FileUpdate) gremlin() *dsl.Traversal { // FileUpdateOne is the builder for updating a single File entity. type FileUpdateOne struct { config + fields []string hooks []Hook mutation *FileMutation } @@ -563,6 +564,13 @@ func (fuo *FileUpdateOne) RemoveField(f ...*FieldType) *FileUpdateOne { return fuo.RemoveFieldIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (fuo *FileUpdateOne) Select(field string, fields ...string) *FileUpdateOne { + fuo.fields = append([]string{field}, fields...) + return fuo +} + // Save executes the query and returns the updated File entity. func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { var ( @@ -719,7 +727,16 @@ func (fuo *FileUpdateOne) gremlin(id string) *dsl.Traversal { test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(file.Label, file.FieldLabel, id)), }) } - v.ValueMap(true) + if len(fuo.fields) > 0 { + fields := make([]interface{}, 0, len(fuo.fields)+1) + fields = append(fields, true) + for _, f := range fuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/filetype_update.go b/entc/integration/gremlin/ent/filetype_update.go index 42b827015..fd118e274 100644 --- a/entc/integration/gremlin/ent/filetype_update.go +++ b/entc/integration/gremlin/ent/filetype_update.go @@ -249,6 +249,7 @@ func (ftu *FileTypeUpdate) gremlin() *dsl.Traversal { // FileTypeUpdateOne is the builder for updating a single FileType entity. type FileTypeUpdateOne struct { config + fields []string hooks []Hook mutation *FileTypeMutation } @@ -328,6 +329,13 @@ func (ftuo *FileTypeUpdateOne) RemoveFiles(f ...*File) *FileTypeUpdateOne { return ftuo.RemoveFileIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ftuo *FileTypeUpdateOne) Select(field string, fields ...string) *FileTypeUpdateOne { + ftuo.fields = append([]string{field}, fields...) + return ftuo +} + // Save executes the query and returns the updated FileType entity. func (ftuo *FileTypeUpdateOne) Save(ctx context.Context) (*FileType, error) { var ( @@ -457,7 +465,16 @@ func (ftuo *FileTypeUpdateOne) gremlin(id string) *dsl.Traversal { test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(filetype.Label, filetype.FilesLabel, id)), }) } - v.ValueMap(true) + if len(ftuo.fields) > 0 { + fields := make([]interface{}, 0, len(ftuo.fields)+1) + fields = append(fields, true) + for _, f := range ftuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/goods_update.go b/entc/integration/gremlin/ent/goods_update.go index 3b2a9dab3..8383a396a 100644 --- a/entc/integration/gremlin/ent/goods_update.go +++ b/entc/integration/gremlin/ent/goods_update.go @@ -114,6 +114,7 @@ func (gu *GoodsUpdate) gremlin() *dsl.Traversal { // GoodsUpdateOne is the builder for updating a single Goods entity. type GoodsUpdateOne struct { config + fields []string hooks []Hook mutation *GoodsMutation } @@ -123,6 +124,13 @@ func (guo *GoodsUpdateOne) Mutation() *GoodsMutation { return guo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GoodsUpdateOne) Select(field string, fields ...string) *GoodsUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Goods entity. func (guo *GoodsUpdateOne) Save(ctx context.Context) (*Goods, error) { var ( @@ -199,7 +207,16 @@ func (guo *GoodsUpdateOne) gremlin(id string) *dsl.Traversal { var ( trs []*dsl.Traversal ) - v.ValueMap(true) + if len(guo.fields) > 0 { + fields := make([]interface{}, 0, len(guo.fields)+1) + fields = append(fields, true) + for _, f := range guo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/group_update.go b/entc/integration/gremlin/ent/group_update.go index a1baaf04c..1403c18a5 100644 --- a/entc/integration/gremlin/ent/group_update.go +++ b/entc/integration/gremlin/ent/group_update.go @@ -428,6 +428,7 @@ func (gu *GroupUpdate) gremlin() *dsl.Traversal { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -635,6 +636,13 @@ func (guo *GroupUpdateOne) ClearInfo() *GroupUpdateOne { return guo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -812,7 +820,16 @@ func (guo *GroupUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range guo.mutation.InfoIDs() { v.AddE(group.InfoLabel).To(g.V(id)).OutV() } - v.ValueMap(true) + if len(guo.fields) > 0 { + fields := make([]interface{}, 0, len(guo.fields)+1) + fields = append(fields, true) + for _, f := range guo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/groupinfo_update.go b/entc/integration/gremlin/ent/groupinfo_update.go index 2bd4d5296..a8cf69fd6 100644 --- a/entc/integration/gremlin/ent/groupinfo_update.go +++ b/entc/integration/gremlin/ent/groupinfo_update.go @@ -218,6 +218,7 @@ func (giu *GroupInfoUpdate) gremlin() *dsl.Traversal { // GroupInfoUpdateOne is the builder for updating a single GroupInfo entity. type GroupInfoUpdateOne struct { config + fields []string hooks []Hook mutation *GroupInfoMutation } @@ -290,6 +291,13 @@ func (giuo *GroupInfoUpdateOne) RemoveGroups(g ...*Group) *GroupInfoUpdateOne { return giuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (giuo *GroupInfoUpdateOne) Select(field string, fields ...string) *GroupInfoUpdateOne { + giuo.fields = append([]string{field}, fields...) + return giuo +} + // Save executes the query and returns the updated GroupInfo entity. func (giuo *GroupInfoUpdateOne) Save(ctx context.Context) (*GroupInfo, error) { var ( @@ -394,7 +402,16 @@ func (giuo *GroupInfoUpdateOne) gremlin(id string) *dsl.Traversal { test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(groupinfo.Label, group.InfoLabel, id)), }) } - v.ValueMap(true) + if len(giuo.fields) > 0 { + fields := make([]interface{}, 0, len(giuo.fields)+1) + fields = append(fields, true) + for _, f := range giuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/item_update.go b/entc/integration/gremlin/ent/item_update.go index 2a00de08b..d0011d2b5 100644 --- a/entc/integration/gremlin/ent/item_update.go +++ b/entc/integration/gremlin/ent/item_update.go @@ -114,6 +114,7 @@ func (iu *ItemUpdate) gremlin() *dsl.Traversal { // ItemUpdateOne is the builder for updating a single Item entity. type ItemUpdateOne struct { config + fields []string hooks []Hook mutation *ItemMutation } @@ -123,6 +124,13 @@ func (iuo *ItemUpdateOne) Mutation() *ItemMutation { return iuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (iuo *ItemUpdateOne) Select(field string, fields ...string) *ItemUpdateOne { + iuo.fields = append([]string{field}, fields...) + return iuo +} + // Save executes the query and returns the updated Item entity. func (iuo *ItemUpdateOne) Save(ctx context.Context) (*Item, error) { var ( @@ -199,7 +207,16 @@ func (iuo *ItemUpdateOne) gremlin(id string) *dsl.Traversal { var ( trs []*dsl.Traversal ) - v.ValueMap(true) + if len(iuo.fields) > 0 { + fields := make([]interface{}, 0, len(iuo.fields)+1) + fields = append(fields, true) + for _, f := range iuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/node_update.go b/entc/integration/gremlin/ent/node_update.go index e28edf280..949b0ce3d 100644 --- a/entc/integration/gremlin/ent/node_update.go +++ b/entc/integration/gremlin/ent/node_update.go @@ -246,6 +246,7 @@ func (nu *NodeUpdate) gremlin() *dsl.Traversal { // NodeUpdateOne is the builder for updating a single Node entity. type NodeUpdateOne struct { config + fields []string hooks []Hook mutation *NodeMutation } @@ -332,6 +333,13 @@ func (nuo *NodeUpdateOne) ClearNext() *NodeUpdateOne { return nuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne { + nuo.fields = append([]string{field}, fields...) + return nuo +} + // Save executes the query and returns the updated Node entity. func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { var ( @@ -451,7 +459,16 @@ func (nuo *NodeUpdateOne) gremlin(id string) *dsl.Traversal { test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(node.Label, node.NextLabel, id)), }) } - v.ValueMap(true) + if len(nuo.fields) > 0 { + fields := make([]interface{}, 0, len(nuo.fields)+1) + fields = append(fields, true) + for _, f := range nuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/pet_update.go b/entc/integration/gremlin/ent/pet_update.go index 9cc96b5e0..12812f7d5 100644 --- a/entc/integration/gremlin/ent/pet_update.go +++ b/entc/integration/gremlin/ent/pet_update.go @@ -235,6 +235,7 @@ func (pu *PetUpdate) gremlin() *dsl.Traversal { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -312,6 +313,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -427,7 +435,16 @@ func (puo *PetUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range puo.mutation.OwnerIDs() { v.AddE(user.PetsLabel).From(g.V(id)).InV() } - v.ValueMap(true) + if len(puo.fields) > 0 { + fields := make([]interface{}, 0, len(puo.fields)+1) + fields = append(fields, true) + for _, f := range puo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/ent/spec_update.go b/entc/integration/gremlin/ent/spec_update.go index b02d0bfe9..c086e91e6 100644 --- a/entc/integration/gremlin/ent/spec_update.go +++ b/entc/integration/gremlin/ent/spec_update.go @@ -161,6 +161,7 @@ func (su *SpecUpdate) gremlin() *dsl.Traversal { // SpecUpdateOne is the builder for updating a single Spec entity. type SpecUpdateOne struct { config + fields []string hooks []Hook mutation *SpecMutation } @@ -206,6 +207,13 @@ func (suo *SpecUpdateOne) RemoveCard(c ...*Card) *SpecUpdateOne { return suo.RemoveCardIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (suo *SpecUpdateOne) Select(field string, fields ...string) *SpecUpdateOne { + suo.fields = append([]string{field}, fields...) + return suo +} + // Save executes the query and returns the updated Spec entity. func (suo *SpecUpdateOne) Save(ctx context.Context) (*Spec, error) { var ( @@ -292,7 +300,16 @@ func (suo *SpecUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range suo.mutation.CardIDs() { v.AddE(spec.CardLabel).To(g.V(id)).OutV() } - v.ValueMap(true) + if len(suo.fields) > 0 { + fields := make([]interface{}, 0, len(suo.fields)+1) + fields = append(fields, true) + for _, f := range suo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/task_update.go b/entc/integration/gremlin/ent/task_update.go index d3c5fdd79..b17285fe5 100644 --- a/entc/integration/gremlin/ent/task_update.go +++ b/entc/integration/gremlin/ent/task_update.go @@ -159,6 +159,7 @@ func (tu *TaskUpdate) gremlin() *dsl.Traversal { // TaskUpdateOne is the builder for updating a single Task entity. type TaskUpdateOne struct { config + fields []string hooks []Hook mutation *TaskMutation } @@ -189,6 +190,13 @@ func (tuo *TaskUpdateOne) Mutation() *TaskMutation { return tuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne { + tuo.fields = append([]string{field}, fields...) + return tuo +} + // Save executes the query and returns the updated Task entity. func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error) { var ( @@ -287,7 +295,16 @@ func (tuo *TaskUpdateOne) gremlin(id string) *dsl.Traversal { if value, ok := tuo.mutation.AddedPriority(); ok { v.Property(dsl.Single, task.FieldPriority, __.Union(__.Values(task.FieldPriority), __.Constant(value)).Sum()) } - v.ValueMap(true) + if len(tuo.fields) > 0 { + fields := make([]interface{}, 0, len(tuo.fields)+1) + fields = append(fields, true) + for _, f := range tuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/user_update.go b/entc/integration/gremlin/ent/user_update.go index 8a8d7f0c8..47a480f64 100644 --- a/entc/integration/gremlin/ent/user_update.go +++ b/entc/integration/gremlin/ent/user_update.go @@ -852,6 +852,7 @@ func (uu *UserUpdate) gremlin() *dsl.Traversal { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -1387,6 +1388,13 @@ func (uuo *UserUpdateOne) ClearParent() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -1663,7 +1671,16 @@ func (uuo *UserUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range uuo.mutation.ParentIDs() { v.AddE(user.ParentLabel).To(g.V(id)).OutV() } - v.ValueMap(true) + if len(uuo.fields) > 0 { + fields := make([]interface{}, 0, len(uuo.fields)+1) + fields = append(fields, true) + for _, f := range uuo.fields { + fields = append(fields, f) + } + v.ValueMap(fields...) + } else { + v.ValueMap(true) + } if len(constraints) > 0 { v = constraints[0].pred.Coalesce(constraints[0].test, v) for _, cr := range constraints[1:] { diff --git a/entc/integration/gremlin/gremlin_test.go b/entc/integration/gremlin/gremlin_test.go index 34b7f90f0..2890a71f8 100644 --- a/entc/integration/gremlin/gremlin_test.go +++ b/entc/integration/gremlin/gremlin_test.go @@ -246,6 +246,17 @@ func Select(t *testing.T, client *ent.Client) { ScanX(ctx, &v) require.Equal([]int{30, 30, 30}, []int{v[0].Age, v[1].Age, v[2].Age}) require.Equal([]string{"bar", "baz", "foo"}, []string{v[0].Name, v[1].Name, v[2].Name}) + + a8m := client.User.Create().SetName("Ariel").SetNickname("a8m").SetAge(30).SaveX(ctx) + require.NotEmpty(a8m.ID) + require.NotEmpty(a8m.Age) + require.NotEmpty(a8m.Name) + require.NotEmpty(a8m.Nickname) + a8m = a8m.Update().SetAge(32).Select(user.FieldAge).SaveX(ctx) + require.NotEmpty(a8m.ID) + require.NotEmpty(a8m.Age) + require.Empty(a8m.Name) + require.Empty(a8m.Nickname) } func Predicate(t *testing.T, client *ent.Client) { diff --git a/entc/integration/hooks/ent/card_update.go b/entc/integration/hooks/ent/card_update.go index 0ed2ec91c..9c12a8a82 100644 --- a/entc/integration/hooks/ent/card_update.go +++ b/entc/integration/hooks/ent/card_update.go @@ -247,6 +247,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) { // CardUpdateOne is the builder for updating a single Card entity. type CardUpdateOne struct { config + fields []string hooks []Hook mutation *CardMutation } @@ -321,6 +322,13 @@ func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Card entity. func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { var ( @@ -388,6 +396,18 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Card.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, card.FieldID) + for _, f := range fields { + if !card.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != card.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/hooks/ent/user_update.go b/entc/integration/hooks/ent/user_update.go index 0a78a3bcf..f442c9c56 100644 --- a/entc/integration/hooks/ent/user_update.go +++ b/entc/integration/hooks/ent/user_update.go @@ -454,6 +454,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -614,6 +615,13 @@ func (uuo *UserUpdateOne) ClearBestFriend() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -681,6 +689,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/idtype/ent/user_update.go b/entc/integration/idtype/ent/user_update.go index fb1dcf47b..82df0aa6e 100644 --- a/entc/integration/idtype/ent/user_update.go +++ b/entc/integration/idtype/ent/user_update.go @@ -371,6 +371,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -483,6 +484,13 @@ func (uuo *UserUpdateOne) RemoveFollowing(u ...*User) *UserUpdateOne { return uuo.RemoveFollowingIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -550,6 +558,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/integration_test.go b/entc/integration/integration_test.go index 126ae315b..b50820236 100644 --- a/entc/integration/integration_test.go +++ b/entc/integration/integration_test.go @@ -350,6 +350,16 @@ func Select(t *testing.T, client *ent.Client) { require.Zero(f.Age) } } + a8m := client.User.Create().SetName("Ariel").SetNickname("a8m").SetAge(30).SaveX(ctx) + require.NotEmpty(a8m.ID) + require.NotEmpty(a8m.Age) + require.NotEmpty(a8m.Name) + require.NotEmpty(a8m.Nickname) + a8m = a8m.Update().SetAge(32).Select(user.FieldAge).SaveX(ctx) + require.NotEmpty(a8m.ID) + require.NotEmpty(a8m.Age) + require.Empty(a8m.Name) + require.Empty(a8m.Nickname) } func Predicate(t *testing.T, client *ent.Client) { diff --git a/entc/integration/json/ent/user_update.go b/entc/integration/json/ent/user_update.go index 89ca6313a..691bc9d84 100644 --- a/entc/integration/json/ent/user_update.go +++ b/entc/integration/json/ent/user_update.go @@ -297,6 +297,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -390,6 +391,13 @@ func (uuo *UserUpdateOne) Mutation() *UserMutation { return uuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -457,6 +465,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv1/car_update.go b/entc/integration/migrate/entv1/car_update.go index 8717d164a..63cb1ec63 100644 --- a/entc/integration/migrate/entv1/car_update.go +++ b/entc/integration/migrate/entv1/car_update.go @@ -179,6 +179,7 @@ func (cu *CarUpdate) sqlSave(ctx context.Context) (n int, err error) { // CarUpdateOne is the builder for updating a single Car entity. type CarUpdateOne struct { config + fields []string hooks []Hook mutation *CarMutation } @@ -213,6 +214,13 @@ func (cuo *CarUpdateOne) ClearOwner() *CarUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CarUpdateOne) Select(field string, fields ...string) *CarUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Car entity. func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { var ( @@ -280,6 +288,18 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Car.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, car.FieldID) + for _, f := range fields { + if !car.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv1: invalid field %q for query", f)} + } + if f != car.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv1/conversion_update.go b/entc/integration/migrate/entv1/conversion_update.go index c07fbc000..4ffcbfcfd 100644 --- a/entc/integration/migrate/entv1/conversion_update.go +++ b/entc/integration/migrate/entv1/conversion_update.go @@ -527,6 +527,7 @@ func (cu *ConversionUpdate) sqlSave(ctx context.Context) (n int, err error) { // ConversionUpdateOne is the builder for updating a single Conversion entity. type ConversionUpdateOne struct { config + fields []string hooks []Hook mutation *ConversionMutation } @@ -772,6 +773,13 @@ func (cuo *ConversionUpdateOne) Mutation() *ConversionMutation { return cuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *ConversionUpdateOne) Select(field string, fields ...string) *ConversionUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Conversion entity. func (cuo *ConversionUpdateOne) Save(ctx context.Context) (*Conversion, error) { var ( @@ -839,6 +847,18 @@ func (cuo *ConversionUpdateOne) sqlSave(ctx context.Context) (_node *Conversion, return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Conversion.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, conversion.FieldID) + for _, f := range fields { + if !conversion.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv1: invalid field %q for query", f)} + } + if f != conversion.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv1/customtype_update.go b/entc/integration/migrate/entv1/customtype_update.go index 66cf08828..077da9f18 100644 --- a/entc/integration/migrate/entv1/customtype_update.go +++ b/entc/integration/migrate/entv1/customtype_update.go @@ -151,6 +151,7 @@ func (ctu *CustomTypeUpdate) sqlSave(ctx context.Context) (n int, err error) { // CustomTypeUpdateOne is the builder for updating a single CustomType entity. type CustomTypeUpdateOne struct { config + fields []string hooks []Hook mutation *CustomTypeMutation } @@ -180,6 +181,13 @@ func (ctuo *CustomTypeUpdateOne) Mutation() *CustomTypeMutation { return ctuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ctuo *CustomTypeUpdateOne) Select(field string, fields ...string) *CustomTypeUpdateOne { + ctuo.fields = append([]string{field}, fields...) + return ctuo +} + // Save executes the query and returns the updated CustomType entity. func (ctuo *CustomTypeUpdateOne) Save(ctx context.Context) (*CustomType, error) { var ( @@ -247,6 +255,18 @@ func (ctuo *CustomTypeUpdateOne) sqlSave(ctx context.Context) (_node *CustomType return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing CustomType.ID for update")} } _spec.Node.ID.Value = id + if fields := ctuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, customtype.FieldID) + for _, f := range fields { + if !customtype.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv1: invalid field %q for query", f)} + } + if f != customtype.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := ctuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv1/user_update.go b/entc/integration/migrate/entv1/user_update.go index 69f2323e1..86479b1a4 100644 --- a/entc/integration/migrate/entv1/user_update.go +++ b/entc/integration/migrate/entv1/user_update.go @@ -658,6 +658,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -915,6 +916,13 @@ func (uuo *UserUpdateOne) ClearCar() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -1008,6 +1016,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv1: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/car_update.go b/entc/integration/migrate/entv2/car_update.go index e998573fb..97b37dbd9 100644 --- a/entc/integration/migrate/entv2/car_update.go +++ b/entc/integration/migrate/entv2/car_update.go @@ -179,6 +179,7 @@ func (cu *CarUpdate) sqlSave(ctx context.Context) (n int, err error) { // CarUpdateOne is the builder for updating a single Car entity. type CarUpdateOne struct { config + fields []string hooks []Hook mutation *CarMutation } @@ -213,6 +214,13 @@ func (cuo *CarUpdateOne) ClearOwner() *CarUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CarUpdateOne) Select(field string, fields ...string) *CarUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Car entity. func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { var ( @@ -280,6 +288,18 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Car.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, car.FieldID) + for _, f := range fields { + if !car.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != car.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/conversion_update.go b/entc/integration/migrate/entv2/conversion_update.go index 411c686f5..209bbd1f3 100644 --- a/entc/integration/migrate/entv2/conversion_update.go +++ b/entc/integration/migrate/entv2/conversion_update.go @@ -415,6 +415,7 @@ func (cu *ConversionUpdate) sqlSave(ctx context.Context) (n int, err error) { // ConversionUpdateOne is the builder for updating a single Conversion entity. type ConversionUpdateOne struct { config + fields []string hooks []Hook mutation *ConversionMutation } @@ -604,6 +605,13 @@ func (cuo *ConversionUpdateOne) Mutation() *ConversionMutation { return cuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *ConversionUpdateOne) Select(field string, fields ...string) *ConversionUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Conversion entity. func (cuo *ConversionUpdateOne) Save(ctx context.Context) (*Conversion, error) { var ( @@ -671,6 +679,18 @@ func (cuo *ConversionUpdateOne) sqlSave(ctx context.Context) (_node *Conversion, return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Conversion.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, conversion.FieldID) + for _, f := range fields { + if !conversion.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != conversion.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/customtype_update.go b/entc/integration/migrate/entv2/customtype_update.go index 94550ced1..c65ec296c 100644 --- a/entc/integration/migrate/entv2/customtype_update.go +++ b/entc/integration/migrate/entv2/customtype_update.go @@ -151,6 +151,7 @@ func (ctu *CustomTypeUpdate) sqlSave(ctx context.Context) (n int, err error) { // CustomTypeUpdateOne is the builder for updating a single CustomType entity. type CustomTypeUpdateOne struct { config + fields []string hooks []Hook mutation *CustomTypeMutation } @@ -180,6 +181,13 @@ func (ctuo *CustomTypeUpdateOne) Mutation() *CustomTypeMutation { return ctuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (ctuo *CustomTypeUpdateOne) Select(field string, fields ...string) *CustomTypeUpdateOne { + ctuo.fields = append([]string{field}, fields...) + return ctuo +} + // Save executes the query and returns the updated CustomType entity. func (ctuo *CustomTypeUpdateOne) Save(ctx context.Context) (*CustomType, error) { var ( @@ -247,6 +255,18 @@ func (ctuo *CustomTypeUpdateOne) sqlSave(ctx context.Context) (_node *CustomType return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing CustomType.ID for update")} } _spec.Node.ID.Value = id + if fields := ctuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, customtype.FieldID) + for _, f := range fields { + if !customtype.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != customtype.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := ctuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/group_update.go b/entc/integration/migrate/entv2/group_update.go index 26bf6e6df..1b7985f80 100644 --- a/entc/integration/migrate/entv2/group_update.go +++ b/entc/integration/migrate/entv2/group_update.go @@ -118,6 +118,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -127,6 +128,13 @@ func (guo *GroupUpdateOne) Mutation() *GroupMutation { return guo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -194,6 +202,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/media_update.go b/entc/integration/migrate/entv2/media_update.go index 1e73ca96e..af261bb0e 100644 --- a/entc/integration/migrate/entv2/media_update.go +++ b/entc/integration/migrate/entv2/media_update.go @@ -184,6 +184,7 @@ func (mu *MediaUpdate) sqlSave(ctx context.Context) (n int, err error) { // MediaUpdateOne is the builder for updating a single Media entity. type MediaUpdateOne struct { config + fields []string hooks []Hook mutation *MediaMutation } @@ -233,6 +234,13 @@ func (muo *MediaUpdateOne) Mutation() *MediaMutation { return muo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (muo *MediaUpdateOne) Select(field string, fields ...string) *MediaUpdateOne { + muo.fields = append([]string{field}, fields...) + return muo +} + // Save executes the query and returns the updated Media entity. func (muo *MediaUpdateOne) Save(ctx context.Context) (*Media, error) { var ( @@ -300,6 +308,18 @@ func (muo *MediaUpdateOne) sqlSave(ctx context.Context) (_node *Media, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Media.ID for update")} } _spec.Node.ID.Value = id + if fields := muo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, media.FieldID) + for _, f := range fields { + if !media.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != media.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := muo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/pet_update.go b/entc/integration/migrate/entv2/pet_update.go index 2bdf2f351..5cadb77d9 100644 --- a/entc/integration/migrate/entv2/pet_update.go +++ b/entc/integration/migrate/entv2/pet_update.go @@ -179,6 +179,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -213,6 +214,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -280,6 +288,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/migrate/entv2/user_update.go b/entc/integration/migrate/entv2/user_update.go index a71d25105..66f7871a1 100644 --- a/entc/integration/migrate/entv2/user_update.go +++ b/entc/integration/migrate/entv2/user_update.go @@ -710,6 +710,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -1001,6 +1002,13 @@ func (uuo *UserUpdateOne) RemoveFriends(u ...*User) *UserUpdateOne { return uuo.RemoveFriendIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -1099,6 +1107,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("entv2: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/multischema/ent/group_update.go b/entc/integration/multischema/ent/group_update.go index d2131db1d..55dae7020 100644 --- a/entc/integration/multischema/ent/group_update.go +++ b/entc/integration/multischema/ent/group_update.go @@ -236,6 +236,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -295,6 +296,13 @@ func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne { return guo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -362,6 +370,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/multischema/ent/pet_update.go b/entc/integration/multischema/ent/pet_update.go index 8e69e29d6..18736600e 100644 --- a/entc/integration/multischema/ent/pet_update.go +++ b/entc/integration/multischema/ent/pet_update.go @@ -205,6 +205,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -253,6 +254,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -320,6 +328,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/multischema/ent/user_update.go b/entc/integration/multischema/ent/user_update.go index 9a99f7381..741140017 100644 --- a/entc/integration/multischema/ent/user_update.go +++ b/entc/integration/multischema/ent/user_update.go @@ -330,6 +330,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -425,6 +426,13 @@ func (uuo *UserUpdateOne) RemoveGroups(g ...*Group) *UserUpdateOne { return uuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -492,6 +500,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/privacy/ent/task_update.go b/entc/integration/privacy/ent/task_update.go index aa602ac5a..408485264 100644 --- a/entc/integration/privacy/ent/task_update.go +++ b/entc/integration/privacy/ent/task_update.go @@ -384,6 +384,7 @@ func (tu *TaskUpdate) sqlSave(ctx context.Context) (n int, err error) { // TaskUpdateOne is the builder for updating a single Task entity. type TaskUpdateOne struct { config + fields []string hooks []Hook mutation *TaskMutation } @@ -506,6 +507,13 @@ func (tuo *TaskUpdateOne) ClearOwner() *TaskUpdateOne { return tuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (tuo *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne { + tuo.fields = append([]string{field}, fields...) + return tuo +} + // Save executes the query and returns the updated Task entity. func (tuo *TaskUpdateOne) Save(ctx context.Context) (*Task, error) { var ( @@ -594,6 +602,18 @@ func (tuo *TaskUpdateOne) sqlSave(ctx context.Context) (_node *Task, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Task.ID for update")} } _spec.Node.ID.Value = id + if fields := tuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, task.FieldID) + for _, f := range fields { + if !task.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != task.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := tuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/privacy/ent/team_update.go b/entc/integration/privacy/ent/team_update.go index 66907ff12..9d15731d2 100644 --- a/entc/integration/privacy/ent/team_update.go +++ b/entc/integration/privacy/ent/team_update.go @@ -329,6 +329,7 @@ func (tu *TeamUpdate) sqlSave(ctx context.Context) (n int, err error) { // TeamUpdateOne is the builder for updating a single Team entity. type TeamUpdateOne struct { config + fields []string hooks []Hook mutation *TeamMutation } @@ -416,6 +417,13 @@ func (tuo *TeamUpdateOne) RemoveUsers(u ...*User) *TeamUpdateOne { return tuo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (tuo *TeamUpdateOne) Select(field string, fields ...string) *TeamUpdateOne { + tuo.fields = append([]string{field}, fields...) + return tuo +} + // Save executes the query and returns the updated Team entity. func (tuo *TeamUpdateOne) Save(ctx context.Context) (*Team, error) { var ( @@ -499,6 +507,18 @@ func (tuo *TeamUpdateOne) sqlSave(ctx context.Context) (_node *Team, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Team.ID for update")} } _spec.Node.ID.Value = id + if fields := tuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, team.FieldID) + for _, f := range fields { + if !team.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != team.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := tuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/privacy/ent/user_update.go b/entc/integration/privacy/ent/user_update.go index 8ec695672..046ab9659 100644 --- a/entc/integration/privacy/ent/user_update.go +++ b/entc/integration/privacy/ent/user_update.go @@ -347,6 +347,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -455,6 +456,13 @@ func (uuo *UserUpdateOne) RemoveTasks(t ...*Task) *UserUpdateOne { return uuo.RemoveTaskIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -522,6 +530,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/template/ent/group_update.go b/entc/integration/template/ent/group_update.go index 19dd6f94d..097b73bb4 100644 --- a/entc/integration/template/ent/group_update.go +++ b/entc/integration/template/ent/group_update.go @@ -145,6 +145,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -167,6 +168,13 @@ func (guo *GroupUpdateOne) Mutation() *GroupMutation { return guo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -234,6 +242,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/template/ent/pet_update.go b/entc/integration/template/ent/pet_update.go index 311cec29f..6ec7b8584 100644 --- a/entc/integration/template/ent/pet_update.go +++ b/entc/integration/template/ent/pet_update.go @@ -240,6 +240,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -307,6 +308,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -374,6 +382,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/entc/integration/template/ent/user_update.go b/entc/integration/template/ent/user_update.go index 4d355e319..7073ed938 100644 --- a/entc/integration/template/ent/user_update.go +++ b/entc/integration/template/ent/user_update.go @@ -312,6 +312,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -399,6 +400,13 @@ func (uuo *UserUpdateOne) RemoveFriends(u ...*User) *UserUpdateOne { return uuo.RemoveFriendIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -466,6 +474,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/edgeindex/ent/city_update.go b/examples/edgeindex/ent/city_update.go index e68c7072f..e0e00b153 100644 --- a/examples/edgeindex/ent/city_update.go +++ b/examples/edgeindex/ent/city_update.go @@ -222,6 +222,7 @@ func (cu *CityUpdate) sqlSave(ctx context.Context) (n int, err error) { // CityUpdateOne is the builder for updating a single City entity. type CityUpdateOne struct { config + fields []string hooks []Hook mutation *CityMutation } @@ -273,6 +274,13 @@ func (cuo *CityUpdateOne) RemoveStreets(s ...*Street) *CityUpdateOne { return cuo.RemoveStreetIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CityUpdateOne) Select(field string, fields ...string) *CityUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated City entity. func (cuo *CityUpdateOne) Save(ctx context.Context) (*City, error) { var ( @@ -340,6 +348,18 @@ func (cuo *CityUpdateOne) sqlSave(ctx context.Context) (_node *City, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing City.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, city.FieldID) + for _, f := range fields { + if !city.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != city.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/edgeindex/ent/street_update.go b/examples/edgeindex/ent/street_update.go index 3051ea6a5..116ce8462 100644 --- a/examples/edgeindex/ent/street_update.go +++ b/examples/edgeindex/ent/street_update.go @@ -192,6 +192,7 @@ func (su *StreetUpdate) sqlSave(ctx context.Context) (n int, err error) { // StreetUpdateOne is the builder for updating a single Street entity. type StreetUpdateOne struct { config + fields []string hooks []Hook mutation *StreetMutation } @@ -232,6 +233,13 @@ func (suo *StreetUpdateOne) ClearCity() *StreetUpdateOne { return suo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (suo *StreetUpdateOne) Select(field string, fields ...string) *StreetUpdateOne { + suo.fields = append([]string{field}, fields...) + return suo +} + // Save executes the query and returns the updated Street entity. func (suo *StreetUpdateOne) Save(ctx context.Context) (*Street, error) { var ( @@ -299,6 +307,18 @@ func (suo *StreetUpdateOne) sqlSave(ctx context.Context) (_node *Street, err err return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Street.ID for update")} } _spec.Node.ID.Value = id + if fields := suo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, street.FieldID) + for _, f := range fields { + if !street.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != street.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := suo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/entcpkg/ent/user_update.go b/examples/entcpkg/ent/user_update.go index 69b374d69..5ff0c1856 100644 --- a/examples/entcpkg/ent/user_update.go +++ b/examples/entcpkg/ent/user_update.go @@ -118,6 +118,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -127,6 +128,13 @@ func (uuo *UserUpdateOne) Mutation() *UserMutation { return uuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -194,6 +202,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/m2m2types/ent/group_update.go b/examples/m2m2types/ent/group_update.go index faed48bf5..eedc57da5 100644 --- a/examples/m2m2types/ent/group_update.go +++ b/examples/m2m2types/ent/group_update.go @@ -222,6 +222,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -273,6 +274,13 @@ func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne { return guo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -340,6 +348,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/m2m2types/ent/user_update.go b/examples/m2m2types/ent/user_update.go index bf70b9b40..f58ab1959 100644 --- a/examples/m2m2types/ent/user_update.go +++ b/examples/m2m2types/ent/user_update.go @@ -249,6 +249,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -313,6 +314,13 @@ func (uuo *UserUpdateOne) RemoveGroups(g ...*Group) *UserUpdateOne { return uuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -380,6 +388,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/m2mbidi/ent/user_update.go b/examples/m2mbidi/ent/user_update.go index 07da11ade..0e40a7f92 100644 --- a/examples/m2mbidi/ent/user_update.go +++ b/examples/m2mbidi/ent/user_update.go @@ -248,6 +248,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -312,6 +313,13 @@ func (uuo *UserUpdateOne) RemoveFriends(u ...*User) *UserUpdateOne { return uuo.RemoveFriendIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -379,6 +387,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/m2mrecur/ent/user_update.go b/examples/m2mrecur/ent/user_update.go index 58b690e89..6e1f85986 100644 --- a/examples/m2mrecur/ent/user_update.go +++ b/examples/m2mrecur/ent/user_update.go @@ -338,6 +338,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -438,6 +439,13 @@ func (uuo *UserUpdateOne) RemoveFollowing(u ...*User) *UserUpdateOne { return uuo.RemoveFollowingIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -505,6 +513,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2m2types/ent/pet_update.go b/examples/o2m2types/ent/pet_update.go index c955c7bdc..6f7a80f11 100644 --- a/examples/o2m2types/ent/pet_update.go +++ b/examples/o2m2types/ent/pet_update.go @@ -192,6 +192,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -232,6 +233,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -299,6 +307,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2m2types/ent/user_update.go b/examples/o2m2types/ent/user_update.go index 328ecfbcf..52855ce06 100644 --- a/examples/o2m2types/ent/user_update.go +++ b/examples/o2m2types/ent/user_update.go @@ -249,6 +249,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -313,6 +314,13 @@ func (uuo *UserUpdateOne) RemovePets(p ...*Pet) *UserUpdateOne { return uuo.RemovePetIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -380,6 +388,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2mrecur/ent/node_update.go b/examples/o2mrecur/ent/node_update.go index 49ab8be75..af8b4791f 100644 --- a/examples/o2mrecur/ent/node_update.go +++ b/examples/o2mrecur/ent/node_update.go @@ -295,6 +295,7 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { // NodeUpdateOne is the builder for updating a single Node entity. type NodeUpdateOne struct { config + fields []string hooks []Hook mutation *NodeMutation } @@ -378,6 +379,13 @@ func (nuo *NodeUpdateOne) RemoveChildren(n ...*Node) *NodeUpdateOne { return nuo.RemoveChildIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne { + nuo.fields = append([]string{field}, fields...) + return nuo +} + // Save executes the query and returns the updated Node entity. func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { var ( @@ -445,6 +453,18 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Node.ID for update")} } _spec.Node.ID.Value = id + if fields := nuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, node.FieldID) + for _, f := range fields { + if !node.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != node.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := nuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2o2types/ent/card_update.go b/examples/o2o2types/ent/card_update.go index 290a69979..7bb1f6f8a 100644 --- a/examples/o2o2types/ent/card_update.go +++ b/examples/o2o2types/ent/card_update.go @@ -213,6 +213,7 @@ func (cu *CardUpdate) sqlSave(ctx context.Context) (n int, err error) { // CardUpdateOne is the builder for updating a single Card entity. type CardUpdateOne struct { config + fields []string hooks []Hook mutation *CardMutation } @@ -251,6 +252,13 @@ func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CardUpdateOne) Select(field string, fields ...string) *CardUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Card entity. func (cuo *CardUpdateOne) Save(ctx context.Context) (*Card, error) { var ( @@ -332,6 +340,18 @@ func (cuo *CardUpdateOne) sqlSave(ctx context.Context) (_node *Card, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Card.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, card.FieldID) + for _, f := range fields { + if !card.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != card.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2o2types/ent/user_update.go b/examples/o2o2types/ent/user_update.go index 4de26c025..fd6f2b16e 100644 --- a/examples/o2o2types/ent/user_update.go +++ b/examples/o2o2types/ent/user_update.go @@ -219,6 +219,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -272,6 +273,13 @@ func (uuo *UserUpdateOne) ClearCard() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -339,6 +347,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2obidi/ent/user_update.go b/examples/o2obidi/ent/user_update.go index ae20326a1..7c0f3fb21 100644 --- a/examples/o2obidi/ent/user_update.go +++ b/examples/o2obidi/ent/user_update.go @@ -218,6 +218,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -271,6 +272,13 @@ func (uuo *UserUpdateOne) ClearSpouse() *UserUpdateOne { return uuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -338,6 +346,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/o2orecur/ent/node_update.go b/examples/o2orecur/ent/node_update.go index 454462855..c91e40ffd 100644 --- a/examples/o2orecur/ent/node_update.go +++ b/examples/o2orecur/ent/node_update.go @@ -265,6 +265,7 @@ func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) { // NodeUpdateOne is the builder for updating a single Node entity. type NodeUpdateOne struct { config + fields []string hooks []Hook mutation *NodeMutation } @@ -337,6 +338,13 @@ func (nuo *NodeUpdateOne) ClearNext() *NodeUpdateOne { return nuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (nuo *NodeUpdateOne) Select(field string, fields ...string) *NodeUpdateOne { + nuo.fields = append([]string{field}, fields...) + return nuo +} + // Save executes the query and returns the updated Node entity. func (nuo *NodeUpdateOne) Save(ctx context.Context) (*Node, error) { var ( @@ -404,6 +412,18 @@ func (nuo *NodeUpdateOne) sqlSave(ctx context.Context) (_node *Node, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Node.ID for update")} } _spec.Node.ID.Value = id + if fields := nuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, node.FieldID) + for _, f := range fields { + if !node.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != node.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := nuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/privacyadmin/ent/user_update.go b/examples/privacyadmin/ent/user_update.go index 1ac0c8061..fd47c77dc 100644 --- a/examples/privacyadmin/ent/user_update.go +++ b/examples/privacyadmin/ent/user_update.go @@ -139,6 +139,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -162,6 +163,13 @@ func (uuo *UserUpdateOne) Mutation() *UserMutation { return uuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -229,6 +237,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/privacytenant/ent/group_update.go b/examples/privacytenant/ent/group_update.go index 60b566549..3a7461a9e 100644 --- a/examples/privacytenant/ent/group_update.go +++ b/examples/privacytenant/ent/group_update.go @@ -298,6 +298,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -374,6 +375,13 @@ func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne { return guo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -455,6 +463,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/privacytenant/ent/tenant_update.go b/examples/privacytenant/ent/tenant_update.go index 5fa3c02f2..ce594f61c 100644 --- a/examples/privacytenant/ent/tenant_update.go +++ b/examples/privacytenant/ent/tenant_update.go @@ -147,6 +147,7 @@ func (tu *TenantUpdate) sqlSave(ctx context.Context) (n int, err error) { // TenantUpdateOne is the builder for updating a single Tenant entity. type TenantUpdateOne struct { config + fields []string hooks []Hook mutation *TenantMutation } @@ -162,6 +163,13 @@ func (tuo *TenantUpdateOne) Mutation() *TenantMutation { return tuo.mutation } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (tuo *TenantUpdateOne) Select(field string, fields ...string) *TenantUpdateOne { + tuo.fields = append([]string{field}, fields...) + return tuo +} + // Save executes the query and returns the updated Tenant entity. func (tuo *TenantUpdateOne) Save(ctx context.Context) (*Tenant, error) { var ( @@ -245,6 +253,18 @@ func (tuo *TenantUpdateOne) sqlSave(ctx context.Context) (_node *Tenant, err err return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Tenant.ID for update")} } _spec.Node.ID.Value = id + if fields := tuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, tenant.FieldID) + for _, f := range fields { + if !tenant.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != tenant.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := tuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/privacytenant/ent/user_update.go b/examples/privacytenant/ent/user_update.go index 1f530965b..2c6716453 100644 --- a/examples/privacytenant/ent/user_update.go +++ b/examples/privacytenant/ent/user_update.go @@ -323,6 +323,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -411,6 +412,13 @@ func (uuo *UserUpdateOne) RemoveGroups(g ...*Group) *UserUpdateOne { return uuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -492,6 +500,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/start/ent/car_update.go b/examples/start/ent/car_update.go index 9684d6d12..7f3ff1c64 100644 --- a/examples/start/ent/car_update.go +++ b/examples/start/ent/car_update.go @@ -206,6 +206,7 @@ func (cu *CarUpdate) sqlSave(ctx context.Context) (n int, err error) { // CarUpdateOne is the builder for updating a single Car entity. type CarUpdateOne struct { config + fields []string hooks []Hook mutation *CarMutation } @@ -252,6 +253,13 @@ func (cuo *CarUpdateOne) ClearOwner() *CarUpdateOne { return cuo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (cuo *CarUpdateOne) Select(field string, fields ...string) *CarUpdateOne { + cuo.fields = append([]string{field}, fields...) + return cuo +} + // Save executes the query and returns the updated Car entity. func (cuo *CarUpdateOne) Save(ctx context.Context) (*Car, error) { var ( @@ -319,6 +327,18 @@ func (cuo *CarUpdateOne) sqlSave(ctx context.Context) (_node *Car, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Car.ID for update")} } _spec.Node.ID.Value = id + if fields := cuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, car.FieldID) + for _, f := range fields { + if !car.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != car.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := cuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/start/ent/group_update.go b/examples/start/ent/group_update.go index d3beaa817..fb30ed3f8 100644 --- a/examples/start/ent/group_update.go +++ b/examples/start/ent/group_update.go @@ -238,6 +238,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -289,6 +290,13 @@ func (guo *GroupUpdateOne) RemoveUsers(u ...*User) *GroupUpdateOne { return guo.RemoveUserIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -372,6 +380,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/start/ent/user_update.go b/examples/start/ent/user_update.go index 12647edaa..505aff714 100644 --- a/examples/start/ent/user_update.go +++ b/examples/start/ent/user_update.go @@ -364,6 +364,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -472,6 +473,13 @@ func (uuo *UserUpdateOne) RemoveGroups(g ...*Group) *UserUpdateOne { return uuo.RemoveGroupIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -555,6 +563,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/traversal/ent/group_update.go b/examples/traversal/ent/group_update.go index 86736d73c..28f4d55ef 100644 --- a/examples/traversal/ent/group_update.go +++ b/examples/traversal/ent/group_update.go @@ -282,6 +282,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { // GroupUpdateOne is the builder for updating a single Group entity. type GroupUpdateOne struct { config + fields []string hooks []Hook mutation *GroupMutation } @@ -358,6 +359,13 @@ func (guo *GroupUpdateOne) ClearAdmin() *GroupUpdateOne { return guo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { + guo.fields = append([]string{field}, fields...) + return guo +} + // Save executes the query and returns the updated Group entity. func (guo *GroupUpdateOne) Save(ctx context.Context) (*Group, error) { var ( @@ -425,6 +433,18 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Group.ID for update")} } _spec.Node.ID.Value = id + if fields := guo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, group.FieldID) + for _, f := range fields { + if !group.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != group.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := guo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/traversal/ent/pet_update.go b/examples/traversal/ent/pet_update.go index 1f21f8344..92a879884 100644 --- a/examples/traversal/ent/pet_update.go +++ b/examples/traversal/ent/pet_update.go @@ -282,6 +282,7 @@ func (pu *PetUpdate) sqlSave(ctx context.Context) (n int, err error) { // PetUpdateOne is the builder for updating a single Pet entity. type PetUpdateOne struct { config + fields []string hooks []Hook mutation *PetMutation } @@ -358,6 +359,13 @@ func (puo *PetUpdateOne) ClearOwner() *PetUpdateOne { return puo } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (puo *PetUpdateOne) Select(field string, fields ...string) *PetUpdateOne { + puo.fields = append([]string{field}, fields...) + return puo +} + // Save executes the query and returns the updated Pet entity. func (puo *PetUpdateOne) Save(ctx context.Context) (*Pet, error) { var ( @@ -425,6 +433,18 @@ func (puo *PetUpdateOne) sqlSave(ctx context.Context) (_node *Pet, err error) { return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing Pet.ID for update")} } _spec.Node.ID.Value = id + if fields := puo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, pet.FieldID) + for _, f := range fields { + if !pet.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != pet.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := puo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/examples/traversal/ent/user_update.go b/examples/traversal/ent/user_update.go index a6fba1bbc..64f8293ac 100644 --- a/examples/traversal/ent/user_update.go +++ b/examples/traversal/ent/user_update.go @@ -520,6 +520,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { // UserUpdateOne is the builder for updating a single User entity. type UserUpdateOne struct { config + fields []string hooks []Hook mutation *UserMutation } @@ -692,6 +693,13 @@ func (uuo *UserUpdateOne) RemoveManage(g ...*Group) *UserUpdateOne { return uuo.RemoveManageIDs(ids...) } +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { + uuo.fields = append([]string{field}, fields...) + return uuo +} + // Save executes the query and returns the updated User entity. func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) { var ( @@ -759,6 +767,18 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) return nil, &ValidationError{Name: "ID", err: fmt.Errorf("missing User.ID for update")} } _spec.Node.ID.Value = id + if fields := uuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, user.FieldID) + for _, f := range fields { + if !user.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} + } + if f != user.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } if ps := uuo.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps {