From bc89ed4e0f8813512d9b8b10649e22fac9ab3ac2 Mon Sep 17 00:00:00 2001 From: Ariel Mashraki <7413593+a8m@users.noreply.github.com> Date: Sun, 26 Jan 2020 12:39:18 +0200 Subject: [PATCH] entc/gen: add type for type edges (#318) Will be used for adding methods on the struct edges --- entc/gen/internal/bindata.go | 4 +- entc/gen/template/ent.tmpl | 17 +++++--- entc/integration/customid/ent/group.go | 11 +++-- entc/integration/customid/ent/user.go | 19 +++++---- entc/integration/ent/card.go | 15 ++++--- entc/integration/ent/file.go | 15 ++++--- entc/integration/ent/filetype.go | 11 +++-- entc/integration/ent/group.go | 23 +++++----- entc/integration/ent/groupinfo.go | 11 +++-- entc/integration/ent/node.go | 15 ++++--- entc/integration/ent/pet.go | 15 ++++--- entc/integration/ent/spec.go | 11 +++-- entc/integration/ent/user.go | 51 ++++++++++++----------- entc/integration/gremlin/ent/card.go | 15 ++++--- entc/integration/gremlin/ent/file.go | 15 ++++--- entc/integration/gremlin/ent/filetype.go | 11 +++-- entc/integration/gremlin/ent/group.go | 23 +++++----- entc/integration/gremlin/ent/groupinfo.go | 11 +++-- entc/integration/gremlin/ent/node.go | 15 ++++--- entc/integration/gremlin/ent/pet.go | 15 ++++--- entc/integration/gremlin/ent/spec.go | 11 +++-- entc/integration/gremlin/ent/user.go | 51 ++++++++++++----------- entc/integration/idtype/ent/user.go | 19 +++++---- entc/integration/migrate/entv1/car.go | 11 +++-- entc/integration/migrate/entv1/user.go | 23 +++++----- entc/integration/migrate/entv2/car.go | 11 +++-- entc/integration/migrate/entv2/user.go | 11 +++-- entc/integration/template/ent/pet.go | 11 +++-- entc/integration/template/ent/user.go | 15 ++++--- examples/edgeindex/ent/city.go | 11 +++-- examples/edgeindex/ent/street.go | 11 +++-- examples/m2m2types/ent/group.go | 11 +++-- examples/m2m2types/ent/user.go | 11 +++-- examples/m2mbidi/ent/user.go | 11 +++-- examples/m2mrecur/ent/user.go | 15 ++++--- examples/o2m2types/ent/pet.go | 11 +++-- examples/o2m2types/ent/user.go | 11 +++-- examples/o2mrecur/ent/node.go | 15 ++++--- examples/o2o2types/ent/card.go | 11 +++-- examples/o2o2types/ent/user.go | 11 +++-- examples/o2obidi/ent/user.go | 11 +++-- examples/o2orecur/ent/node.go | 15 ++++--- examples/start/ent/car.go | 11 +++-- examples/start/ent/group.go | 11 +++-- examples/start/ent/user.go | 15 ++++--- examples/traversal/ent/group.go | 15 ++++--- examples/traversal/ent/pet.go | 15 ++++--- examples/traversal/ent/user.go | 23 +++++----- 48 files changed, 437 insertions(+), 294 deletions(-) diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index c54894a2c..9fb862877 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -821,7 +821,7 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return a, nil } -var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x5f\x6f\xe3\xb8\x11\x7f\x96\x3e\xc5\x9c\xe0\xed\xd9\x86\x43\x6d\xef\xad\xdb\xa6\x40\x2e\xd9\x05\x0c\x14\xdb\x3f\xc9\xa2\x0f\x8b\xc5\x2e\x2d\x8e\x2c\x36\x12\xa9\x23\x29\x27\x86\xe0\xef\x5e\x0c\x29\xc9\x92\xed\xe4\xd2\x3e\x45\xe6\xcc\xfc\x66\x38\x33\x9c\x3f\x69\xdb\x74\x19\xdf\xea\x7a\x6f\xe4\xb6\x70\xf0\xcb\xfb\x3f\xfe\xe9\xaa\x36\x68\x51\x39\xf8\xc4\x33\xdc\x68\xfd\x08\x6b\x95\x31\xb8\x29\x4b\xf0\x4c\x16\x88\x6e\x76\x28\x58\xfc\x50\x48\x0b\x56\x37\x26\x43\xc8\xb4\x40\x90\x16\x4a\x99\xa1\xb2\x28\xa0\x51\x02\x0d\xb8\x02\xe1\xa6\xe6\x59\x81\xf0\x0b\x7b\xdf\x53\x21\xd7\x8d\x12\xb1\x54\x9e\xfe\xb7\xf5\xed\xc7\xcf\xf7\x1f\x21\x97\x25\x42\x77\x66\xb4\x76\x20\xa4\xc1\xcc\x69\xb3\x07\x9d\x83\x1b\x29\x73\x06\x91\xc5\xcb\xf4\x70\x88\xe3\xb6\x05\x81\xb9\x54\x08\x49\xa5\x05\x96\x09\x74\xa7\xb3\xfa\x71\x0b\x1f\xae\x61\xc3\x2d\xc2\x8c\xdd\x6a\x95\xcb\x2d\xfb\x07\xcf\x1e\xf9\x16\x89\xa9\x6d\xc1\x61\x55\x97\xdc\x21\x24\x05\x72\x81\x26\x81\x59\x2f\x7e\x24\xc9\xaa\xd6\xc6\xf5\xa4\x34\x05\x02\x67\x9f\x79\x45\x28\x74\x67\x32\xd8\xeb\x06\x54\x4e\xba\x3d\xe4\x3a\xdc\x7c\xc2\x68\xb3\x02\x2b\xce\x62\xb7\xaf\x4f\x29\xce\x34\x99\x83\x36\x8e\x32\x6f\x24\x4c\xd4\x7b\xe4\x54\x57\xd2\x39\xbe\xb5\x9d\x19\x51\x9a\xc2\xfa\x2e\xf8\x05\x49\x2d\x8b\xa3\xf5\x5d\x80\x5d\xdf\xb1\x07\xd2\x71\x38\xc0\x8f\xff\x58\xad\x3e\x24\x52\xac\x48\x1e\xab\xda\xed\x93\x1f\x71\xd4\xb6\x57\x60\xb8\xda\x22\xcc\xbe\xaf\x60\x96\x93\x9b\x66\xec\x93\xc4\x52\x58\x8f\x1e\x75\xb7\xcc\xd9\xbd\xb7\xcd\x93\x08\xb0\xd0\xc4\x42\x3a\x77\xbc\x6c\xb0\x37\x20\x09\xcc\xdd\x85\x12\xc8\x89\x9f\xc5\x00\x00\xd1\x45\x9c\xb6\x05\x99\x7b\x11\x59\x96\x7c\x53\x92\xd8\xb2\x6d\x01\x15\x91\x83\x48\x7f\x89\xc0\xab\xb4\xf3\x38\xa8\xac\x74\x72\x47\x94\x1f\x63\xe8\x07\xbe\xed\x8e\xb0\xb4\x18\x40\x5e\x77\xe2\xa0\x2e\x38\x64\xfc\xfd\x24\x5d\x01\x33\xf6\x51\x6c\xf1\xe8\x90\xf0\xeb\xe8\x01\x83\x25\x77\x52\x2b\x9b\xa2\xa7\x50\xd4\xb5\x2b\xd0\x80\xd2\x02\x6d\x9f\xca\x5b\xc3\xeb\x82\x05\x88\x87\xde\x71\x16\xb8\x41\xd8\xa0\x54\x5b\xa8\x75\xdd\x90\x95\x02\x36\xfb\xb3\xb4\xf9\x67\x83\x66\x0f\x4f\x05\x2a\x40\xbe\x45\x73\x55\x6a\x2e\x48\x8a\x5e\x03\x52\xd8\xa3\x60\xd7\x31\x89\xa2\x71\x7c\x31\xc4\x76\x74\x93\x21\xb8\xf8\xc6\xe0\x06\xde\x3e\x59\xe9\xae\xcc\xc3\x5c\xc4\x18\x05\x0b\xd9\x17\x25\x7f\x6b\x48\xea\xeb\xb7\xc1\xd9\xcb\x20\x46\xc1\x1d\x30\xdb\xb6\xf3\x38\x9e\x05\x93\xf5\x41\xed\xa2\x13\x4d\x62\x15\x0d\x29\xee\x43\xd0\xe7\x36\x91\xaf\xfa\x58\xa6\x4b\xb8\x11\x42\x52\xa4\x78\x19\x32\xd3\x82\xd3\xc0\xc5\xe0\x70\xeb\xb4\xa1\xa2\x20\x8c\xdc\xa1\x61\xe0\x2b\x8b\x17\x9e\xb9\xaa\x2e\xc9\x85\xb5\x91\xca\xe5\x90\x08\xc9\x4b\xcc\x5c\xfa\xce\xa6\x21\xa7\x02\x60\x02\x33\x76\xdf\xa1\xf4\xb2\x32\x87\x82\xdb\x87\x3e\x07\x03\x94\xb7\x9a\xa8\xcf\x6e\x4a\x60\x17\x13\xf1\x0d\xc6\x37\x76\x6c\xf2\x59\xce\x07\x99\x94\x0f\x28\x5d\x05\xe9\x8a\xa4\xd7\x7d\xf1\x7a\x02\xa9\xa6\xa7\x5a\xe1\xc9\xe5\xda\xf6\xcc\xf8\xa1\x6a\xce\x0c\x66\x48\x4e\x0c\x69\xf7\xaf\xfe\x57\x47\x1e\x15\x9d\xb3\xc4\xf4\x8f\xb9\x51\xd9\xe0\x6d\x48\x7c\xf2\x27\xe7\x59\x16\x0f\xf5\x89\xf8\x0f\x07\xf8\xad\x41\x23\xd1\xbe\x90\xae\xe3\x44\xee\x09\x2c\x8e\xbc\xf0\x7c\x62\xf4\xe1\x00\xcb\x31\xd7\x62\xac\x65\xbe\x80\xd3\xe4\xed\xdf\x27\xbd\x3a\x83\xae\x31\x0a\xe6\x7f\x18\x03\xdc\x96\x12\x95\x6b\xe1\x44\x0b\x0b\x85\xfe\xb0\x60\x63\xfc\x13\xa6\x45\x1c\x79\x67\x77\xf9\x40\x9d\xe7\x4b\x2d\xc8\xe9\x41\x95\x05\x0e\x9b\x46\x96\xd4\x67\xa9\xf6\x34\x44\xa4\xd2\xe0\x5b\xe5\xf4\xb2\x69\x0a\x9f\xb5\x43\x70\x05\x77\x2b\xd8\xeb\x06\x14\xa2\xa0\x4c\xca\x78\x59\x4e\x99\xbf\xa8\x27\xc3\xeb\xf9\x02\x36\x98\x6b\x83\x9e\x63\x80\xad\xd0\x15\x5a\xac\x28\xb9\xcf\xd4\x90\x96\x27\x6e\x3b\xf3\x50\x40\x6e\x74\x05\x1c\x9c\xe1\xca\xf2\x8c\xd2\x6f\x05\x5c\x09\x1f\x8c\xd1\xa1\x17\xca\x74\x45\xd5\x19\x05\x68\x03\x46\x97\x25\xd5\x43\x9e\x3d\xb2\xf8\x4d\x71\x0a\x9e\xe9\x43\xd4\x9f\x87\xd3\xbf\x2b\xa4\x08\xfd\x7f\x01\x1a\x20\xce\xc3\xd3\xc5\xc4\xbb\x0b\x1a\xff\xc7\xf6\xfd\x98\xc6\x00\x72\xf6\xef\x39\x04\x78\xee\xd0\x80\x0c\x8c\x59\xa9\x2d\x8a\x15\xc1\x5a\x1d\xe4\x29\x3c\x0a\x9f\xdd\x90\xe3\x4f\xb2\x2c\x61\x83\x80\xcf\x98\x35\xe4\x2f\x57\x18\xdd\x6c\x0b\xaf\x39\x54\x30\x78\x2a\x64\x56\x40\x66\x90\x07\x86\x89\xbb\xdf\xea\xd1\x3e\x0d\x26\xe7\xe4\x48\xf7\xbc\x02\xfd\x48\xef\xf4\xb2\xd7\x58\x57\x47\xe7\x4b\xf7\x7c\xe7\x3f\x17\x71\x24\x73\xf8\x49\x3f\xfa\x97\x52\x73\x25\xb3\x79\xd2\xcf\x68\x87\xc3\x87\xb3\x91\x8a\x1a\xc8\xc4\x4f\xbc\x1f\xae\x12\xff\x2c\xa2\x57\x35\xc3\x35\xb8\x67\x26\xcc\x6e\x08\xfa\x09\x7b\x17\xba\x7b\x67\x7c\x2b\xad\xea\x12\x2b\x54\x2e\x44\x2f\xaf\x1c\x0b\x14\x34\x6f\xf4\x55\x60\x9f\x2f\xa8\x0b\x13\x62\x1b\x47\x3b\x6e\x86\xd7\x19\x4e\x2d\xfb\x35\xfc\x8e\xa3\x8e\xc0\xfe\x6d\xa4\xc3\x4e\x38\x19\x43\xce\xe9\x9a\x97\xb8\xbc\x71\xa1\x5a\xcf\x13\x29\xae\xdf\xed\x92\xd5\x59\x18\xd6\x77\x8b\xc5\x64\xca\x93\x97\xa7\xbc\xae\x4b\x9d\x8c\x55\xd4\x64\x2f\x1a\xb8\x82\xc9\x98\x77\xfd\x17\xdb\x4b\xfd\x95\xcc\x0d\xcd\x2b\x0c\x5f\x7d\xa3\x9e\xd9\x7c\xdc\x3d\xdf\x59\xf6\x8e\x7a\xe5\x60\xec\xd9\x64\xd8\x0b\x9e\x4d\x87\x7e\xe4\x90\x39\xec\xfa\xbc\xb3\x39\x1c\x0e\x7f\x86\x1d\xfc\x74\x0d\x4a\x96\x61\xf2\x79\xa3\xe5\xde\xdc\x89\xa6\xb5\x7d\x90\xd5\xa0\xe7\x32\xcc\x8e\x7d\xd2\xa6\xe2\x6e\xee\x64\x85\xec\xe6\xf3\xfd\xfa\x76\x31\x02\xf2\x57\xef\xd1\xba\xd4\x7a\x15\x6f\xb9\x3b\x95\x7e\x95\x7d\x12\x7a\x1f\xf7\xe5\x6e\xa2\x7f\x18\x91\xa2\xe3\xa0\x34\x42\xfd\x5f\x3c\xf3\xa2\x63\x2e\x81\x0c\xd1\x78\xd1\x3f\xbf\xe7\x9e\x57\x51\x4f\x20\x5e\x93\x39\x77\xd1\x11\x65\x04\x73\x79\x96\x3c\x9d\xbd\xfa\xef\x89\xa2\x5f\xf7\x0e\xe7\x3f\x2f\x7e\x5e\x0c\xa5\xa5\x27\xf7\x35\x20\x4c\x56\xc1\x7d\xb4\x8b\x8d\x2f\x9b\xa6\x20\xc5\xd0\xbe\xa9\xd8\xd0\x9c\x63\xb0\x5b\xba\xfd\x3a\xd1\x4f\x2b\xeb\xbb\x7e\x8d\x7a\x53\x09\x92\x62\xbe\xf0\x68\x6d\x1c\x49\xb1\x82\xef\xf4\x4e\xac\x33\x99\x56\x3b\x76\xe3\xb4\x3c\x05\xa0\x2a\x31\x5c\x42\x8a\xf8\x10\x8f\x2e\xed\x67\x39\x4b\xeb\xba\x7f\xbe\x65\x63\x78\x39\x6d\xf4\x47\x86\x50\xb1\x39\xd4\xdc\x58\xff\x58\xc3\xb1\xce\x4f\x66\x90\x61\xf1\x1d\xc4\xbe\x7e\x9b\x5c\xc2\x6b\xf5\x8b\x00\x3e\x3b\x32\x64\x06\xc9\x3d\xf1\x26\x47\x99\x50\xf9\x5f\x99\xca\xbb\xb1\xb5\xe2\x6a\x7f\x3e\x94\x5f\x9e\xba\x47\x33\xd6\x65\x57\x8f\x8d\x5e\x40\x68\x35\xf3\x2c\xdf\x76\x9f\x0b\xf2\x39\x4d\x60\xdf\x25\x19\x15\x6a\xee\x19\x46\x1c\x9d\x36\xad\xaf\xdf\xe5\xb7\xae\x71\xc1\x35\x64\xf9\x96\x3a\xdb\xc4\x9c\xb6\xa5\x05\xe0\x38\xd3\xfb\x15\x93\xc6\x24\xca\xa7\xb0\xf1\x5d\xd1\x42\xdb\xcd\xff\xa7\xff\x0b\x19\x2d\xbc\x7e\xdd\xed\xd6\xda\x07\xbe\xa5\x09\xd6\x76\xab\xd5\xa8\x47\x38\xb2\x9f\x05\x66\x5a\xe3\xe8\x18\xde\x77\x2e\x38\xee\xe6\x8e\x7a\x76\x72\x95\x0c\x87\x3f\xc6\xe4\x97\x8c\xf7\xe3\x4c\xc6\x15\x0d\x2f\x7a\x87\xc6\x48\x81\x82\xb6\x64\x6d\xfc\xbf\x8a\xc2\x56\xc3\x2f\xad\x3b\x7e\xa8\xe2\x59\x01\x94\x43\xec\xf2\x5d\x2f\x2c\x3a\x64\x0e\x2a\x71\x38\xc4\xff\x0d\x00\x00\xff\xff\x13\xdc\x88\x51\xea\x12\x00\x00") +var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x58\x5f\x6f\xe3\xb8\x11\x7f\x96\x3e\xc5\x9c\xe0\xed\xd9\x81\x43\x6d\xef\xad\xdb\xa6\x40\x2e\xd9\x05\x0c\x14\xdb\x3f\xc9\xa2\x0f\x8b\xc5\x2e\x23\x8e\x2c\x36\x32\xa9\x23\x29\x27\x86\xe0\xef\x5e\x0c\x29\xca\x92\xed\xcd\xa6\xbd\xa7\x58\x9c\x99\xdf\x0c\xe7\x1f\x67\xd2\x75\xf9\x45\x7a\xa3\x9b\x9d\x91\xeb\xca\xc1\x2f\x6f\xff\xf8\xa7\xcb\xc6\xa0\x45\xe5\xe0\x03\x2f\xf0\x41\xeb\x47\x58\xa9\x82\xc1\x75\x5d\x83\x67\xb2\x40\x74\xb3\x45\xc1\xd2\xfb\x4a\x5a\xb0\xba\x35\x05\x42\xa1\x05\x82\xb4\x50\xcb\x02\x95\x45\x01\xad\x12\x68\xc0\x55\x08\xd7\x0d\x2f\x2a\x84\x5f\xd8\xdb\x48\x85\x52\xb7\x4a\xa4\x52\x79\xfa\xdf\x56\x37\xef\x3f\xde\xbd\x87\x52\xd6\x08\xfd\x99\xd1\xda\x81\x90\x06\x0b\xa7\xcd\x0e\x74\x09\x6e\xa4\xcc\x19\x44\x96\x5e\xe4\xfb\x7d\x9a\x76\x1d\x08\x2c\xa5\x42\xc8\x36\x5a\x60\x9d\x41\x7f\x3a\x6b\x1e\xd7\xf0\xee\x0a\x1e\xb8\x45\x98\xb1\x1b\xad\x4a\xb9\x66\xff\xe0\xc5\x23\x5f\x23\x31\x75\x1d\x38\xdc\x34\x35\x77\x08\x59\x85\x5c\xa0\xc9\x60\x16\xc5\x0f\x24\xb9\x69\xb4\x71\x91\x94\xe7\x40\xe0\xec\x23\xdf\x10\x0a\xdd\x99\x0c\xf6\xba\x01\x95\x93\x6e\x07\xa5\x0e\x37\x9f\x30\xda\xa2\xc2\x0d\x67\xa9\xdb\x35\xc7\x14\x67\xda\xc2\x41\x97\x26\x85\x37\x12\x26\xea\x3d\x72\xae\x37\xd2\x39\xbe\xb6\xbd\x19\x49\x9e\xc3\xea\x36\xf8\x05\x49\x2d\x4b\x93\xd5\x6d\x80\x5d\xdd\xb2\x7b\xd2\xb1\xdf\xc3\xb7\xff\x58\xad\xde\x65\x52\x2c\x49\x1e\x37\x8d\xdb\x65\xdf\xd2\xa4\xeb\x2e\xc1\x70\xb5\x46\x98\x7d\x5d\xc2\xac\x24\x37\xcd\xd8\x07\x89\xb5\xb0\x1e\x3d\xe9\x6f\x59\xb2\x3b\x6f\x9b\x27\x11\x60\xa5\x89\x85\x74\x6e\x79\xdd\x62\x34\x20\x0b\xcc\xfd\x85\x32\x28\x89\x9f\xa5\x00\x00\xc9\x59\x9c\xae\x03\x59\x7a\x11\x59\xd7\xfc\xa1\x26\xb1\x8b\xae\x03\x54\x44\x0e\x22\xf1\x12\x81\x57\x69\xe7\x71\x50\x59\xe9\xe4\x96\x28\xdf\xc6\xd0\xf7\x7c\xdd\x1f\x61\x6d\x31\x80\xbc\xec\xc4\x41\x5d\x70\xc8\xf8\xf7\x93\x74\x15\xcc\xd8\x7b\xb1\xc6\x83\x43\xc2\xd7\xc1\x03\x06\x6b\xee\xa4\x56\x36\x47\x4f\xa1\xa8\x6b\x57\xa1\x01\xa5\x05\xda\x98\xca\x6b\xc3\x9b\x8a\x05\x88\xfb\xe8\x38\x0b\xdc\x20\x3c\xa0\x54\x6b\x68\x74\xd3\x92\x95\x02\x1e\x76\x27\x69\xf3\xcf\x16\xcd\x0e\x9e\x2a\x54\x80\x7c\x8d\xe6\xb2\xd6\x5c\x90\x14\x55\x03\x52\xd8\x93\x60\xd7\x58\x28\x9c\xf4\xc1\xf7\xc6\xc5\xa8\xd3\x25\x2f\xe3\x2d\xf3\x0b\xb8\x16\x42\xd2\x1d\x78\x1d\x62\x66\xc1\x69\xe0\x62\x30\xc5\x3a\x6d\xa8\x5c\x84\x91\x5b\x34\x0c\x7c\xcd\x79\xe1\x99\xdb\x34\x35\x25\x4e\x63\xa4\x72\x25\x64\x42\xf2\x1a\x0b\x97\xbf\xb1\x79\xf0\x76\x00\xcc\x60\xc6\xee\x7a\x94\x28\x2b\x4b\xa8\xb8\xbd\x8f\xd1\x09\x50\xde\xcd\x44\x7d\x76\x53\x02\x3b\x1b\xa2\x57\x18\xdf\xda\xb1\xc9\x27\xd9\x10\x64\x72\x3e\xa0\xf4\xb5\xe5\xeb\xff\x34\x07\x8e\x0a\xff\xf7\x65\xc3\x49\x13\x08\x70\x87\x4e\x30\x2a\x51\x24\x2f\xb3\x49\x5d\xe2\x2b\xeb\x32\xf0\xc6\x3e\x43\x86\x31\xef\xe4\x33\x08\xa3\x2a\x43\xf6\x49\xc9\xdf\x5a\x92\xf9\xfc\x65\xa8\x92\x8b\x20\x46\x55\x39\x20\x76\x5d\xef\x26\x3c\xa9\x42\x16\xab\xf1\xb4\xc4\xf6\xe9\xe8\xc3\xb7\x6a\x1f\xe7\xb3\xa9\x24\x90\x5e\x96\x5c\x2b\x3c\x4a\xa4\xae\x3b\x49\x94\xa1\x77\xcf\x0c\x16\x48\x09\x1b\x1a\xdb\xbf\xe2\x57\x4f\x1e\xb5\x3e\x0c\x1c\x87\x42\xf7\x2d\xa5\x55\xc5\x90\xd9\x90\xf9\x12\xcc\x4e\x5d\x96\x0e\x5d\x92\xf8\xf7\x7b\xf8\xad\x45\x23\xd1\x7e\xc7\xf3\xe3\x98\x44\x02\x4b\x13\x2f\x3c\x9f\x18\xbd\xdf\xc3\xc5\x98\x6b\x31\xd6\x32\x5f\xc0\x71\x24\x62\x97\xe8\xd2\x24\x31\xe8\x5a\xa3\x60\xfe\x87\x31\xc0\x4d\x2d\x51\xb9\x0e\x8e\xb4\xb0\xf0\xdc\xec\x17\x6c\x8c\x7f\xc4\xb4\x48\x13\xef\xec\x18\xae\x3c\x87\x4f\x8d\x20\xa7\x07\x55\x16\x38\x3c\xb4\xb2\xa6\xd7\x9e\x72\xbe\x25\x22\x35\x28\xff\x60\x4f\x2f\x9b\xe7\xf0\x51\x3b\x04\x57\x71\xb7\x84\x9d\x6e\x41\x21\x0a\xaa\xda\x82\xd7\xf5\x94\xf9\x93\x7a\x32\xbc\x99\x2f\xe0\x01\x4b\x6d\xd0\x73\x0c\xb0\x1b\x74\x95\x16\x4b\xca\xd8\x13\x35\xa4\xe5\x89\xdb\xde\x3c\x14\x50\x1a\xbd\x01\x0e\xce\x70\x65\x79\x41\x35\xba\x04\xae\x84\x0f\xc6\xe8\xd0\x0b\x15\x7a\x43\x6f\x04\x0a\xd0\x06\x8c\xae\x6b\xea\xca\xbc\x78\x64\xe9\xab\xe2\x14\x3c\x13\x43\x14\xcf\xc3\xe9\xdf\x15\x52\x84\xfe\xbf\x00\x0d\x10\xa7\xe1\xe9\x63\xe2\xdd\x05\xad\xff\x63\xe3\x54\x40\xc3\x08\x39\xfb\x47\x0e\x01\x5e\x3a\x34\x20\x03\x63\x51\x6b\x8b\x62\x49\xb0\x56\x07\x79\x0a\x8f\xc2\x67\x37\xe4\xf8\x93\xac\x6b\x78\x40\xc0\x67\x2c\x5a\xf2\x97\xab\x8c\x6e\xd7\x95\xd7\x1c\x5e\x0b\x78\xaa\x64\x51\x41\x61\x90\x07\x86\x89\xbb\x5f\xeb\xd1\x98\x06\x93\x73\x72\xa4\x7b\x5e\x82\x7e\xa4\x3a\x3d\xef\x35\xd6\xbf\x59\xf3\x0b\xf7\x7c\xeb\x7f\x2e\xd2\x44\x96\xf0\x93\x7e\xf4\x95\xd2\x70\x25\x8b\x79\x16\x27\xc5\xfd\xfe\xdd\xc9\x60\x47\xdd\x70\xe2\x27\x1e\x47\xbc\xcc\x97\x45\xf2\xa2\x66\xb8\x02\xf7\xcc\x84\xd9\x0e\x41\x3f\x62\xef\x43\x77\xe7\x8c\x7f\xd0\x37\x4d\x8d\x1b\x54\x2e\x44\xaf\xdc\x38\x16\x28\x68\x5e\xe9\xab\xc0\x3e\x5f\xd0\x33\x42\x88\x5d\x9a\x6c\xb9\x19\xaa\x33\x9c\x5a\xf6\x6b\xf8\x4e\x93\x9e\xc0\xfe\x6d\xa4\xc3\x5e\x38\x1b\x43\xce\xe9\x9a\xe7\xb8\xbc\x71\xa1\x5b\xcf\x33\x29\xae\xde\x6c\xb3\xe5\x49\x18\x56\xb7\x8b\xc5\xe4\x21\x93\xe7\x67\xcd\x7e\x22\x38\x1a\xee\xd2\x24\x39\x6f\xe0\x12\x26\xc3\xe6\xd5\x5f\x6c\x94\xfa\x2b\x99\x1b\x1e\x9a\x30\x02\x12\x86\x9f\x55\x6c\x39\x9e\x54\xde\x58\xf6\x86\xe6\x92\xc1\xd8\x93\xf9\x34\x0a\x9e\xcc\xa8\x44\xa0\x24\xda\xc6\xbc\xb3\x25\xec\xf7\x7f\x86\x2d\xfc\x74\x05\x4a\xd6\x3e\xb3\x5e\x6b\xb9\x37\x77\xa2\x69\x65\xef\xe5\x66\xd0\x73\x1e\x66\xcb\x3e\x68\xb3\xe1\x6e\xee\xe4\x06\xd9\xf5\xc7\xbb\xd5\xcd\x62\x04\xe4\xaf\x1e\xd1\xfa\xd4\x7a\x11\xef\x62\x7b\x2c\xfd\x22\xfb\x24\xf4\x3e\xee\x17\xdb\x89\x7e\x15\x1d\x98\x0c\x6e\x1c\xa3\xfe\x2f\x9e\xf9\xae\x63\xce\x81\x0c\xd1\xf8\xae\x7f\x7e\xe4\x9e\x17\x51\x8f\x20\x5e\x92\x39\x75\xd1\x01\x65\x04\xa3\xc6\x99\x36\x7c\x1d\xcf\xb9\xf1\xf7\x44\xd1\xaf\x3b\x87\xf3\x9f\x17\x3f\x2f\x86\xd6\x12\xc9\xb1\x07\xc4\x29\x96\xae\x4a\x1b\xe1\xf8\xb2\x79\x0e\x52\x0c\xcf\x37\x35\x1b\x9a\x73\x0c\xf6\xab\xbf\x1f\x63\xe3\xb4\xb2\xba\x8d\xcb\xdc\xab\x5a\x90\x14\xf3\x85\x47\xeb\xd2\x44\x8a\x25\x7c\xa5\x3a\xb1\xce\x14\x5a\x6d\xd9\xb5\xd3\xf2\x18\x80\xba\xc4\x70\x09\x29\xce\xcc\x86\xb6\x96\x85\x1f\xd3\x9a\xba\x35\xbc\x9e\x3e\xf4\x07\x86\xd0\xb1\x39\x34\xdc\x58\x5f\xac\xe1\x58\x97\x47\x33\xc8\x30\x79\x0f\x62\x9f\xbf\x4c\x2e\xe1\xb5\xfa\xa9\x16\x9f\x1d\x19\x32\x83\xec\x8e\x78\xb3\x83\x4c\xe8\xfc\x2f\x6c\x40\xfd\xd8\xba\xe1\x6a\x77\xba\x00\x9d\xdf\x70\x46\x33\xd6\x79\x57\x8f\x8d\x5e\x40\x78\x6a\xe6\x45\xb9\xee\x7f\x2e\xc8\xe7\x34\x81\x7d\x95\x64\x54\xe8\xb9\x27\x18\xfd\xf8\x3f\x3a\xfb\xfc\x55\x7e\xe9\x1f\x2e\xb8\x82\xa2\x5c\xd3\xcb\x36\x31\xa7\xeb\x68\xd9\x3a\xec\x4f\x7e\xb5\xa1\x31\x89\xf2\x29\xac\x2c\x97\xb4\x56\xf7\xbb\xd6\xf1\x7f\x64\x46\x6b\xb7\x5f\xba\xfb\xc5\xea\x9e\xaf\x69\x82\xb5\xfd\x9e\x30\x7a\x23\x5c\x5c\x78\xfa\x9d\x84\x8e\xe1\x6d\xef\x82\xc3\x7f\x08\x1c\xbd\xd9\xd9\x65\x36\x1c\x7e\x1b\x93\xbf\x67\xbc\x1f\x67\x0a\xae\x68\x78\xd1\x5b\x34\x46\x0a\x14\xb4\x9d\x69\xe3\xff\x61\x15\x36\x48\x7e\x6e\xb5\xf4\x43\x15\x2f\x2a\xa0\x1c\x62\xe7\xef\x7a\x66\xa9\x24\x73\x50\x89\xfd\x3e\xfd\x6f\x00\x00\x00\xff\xff\x3e\x6c\x5f\xa2\x70\x13\x00\x00") func templateEntTmplBytes() ([]byte, error) { return bindataRead( @@ -836,7 +836,7 @@ func templateEntTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/ent.tmpl", size: 4842, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/ent.tmpl", size: 4976, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/ent.tmpl b/entc/gen/template/ent.tmpl index df6c3cb00..0fce591ed 100644 --- a/entc/gen/template/ent.tmpl +++ b/entc/gen/template/ent.tmpl @@ -23,12 +23,7 @@ type {{ $.Name }} struct { {{- with $.Edges }} // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the {{ $.Name }}Query when eager-loading is set. - Edges struct { - {{- range $e := $.Edges }} - // {{ $e.StructField }} holds the value of the {{ $e.Name }} edge. - {{ $e.StructField }} {{ if not $e.Unique }}[]{{ end }}*{{ $e.Type.Name }} {{ with $e.StructTag }}`{{ . }}`{{ end }} - {{- end }} - } `json:"edges"` + Edges {{ $.Name }}Edges `json:"edges"` {{- end -}} {{- /* Additional fields to add by the storage driver. */}} {{- $tmpl := printf "dialect/%s/model/fields" $.Storage }} @@ -39,6 +34,16 @@ type {{ $.Name }} struct { {{ template "model/fields/additional" $ }} } +{{- with $.Edges }} +// {{ $.Name }}Edges holds the relations/edges for other nodes in the graph. +type {{ $.Name }}Edges struct { + {{- range $e := . }} + // {{ $e.StructField }} holds the value of the {{ $e.Name }} edge. + {{ $e.StructField }} {{ if not $e.Unique }}[]{{ end }}*{{ $e.Type.Name }} {{ with $e.StructTag }}`{{ . }}`{{ end }} + {{- end }} +} +{{- end }} + {{ $tmpl = printf "dialect/%s/decode/one" $.Storage }} {{ xtemplate $tmpl $ }} diff --git a/entc/integration/customid/ent/group.go b/entc/integration/customid/ent/group.go index 737ad2b82..5a8379bc4 100644 --- a/entc/integration/customid/ent/group.go +++ b/entc/integration/customid/ent/group.go @@ -21,10 +21,13 @@ type Group struct { ID int `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Users holds the value of the users edge. - Users []*User - } `json:"edges"` + Edges GroupEdges `json:"edges"` +} + +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Users holds the value of the users edge. + Users []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/entc/integration/customid/ent/user.go b/entc/integration/customid/ent/user.go index 87272b028..520646e7b 100644 --- a/entc/integration/customid/ent/user.go +++ b/entc/integration/customid/ent/user.go @@ -21,17 +21,20 @@ type User struct { ID int `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Groups holds the value of the groups edge. - Groups []*Group - // Parent holds the value of the parent edge. - Parent *User - // Children holds the value of the children edge. - Children []*User - } `json:"edges"` + Edges UserEdges `json:"edges"` parent_id *int } +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Groups holds the value of the groups edge. + Groups []*Group + // Parent holds the value of the parent edge. + Parent *User + // Children holds the value of the children edge. + Children []*User +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/card.go b/entc/integration/ent/card.go index 7ee59cee7..759240cfd 100644 --- a/entc/integration/ent/card.go +++ b/entc/integration/ent/card.go @@ -31,18 +31,21 @@ type Card struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CardQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - // Spec holds the value of the spec edge. - Spec []*Spec - } `json:"edges"` + Edges CardEdges `json:"edges"` owner_id *string // StaticField defined by templates. StaticField string `json:"boring,omitempty"` } +// CardEdges holds the relations/edges for other nodes in the graph. +type CardEdges struct { + // Owner holds the value of the owner edge. + Owner *User + // Spec holds the value of the spec edge. + Spec []*Spec +} + // scanValues returns the types for scanning values from sql.Rows. func (*Card) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/file.go b/entc/integration/ent/file.go index 2e2d54c3f..84eaa7867 100644 --- a/entc/integration/ent/file.go +++ b/entc/integration/ent/file.go @@ -30,17 +30,20 @@ type File struct { Group string `json:"group,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the FileQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - // Type holds the value of the type edge. - Type *FileType - } `json:"edges"` + Edges FileEdges `json:"edges"` type_id *string group_file_id *string owner_id *string } +// FileEdges holds the relations/edges for other nodes in the graph. +type FileEdges struct { + // Owner holds the value of the owner edge. + Owner *User + // Type holds the value of the type edge. + Type *FileType +} + // scanValues returns the types for scanning values from sql.Rows. func (*File) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/filetype.go b/entc/integration/ent/filetype.go index d4a62c846..26d051a74 100644 --- a/entc/integration/ent/filetype.go +++ b/entc/integration/ent/filetype.go @@ -24,10 +24,13 @@ type FileType struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the FileTypeQuery when eager-loading is set. - Edges struct { - // Files holds the value of the files edge. - Files []*File - } `json:"edges"` + Edges FileTypeEdges `json:"edges"` +} + +// FileTypeEdges holds the relations/edges for other nodes in the graph. +type FileTypeEdges struct { + // Files holds the value of the files edge. + Files []*File } // scanValues returns the types for scanning values from sql.Rows. diff --git a/entc/integration/ent/group.go b/entc/integration/ent/group.go index 396cbab8f..eacb954a0 100644 --- a/entc/integration/ent/group.go +++ b/entc/integration/ent/group.go @@ -33,19 +33,22 @@ type Group struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Files holds the value of the files edge. - Files []*File - // Blocked holds the value of the blocked edge. - Blocked []*User - // Users holds the value of the users edge. - Users []*User - // Info holds the value of the info edge. - Info *GroupInfo - } `json:"edges"` + Edges GroupEdges `json:"edges"` info_id *string } +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Files holds the value of the files edge. + Files []*File + // Blocked holds the value of the blocked edge. + Blocked []*User + // Users holds the value of the users edge. + Users []*User + // Info holds the value of the info edge. + Info *GroupInfo +} + // scanValues returns the types for scanning values from sql.Rows. func (*Group) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/groupinfo.go b/entc/integration/ent/groupinfo.go index cbe4e2bbe..6ec584e29 100644 --- a/entc/integration/ent/groupinfo.go +++ b/entc/integration/ent/groupinfo.go @@ -26,10 +26,13 @@ type GroupInfo struct { MaxUsers int `json:"max_users,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupInfoQuery when eager-loading is set. - Edges struct { - // Groups holds the value of the groups edge. - Groups []*Group - } `json:"edges"` + Edges GroupInfoEdges `json:"edges"` +} + +// GroupInfoEdges holds the relations/edges for other nodes in the graph. +type GroupInfoEdges struct { + // Groups holds the value of the groups edge. + Groups []*Group } // scanValues returns the types for scanning values from sql.Rows. diff --git a/entc/integration/ent/node.go b/entc/integration/ent/node.go index 8836c8af9..dd58f21da 100644 --- a/entc/integration/ent/node.go +++ b/entc/integration/ent/node.go @@ -24,15 +24,18 @@ type Node struct { Value int `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeQuery when eager-loading is set. - Edges struct { - // Prev holds the value of the prev edge. - Prev *Node `gqlgen:prev` - // Next holds the value of the next edge. - Next *Node `gqlgen:next` - } `json:"edges"` + Edges NodeEdges `json:"edges"` prev_id *string } +// NodeEdges holds the relations/edges for other nodes in the graph. +type NodeEdges struct { + // Prev holds the value of the prev edge. + Prev *Node `gqlgen:prev` + // Next holds the value of the next edge. + Next *Node `gqlgen:next` +} + // scanValues returns the types for scanning values from sql.Rows. func (*Node) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/pet.go b/entc/integration/ent/pet.go index 2108aa82a..b7ad95244 100644 --- a/entc/integration/ent/pet.go +++ b/entc/integration/ent/pet.go @@ -24,16 +24,19 @@ type Pet struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PetQuery when eager-loading is set. - Edges struct { - // Team holds the value of the team edge. - Team *User - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges PetEdges `json:"edges"` owner_id *string team_id *string } +// PetEdges holds the relations/edges for other nodes in the graph. +type PetEdges struct { + // Team holds the value of the team edge. + Team *User + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Pet) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/ent/spec.go b/entc/integration/ent/spec.go index 3e0f98472..0b0c36cde 100644 --- a/entc/integration/ent/spec.go +++ b/entc/integration/ent/spec.go @@ -22,10 +22,13 @@ type Spec struct { ID string `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SpecQuery when eager-loading is set. - Edges struct { - // Card holds the value of the card edge. - Card []*Card - } `json:"edges"` + Edges SpecEdges `json:"edges"` +} + +// SpecEdges holds the relations/edges for other nodes in the graph. +type SpecEdges struct { + // Card holds the value of the card edge. + Card []*Card } // scanValues returns the types for scanning values from sql.Rows. diff --git a/entc/integration/ent/user.go b/entc/integration/ent/user.go index 315f38ea9..adb6873dd 100644 --- a/entc/integration/ent/user.go +++ b/entc/integration/ent/user.go @@ -38,35 +38,38 @@ type User struct { Role user.Role `json:"role,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Card holds the value of the card edge. - Card *Card - // Pets holds the value of the pets edge. - Pets []*Pet - // Files holds the value of the files edge. - Files []*File - // Groups holds the value of the groups edge. - Groups []*Group - // Friends holds the value of the friends edge. - Friends []*User - // Followers holds the value of the followers edge. - Followers []*User - // Following holds the value of the following edge. - Following []*User - // Team holds the value of the team edge. - Team *Pet - // Spouse holds the value of the spouse edge. - Spouse *User - // Children holds the value of the children edge. - Children []*User - // Parent holds the value of the parent edge. - Parent *User - } `json:"edges"` + Edges UserEdges `json:"edges"` group_blocked_id *string user_spouse_id *string parent_id *string } +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Card holds the value of the card edge. + Card *Card + // Pets holds the value of the pets edge. + Pets []*Pet + // Files holds the value of the files edge. + Files []*File + // Groups holds the value of the groups edge. + Groups []*Group + // Friends holds the value of the friends edge. + Friends []*User + // Followers holds the value of the followers edge. + Followers []*User + // Following holds the value of the following edge. + Following []*User + // Team holds the value of the team edge. + Team *Pet + // Spouse holds the value of the spouse edge. + Spouse *User + // Children holds the value of the children edge. + Children []*User + // Parent holds the value of the parent edge. + Parent *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/gremlin/ent/card.go b/entc/integration/gremlin/ent/card.go index ed650371a..8663e6149 100644 --- a/entc/integration/gremlin/ent/card.go +++ b/entc/integration/gremlin/ent/card.go @@ -30,17 +30,20 @@ type Card struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CardQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - // Spec holds the value of the spec edge. - Spec []*Spec - } `json:"edges"` + Edges CardEdges `json:"edges"` // StaticField defined by templates. StaticField string `json:"boring,omitempty"` } +// CardEdges holds the relations/edges for other nodes in the graph. +type CardEdges struct { + // Owner holds the value of the owner edge. + Owner *User + // Spec holds the value of the spec edge. + Spec []*Spec +} + // FromResponse scans the gremlin response data into Card. func (c *Card) FromResponse(res *gremlin.Response) error { vmap, err := res.ReadValueMap() diff --git a/entc/integration/gremlin/ent/file.go b/entc/integration/gremlin/ent/file.go index efc6d8462..e5a968a0e 100644 --- a/entc/integration/gremlin/ent/file.go +++ b/entc/integration/gremlin/ent/file.go @@ -29,12 +29,15 @@ type File struct { Group string `json:"group,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the FileQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - // Type holds the value of the type edge. - Type *FileType - } `json:"edges"` + Edges FileEdges `json:"edges"` +} + +// FileEdges holds the relations/edges for other nodes in the graph. +type FileEdges struct { + // Owner holds the value of the owner edge. + Owner *User + // Type holds the value of the type edge. + Type *FileType } // FromResponse scans the gremlin response data into File. diff --git a/entc/integration/gremlin/ent/filetype.go b/entc/integration/gremlin/ent/filetype.go index 18ed8fc01..ee1871cc5 100644 --- a/entc/integration/gremlin/ent/filetype.go +++ b/entc/integration/gremlin/ent/filetype.go @@ -23,10 +23,13 @@ type FileType struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the FileTypeQuery when eager-loading is set. - Edges struct { - // Files holds the value of the files edge. - Files []*File - } `json:"edges"` + Edges FileTypeEdges `json:"edges"` +} + +// FileTypeEdges holds the relations/edges for other nodes in the graph. +type FileTypeEdges struct { + // Files holds the value of the files edge. + Files []*File } // FromResponse scans the gremlin response data into FileType. diff --git a/entc/integration/gremlin/ent/group.go b/entc/integration/gremlin/ent/group.go index 37873e4fd..e3fba020f 100644 --- a/entc/integration/gremlin/ent/group.go +++ b/entc/integration/gremlin/ent/group.go @@ -32,16 +32,19 @@ type Group struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Files holds the value of the files edge. - Files []*File - // Blocked holds the value of the blocked edge. - Blocked []*User - // Users holds the value of the users edge. - Users []*User - // Info holds the value of the info edge. - Info *GroupInfo - } `json:"edges"` + Edges GroupEdges `json:"edges"` +} + +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Files holds the value of the files edge. + Files []*File + // Blocked holds the value of the blocked edge. + Blocked []*User + // Users holds the value of the users edge. + Users []*User + // Info holds the value of the info edge. + Info *GroupInfo } // FromResponse scans the gremlin response data into Group. diff --git a/entc/integration/gremlin/ent/groupinfo.go b/entc/integration/gremlin/ent/groupinfo.go index 93f0350bc..f88c6ecd3 100644 --- a/entc/integration/gremlin/ent/groupinfo.go +++ b/entc/integration/gremlin/ent/groupinfo.go @@ -25,10 +25,13 @@ type GroupInfo struct { MaxUsers int `json:"max_users,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupInfoQuery when eager-loading is set. - Edges struct { - // Groups holds the value of the groups edge. - Groups []*Group - } `json:"edges"` + Edges GroupInfoEdges `json:"edges"` +} + +// GroupInfoEdges holds the relations/edges for other nodes in the graph. +type GroupInfoEdges struct { + // Groups holds the value of the groups edge. + Groups []*Group } // FromResponse scans the gremlin response data into GroupInfo. diff --git a/entc/integration/gremlin/ent/node.go b/entc/integration/gremlin/ent/node.go index 6a834d371..7bc6473cc 100644 --- a/entc/integration/gremlin/ent/node.go +++ b/entc/integration/gremlin/ent/node.go @@ -23,12 +23,15 @@ type Node struct { Value int `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeQuery when eager-loading is set. - Edges struct { - // Prev holds the value of the prev edge. - Prev *Node `gqlgen:prev` - // Next holds the value of the next edge. - Next *Node `gqlgen:next` - } `json:"edges"` + Edges NodeEdges `json:"edges"` +} + +// NodeEdges holds the relations/edges for other nodes in the graph. +type NodeEdges struct { + // Prev holds the value of the prev edge. + Prev *Node `gqlgen:prev` + // Next holds the value of the next edge. + Next *Node `gqlgen:next` } // FromResponse scans the gremlin response data into Node. diff --git a/entc/integration/gremlin/ent/pet.go b/entc/integration/gremlin/ent/pet.go index 613c55156..1eec687c5 100644 --- a/entc/integration/gremlin/ent/pet.go +++ b/entc/integration/gremlin/ent/pet.go @@ -23,12 +23,15 @@ type Pet struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PetQuery when eager-loading is set. - Edges struct { - // Team holds the value of the team edge. - Team *User - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges PetEdges `json:"edges"` +} + +// PetEdges holds the relations/edges for other nodes in the graph. +type PetEdges struct { + // Team holds the value of the team edge. + Team *User + // Owner holds the value of the owner edge. + Owner *User } // FromResponse scans the gremlin response data into Pet. diff --git a/entc/integration/gremlin/ent/spec.go b/entc/integration/gremlin/ent/spec.go index 6c7c70e31..3c2a5e9d2 100644 --- a/entc/integration/gremlin/ent/spec.go +++ b/entc/integration/gremlin/ent/spec.go @@ -21,10 +21,13 @@ type Spec struct { ID string `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the SpecQuery when eager-loading is set. - Edges struct { - // Card holds the value of the card edge. - Card []*Card - } `json:"edges"` + Edges SpecEdges `json:"edges"` +} + +// SpecEdges holds the relations/edges for other nodes in the graph. +type SpecEdges struct { + // Card holds the value of the card edge. + Card []*Card } // FromResponse scans the gremlin response data into Spec. diff --git a/entc/integration/gremlin/ent/user.go b/entc/integration/gremlin/ent/user.go index c8c414bee..460290a7e 100644 --- a/entc/integration/gremlin/ent/user.go +++ b/entc/integration/gremlin/ent/user.go @@ -38,30 +38,33 @@ type User struct { Role user.Role `json:"role,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Card holds the value of the card edge. - Card *Card - // Pets holds the value of the pets edge. - Pets []*Pet - // Files holds the value of the files edge. - Files []*File - // Groups holds the value of the groups edge. - Groups []*Group - // Friends holds the value of the friends edge. - Friends []*User - // Followers holds the value of the followers edge. - Followers []*User - // Following holds the value of the following edge. - Following []*User - // Team holds the value of the team edge. - Team *Pet - // Spouse holds the value of the spouse edge. - Spouse *User - // Children holds the value of the children edge. - Children []*User - // Parent holds the value of the parent edge. - Parent *User - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Card holds the value of the card edge. + Card *Card + // Pets holds the value of the pets edge. + Pets []*Pet + // Files holds the value of the files edge. + Files []*File + // Groups holds the value of the groups edge. + Groups []*Group + // Friends holds the value of the friends edge. + Friends []*User + // Followers holds the value of the followers edge. + Followers []*User + // Following holds the value of the following edge. + Following []*User + // Team holds the value of the team edge. + Team *Pet + // Spouse holds the value of the spouse edge. + Spouse *User + // Children holds the value of the children edge. + Children []*User + // Parent holds the value of the parent edge. + Parent *User } // FromResponse scans the gremlin response data into User. diff --git a/entc/integration/idtype/ent/user.go b/entc/integration/idtype/ent/user.go index e2e8e08fd..b6493e1cd 100644 --- a/entc/integration/idtype/ent/user.go +++ b/entc/integration/idtype/ent/user.go @@ -23,17 +23,20 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Spouse holds the value of the spouse edge. - Spouse *User - // Followers holds the value of the followers edge. - Followers []*User - // Following holds the value of the following edge. - Following []*User - } `json:"edges"` + Edges UserEdges `json:"edges"` user_spouse_id *uint64 } +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Spouse holds the value of the spouse edge. + Spouse *User + // Followers holds the value of the followers edge. + Followers []*User + // Following holds the value of the following edge. + Following []*User +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/migrate/entv1/car.go b/entc/integration/migrate/entv1/car.go index 7718271fe..d4a64e8d8 100644 --- a/entc/integration/migrate/entv1/car.go +++ b/entc/integration/migrate/entv1/car.go @@ -21,13 +21,16 @@ type Car struct { ID int `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CarQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges CarEdges `json:"edges"` owner_id *int } +// CarEdges holds the relations/edges for other nodes in the graph. +type CarEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Car) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/migrate/entv1/user.go b/entc/integration/migrate/entv1/user.go index 9574ea444..0749757af 100644 --- a/entc/integration/migrate/entv1/user.go +++ b/entc/integration/migrate/entv1/user.go @@ -35,20 +35,23 @@ type User struct { State user.State `json:"state,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Parent holds the value of the parent edge. - Parent *User - // Children holds the value of the children edge. - Children []*User - // Spouse holds the value of the spouse edge. - Spouse *User - // Car holds the value of the car edge. - Car *Car - } `json:"edges"` + Edges UserEdges `json:"edges"` parent_id *int user_spouse_id *int } +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Parent holds the value of the parent edge. + Parent *User + // Children holds the value of the children edge. + Children []*User + // Spouse holds the value of the spouse edge. + Spouse *User + // Car holds the value of the car edge. + Car *Car +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/migrate/entv2/car.go b/entc/integration/migrate/entv2/car.go index 647dabbb9..006fd6ef7 100644 --- a/entc/integration/migrate/entv2/car.go +++ b/entc/integration/migrate/entv2/car.go @@ -21,13 +21,16 @@ type Car struct { ID int `json:"id,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CarQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges CarEdges `json:"edges"` owner_id *int } +// CarEdges holds the relations/edges for other nodes in the graph. +type CarEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Car) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/migrate/entv2/user.go b/entc/integration/migrate/entv2/user.go index 5c6004c8e..2e7708d8d 100644 --- a/entc/integration/migrate/entv2/user.go +++ b/entc/integration/migrate/entv2/user.go @@ -39,10 +39,13 @@ type User struct { State user.State `json:"state,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Car holds the value of the car edge. - Car []*Car - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Car holds the value of the car edge. + Car []*Car } // scanValues returns the types for scanning values from sql.Rows. diff --git a/entc/integration/template/ent/pet.go b/entc/integration/template/ent/pet.go index 7ea0039fe..902263b26 100644 --- a/entc/integration/template/ent/pet.go +++ b/entc/integration/template/ent/pet.go @@ -26,13 +26,16 @@ type Pet struct { LicensedAt *time.Time `json:"licensed_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PetQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges PetEdges `json:"edges"` owner_id *int } +// PetEdges holds the relations/edges for other nodes in the graph. +type PetEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Pet) scanValues() []interface{} { return []interface{}{ diff --git a/entc/integration/template/ent/user.go b/entc/integration/template/ent/user.go index dd0b53fa3..d6d566b23 100644 --- a/entc/integration/template/ent/user.go +++ b/entc/integration/template/ent/user.go @@ -23,12 +23,15 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Pets holds the value of the pets edge. - Pets []*Pet - // Friends holds the value of the friends edge. - Friends []*User - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Pets holds the value of the pets edge. + Pets []*Pet + // Friends holds the value of the friends edge. + Friends []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/edgeindex/ent/city.go b/examples/edgeindex/ent/city.go index 2dd883980..754fe5d7f 100644 --- a/examples/edgeindex/ent/city.go +++ b/examples/edgeindex/ent/city.go @@ -23,10 +23,13 @@ type City struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CityQuery when eager-loading is set. - Edges struct { - // Streets holds the value of the streets edge. - Streets []*Street - } `json:"edges"` + Edges CityEdges `json:"edges"` +} + +// CityEdges holds the relations/edges for other nodes in the graph. +type CityEdges struct { + // Streets holds the value of the streets edge. + Streets []*Street } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/edgeindex/ent/street.go b/examples/edgeindex/ent/street.go index 0505b2350..15523ce01 100644 --- a/examples/edgeindex/ent/street.go +++ b/examples/edgeindex/ent/street.go @@ -23,13 +23,16 @@ type Street struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the StreetQuery when eager-loading is set. - Edges struct { - // City holds the value of the city edge. - City *City - } `json:"edges"` + Edges StreetEdges `json:"edges"` city_id *int } +// StreetEdges holds the relations/edges for other nodes in the graph. +type StreetEdges struct { + // City holds the value of the city edge. + City *City +} + // scanValues returns the types for scanning values from sql.Rows. func (*Street) scanValues() []interface{} { return []interface{}{ diff --git a/examples/m2m2types/ent/group.go b/examples/m2m2types/ent/group.go index 14fa290ae..8565c7eda 100644 --- a/examples/m2m2types/ent/group.go +++ b/examples/m2m2types/ent/group.go @@ -23,10 +23,13 @@ type Group struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Users holds the value of the users edge. - Users []*User - } `json:"edges"` + Edges GroupEdges `json:"edges"` +} + +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Users holds the value of the users edge. + Users []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/m2m2types/ent/user.go b/examples/m2m2types/ent/user.go index b00d88dad..706822081 100644 --- a/examples/m2m2types/ent/user.go +++ b/examples/m2m2types/ent/user.go @@ -25,10 +25,13 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Groups holds the value of the groups edge. - Groups []*Group - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Groups holds the value of the groups edge. + Groups []*Group } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/m2mbidi/ent/user.go b/examples/m2mbidi/ent/user.go index 3bfd0d3fe..e217413e4 100644 --- a/examples/m2mbidi/ent/user.go +++ b/examples/m2mbidi/ent/user.go @@ -25,10 +25,13 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Friends holds the value of the friends edge. - Friends []*User - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Friends holds the value of the friends edge. + Friends []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/m2mrecur/ent/user.go b/examples/m2mrecur/ent/user.go index 17dddc558..216cfd207 100644 --- a/examples/m2mrecur/ent/user.go +++ b/examples/m2mrecur/ent/user.go @@ -25,12 +25,15 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Followers holds the value of the followers edge. - Followers []*User - // Following holds the value of the following edge. - Following []*User - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Followers holds the value of the followers edge. + Followers []*User + // Following holds the value of the following edge. + Following []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/o2m2types/ent/pet.go b/examples/o2m2types/ent/pet.go index b7564e36e..a31c5b7fd 100644 --- a/examples/o2m2types/ent/pet.go +++ b/examples/o2m2types/ent/pet.go @@ -23,13 +23,16 @@ type Pet struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PetQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges PetEdges `json:"edges"` owner_id *int } +// PetEdges holds the relations/edges for other nodes in the graph. +type PetEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Pet) scanValues() []interface{} { return []interface{}{ diff --git a/examples/o2m2types/ent/user.go b/examples/o2m2types/ent/user.go index ec30d7571..debd14e6f 100644 --- a/examples/o2m2types/ent/user.go +++ b/examples/o2m2types/ent/user.go @@ -25,10 +25,13 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Pets holds the value of the pets edge. - Pets []*Pet - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Pets holds the value of the pets edge. + Pets []*Pet } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/o2mrecur/ent/node.go b/examples/o2mrecur/ent/node.go index 75e836012..146bf41ea 100644 --- a/examples/o2mrecur/ent/node.go +++ b/examples/o2mrecur/ent/node.go @@ -23,15 +23,18 @@ type Node struct { Value int `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeQuery when eager-loading is set. - Edges struct { - // Parent holds the value of the parent edge. - Parent *Node - // Children holds the value of the children edge. - Children []*Node - } `json:"edges"` + Edges NodeEdges `json:"edges"` parent_id *int } +// NodeEdges holds the relations/edges for other nodes in the graph. +type NodeEdges struct { + // Parent holds the value of the parent edge. + Parent *Node + // Children holds the value of the children edge. + Children []*Node +} + // scanValues returns the types for scanning values from sql.Rows. func (*Node) scanValues() []interface{} { return []interface{}{ diff --git a/examples/o2o2types/ent/card.go b/examples/o2o2types/ent/card.go index 402fecc42..d952cc8c8 100644 --- a/examples/o2o2types/ent/card.go +++ b/examples/o2o2types/ent/card.go @@ -26,13 +26,16 @@ type Card struct { Number string `json:"number,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CardQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges CardEdges `json:"edges"` owner_id *int } +// CardEdges holds the relations/edges for other nodes in the graph. +type CardEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Card) scanValues() []interface{} { return []interface{}{ diff --git a/examples/o2o2types/ent/user.go b/examples/o2o2types/ent/user.go index 7b3f31fe3..bb299b9ab 100644 --- a/examples/o2o2types/ent/user.go +++ b/examples/o2o2types/ent/user.go @@ -25,10 +25,13 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Card holds the value of the card edge. - Card *Card - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Card holds the value of the card edge. + Card *Card } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/o2obidi/ent/user.go b/examples/o2obidi/ent/user.go index 7a184d4b7..b12f22f54 100644 --- a/examples/o2obidi/ent/user.go +++ b/examples/o2obidi/ent/user.go @@ -25,13 +25,16 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Spouse holds the value of the spouse edge. - Spouse *User - } `json:"edges"` + Edges UserEdges `json:"edges"` user_spouse_id *int } +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Spouse holds the value of the spouse edge. + Spouse *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues() []interface{} { return []interface{}{ diff --git a/examples/o2orecur/ent/node.go b/examples/o2orecur/ent/node.go index 5f0b40567..4f3f3a5b8 100644 --- a/examples/o2orecur/ent/node.go +++ b/examples/o2orecur/ent/node.go @@ -23,15 +23,18 @@ type Node struct { Value int `json:"value,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the NodeQuery when eager-loading is set. - Edges struct { - // Prev holds the value of the prev edge. - Prev *Node - // Next holds the value of the next edge. - Next *Node - } `json:"edges"` + Edges NodeEdges `json:"edges"` prev_id *int } +// NodeEdges holds the relations/edges for other nodes in the graph. +type NodeEdges struct { + // Prev holds the value of the prev edge. + Prev *Node + // Next holds the value of the next edge. + Next *Node +} + // scanValues returns the types for scanning values from sql.Rows. func (*Node) scanValues() []interface{} { return []interface{}{ diff --git a/examples/start/ent/car.go b/examples/start/ent/car.go index 0f12c03da..5c606d594 100644 --- a/examples/start/ent/car.go +++ b/examples/start/ent/car.go @@ -26,13 +26,16 @@ type Car struct { RegisteredAt time.Time `json:"registered_at,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the CarQuery when eager-loading is set. - Edges struct { - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges CarEdges `json:"edges"` owner_id *int } +// CarEdges holds the relations/edges for other nodes in the graph. +type CarEdges struct { + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Car) scanValues() []interface{} { return []interface{}{ diff --git a/examples/start/ent/group.go b/examples/start/ent/group.go index 57412fa9f..7ba7993f7 100644 --- a/examples/start/ent/group.go +++ b/examples/start/ent/group.go @@ -23,10 +23,13 @@ type Group struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Users holds the value of the users edge. - Users []*User - } `json:"edges"` + Edges GroupEdges `json:"edges"` +} + +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Users holds the value of the users edge. + Users []*User } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/start/ent/user.go b/examples/start/ent/user.go index 9c252ab86..a79b51bec 100644 --- a/examples/start/ent/user.go +++ b/examples/start/ent/user.go @@ -25,12 +25,15 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Cars holds the value of the cars edge. - Cars []*Car - // Groups holds the value of the groups edge. - Groups []*Group - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Cars holds the value of the cars edge. + Cars []*Car + // Groups holds the value of the groups edge. + Groups []*Group } // scanValues returns the types for scanning values from sql.Rows. diff --git a/examples/traversal/ent/group.go b/examples/traversal/ent/group.go index 294be03b9..a87c86d37 100644 --- a/examples/traversal/ent/group.go +++ b/examples/traversal/ent/group.go @@ -23,15 +23,18 @@ type Group struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the GroupQuery when eager-loading is set. - Edges struct { - // Users holds the value of the users edge. - Users []*User - // Admin holds the value of the admin edge. - Admin *User - } `json:"edges"` + Edges GroupEdges `json:"edges"` admin_id *int } +// GroupEdges holds the relations/edges for other nodes in the graph. +type GroupEdges struct { + // Users holds the value of the users edge. + Users []*User + // Admin holds the value of the admin edge. + Admin *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Group) scanValues() []interface{} { return []interface{}{ diff --git a/examples/traversal/ent/pet.go b/examples/traversal/ent/pet.go index a4278fa0e..40b70af37 100644 --- a/examples/traversal/ent/pet.go +++ b/examples/traversal/ent/pet.go @@ -23,15 +23,18 @@ type Pet struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the PetQuery when eager-loading is set. - Edges struct { - // Friends holds the value of the friends edge. - Friends []*Pet - // Owner holds the value of the owner edge. - Owner *User - } `json:"edges"` + Edges PetEdges `json:"edges"` owner_id *int } +// PetEdges holds the relations/edges for other nodes in the graph. +type PetEdges struct { + // Friends holds the value of the friends edge. + Friends []*Pet + // Owner holds the value of the owner edge. + Owner *User +} + // scanValues returns the types for scanning values from sql.Rows. func (*Pet) scanValues() []interface{} { return []interface{}{ diff --git a/examples/traversal/ent/user.go b/examples/traversal/ent/user.go index 27b69a1e9..e1c0a34b3 100644 --- a/examples/traversal/ent/user.go +++ b/examples/traversal/ent/user.go @@ -25,16 +25,19 @@ type User struct { Name string `json:"name,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the UserQuery when eager-loading is set. - Edges struct { - // Pets holds the value of the pets edge. - Pets []*Pet - // Friends holds the value of the friends edge. - Friends []*User - // Groups holds the value of the groups edge. - Groups []*Group - // Manage holds the value of the manage edge. - Manage []*Group - } `json:"edges"` + Edges UserEdges `json:"edges"` +} + +// UserEdges holds the relations/edges for other nodes in the graph. +type UserEdges struct { + // Pets holds the value of the pets edge. + Pets []*Pet + // Friends holds the value of the friends edge. + Friends []*User + // Groups holds the value of the groups edge. + Groups []*Group + // Manage holds the value of the manage edge. + Manage []*Group } // scanValues returns the types for scanning values from sql.Rows.