diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index b4d14f700..f8a7a4959 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -186,7 +186,7 @@ func templateBuilderDeleteTmpl() (*asset, error) { return a, nil } -var _templateBuilderMutationTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x5b\x5b\x73\xdb\x36\xf6\x7f\x26\x3f\xc5\xa9\x26\xcd\x88\xfe\xab\x54\xda\xb7\xbf\xbb\x7a\xc8\xc6\xe9\xae\x67\x76\x93\x9d\xc6\xdd\x17\x8f\xa7\xa5\x09\x48\xc2\x98\x22\x59\x00\x92\xed\xd1\xea\xbb\xef\xe0\x00\x20\x01\xde\x44\x29\x4e\xd3\xed\x43\xc7\x22\x71\x39\x97\xdf\xb9\x33\xfb\xfd\xfc\x22\x7c\x57\x94\xcf\x9c\xad\xd6\x12\x7e\x78\xf3\xfd\xff\x7f\x57\x72\x2a\x68\x2e\xe1\xa7\x24\xa5\xf7\x45\xf1\x00\xd7\x79\x1a\xc3\xdb\x2c\x03\x5c\x24\x40\xbd\xe7\x3b\x4a\xe2\xf0\x66\xcd\x04\x88\x62\xcb\x53\x0a\x69\x41\x28\x30\x01\x19\x4b\x69\x2e\x28\x81\x6d\x4e\x28\x07\xb9\xa6\xf0\xb6\x4c\xd2\x35\x85\x1f\xe2\x37\xf6\x2d\x2c\x8b\x6d\x4e\x42\x96\xe3\xfb\x7f\x5c\xbf\x7b\xff\xe1\xd3\x7b\x58\xb2\x8c\x82\x79\xc6\x8b\x42\x02\x61\x9c\xa6\xb2\xe0\xcf\x50\x2c\x41\x3a\x97\x49\x4e\x69\x1c\x5e\xcc\x0f\x87\x30\xdc\xef\x81\xd0\x25\xcb\x29\x4c\x36\x5b\x99\x48\x56\xe4\x13\x30\x2f\x5e\x95\x0f\x2b\xb8\x5c\xc0\x7d\x22\x28\xbc\x8a\xdf\x15\xf9\x92\xad\xe2\x7f\x25\xe9\x43\xb2\xa2\x6a\xd1\x7e\x0f\x92\x6e\xca\x2c\x91\x14\x26\x6b\x9a\x10\xca\x27\xf0\x0a\xb7\xb3\x4d\x59\x70\x09\xd3\x30\xd8\xef\xbf\x03\x9e\xe4\x2b\x0a\xaf\x72\x75\xda\xab\xf8\x43\x41\xa8\x50\xab\x82\x60\xa2\xae\x69\x9f\x3c\x57\x8f\x73\xe7\xc1\x44\x9f\x43\x73\x82\xa7\x07\x93\x15\x93\xeb\xed\x7d\x9c\x16\x9b\xf9\xd2\x88\x9a\xe5\xe9\xf6\x3e\x91\x05\x9f\xd3\x5c\x4e\xc2\x28\x0c\xd3\x22\x17\x48\xc3\x7c\x0e\x1f\x4b\xca\x91\x3d\x90\xcf\x25\x15\x71\x18\x7c\x2c\xdf\x71\xaa\x48\x07\x80\x05\xd0\x5c\xc6\xf6\x89\x7a\x77\x45\x33\xea\xbf\xd3\x4f\xea\x77\x1f\x73\xda\x78\xf7\x31\xc7\xd7\xbf\x94\xa4\x71\xac\x7e\x52\xbf\x73\xb7\x56\x4f\x42\xa4\x53\x09\xa7\x22\x71\x50\x76\x37\xcf\x25\xd5\x72\xfa\x90\x6c\x94\x90\x60\x01\x13\xef\x81\x2f\xb5\x08\x95\xda\x73\x1c\xea\xdb\x22\x00\xdf\xe5\xf1\x3f\xcd\x4f\x73\x5a\x38\x9f\x83\xb7\xea\x70\x00\x4e\x0d\xe0\x05\x24\x39\x14\xb5\x8c\xd7\x89\x04\x5c\x48\x11\x90\xfb\x3d\x94\xd9\x96\x27\x99\x43\x9d\x3a\x2f\xc7\xfb\x0d\x6a\x57\x3c\x29\xd7\x71\xa8\x98\x6f\x5d\x24\x24\xdf\xa6\x12\xf6\x61\x90\x22\x58\xc2\xa0\x28\xe1\x63\x19\x06\xf2\xb9\x54\x2f\x59\xbe\x52\xcc\xaa\xe3\xaf\xaf\xe2\xbf\x6e\x59\x46\x28\xff\x89\xd1\x4c\xb1\x0e\x17\xd5\x1b\x25\x34\x14\x9f\x23\xda\xa5\xe1\x17\x97\x1b\xe1\xaa\x0d\xcb\xee\x73\x96\xf5\x21\x78\x0a\x5b\xda\x67\xf1\x87\xed\x86\x72\x96\xea\x77\x41\x42\xc8\x09\xc7\x18\x2d\x79\x7f\xa7\x19\x4d\x38\x25\x86\xb0\x4d\x52\xde\x6a\x56\xef\xb4\x38\xf6\x3e\x1f\xd4\xf0\xf1\x9e\xac\xa8\xf0\xe9\xa3\xf1\x2f\x39\xfb\x7d\x8b\xd7\x81\xf3\x9f\x22\x84\x76\xd3\x47\x35\x4b\xae\xcc\x02\x4b\x50\xf7\xb6\xfb\xa2\xc8\x2c\x33\x99\x18\x79\x97\x62\xaa\xf3\x3a\x87\xc7\x20\xe0\x74\x53\xec\xfa\xee\x1d\x75\x44\x8f\x88\x0f\x61\xb8\x4b\x38\xfc\x8a\xc6\x68\x01\x0f\x0b\x98\x5e\x34\x10\x18\x4d\x73\x96\x45\x21\x82\x96\x3e\x36\xe1\x99\xa2\xdf\x10\xea\x15\x54\xcf\x97\x05\xb7\x70\x8f\xc3\xe5\x36\x4f\x3b\x76\x4e\x53\xd0\x80\x9e\x01\x02\x3a\x82\xe6\xc5\x0a\xf3\x9c\xca\x2d\xcf\xe1\x75\xe3\xd5\x3e\x0c\x8c\x39\x5c\x5a\x21\xa7\xb3\x30\x08\x8a\xf2\xd2\x15\x7c\x51\xaa\x87\xf2\xd9\x7b\xda\xf2\x1e\x6a\x8d\x87\xb7\x4b\xd8\x24\x0f\x74\xda\x81\xba\x68\x16\x06\x28\xba\xf9\x1c\xde\x65\x4c\xc5\x3b\x4d\xa1\x80\x04\x45\xf0\x9b\x92\xa6\x7e\xf3\x1b\x2c\x79\xb1\x41\xfb\xb6\x94\xc7\x70\xbd\xf4\x1e\xc0\x63\x22\xd4\x59\xf4\x89\xa6\x5b\x49\x89\x72\x08\x09\x48\x9e\xe4\x22\x49\x71\xc1\x54\x1d\x78\xf3\x14\xcd\xfc\xe7\x49\x06\xa9\xbe\x9f\x09\x43\x82\x8a\xac\x28\xeb\xe9\xa6\xe9\x44\x22\x43\xec\x34\x82\x0b\x43\xb6\xf2\x27\xfa\xaf\xcb\x05\xbc\xd6\x0f\xf7\x56\xa4\x9b\x58\xff\x75\xb0\x8b\x62\x96\x33\x39\x8d\x2a\x7d\xe8\xa7\x46\x10\x37\x4f\xb5\x10\x72\x2d\x81\x9b\xa7\xdf\x10\x04\x96\x06\xa1\xfd\xe2\x23\xe5\xd4\xe3\xd5\xe1\x48\xfc\xa8\xce\x62\xd2\x3d\x8b\x72\x5e\x70\x28\xe4\x9a\xf2\x47\x26\xe8\x00\x7f\x37\x4f\xd3\x08\xa6\x17\x37\x4f\x33\xbd\x29\x52\x0c\xb2\x25\x04\xbf\xce\xa0\x78\x50\x3c\x6e\x62\xc2\xd9\x8e\xf2\x78\x7a\x21\x9f\xae\xf0\xcf\xe8\x47\xf8\xa6\x78\x50\x2b\x2d\x5f\x39\xcb\x66\xb0\xdc\xc8\xf8\xbd\x3a\x64\x39\x9d\xd8\x64\xe0\x70\xb8\xac\x95\xc6\x04\xe4\x85\x04\xbe\xcd\x73\x96\xaf\x5a\x3a\x9b\x44\x0a\x24\x81\x7c\x42\xd1\xde\x3c\x75\x89\x55\x3e\x35\x45\x2a\x9f\x66\xea\xfa\x10\x23\x92\xf6\x5d\xe8\xb7\x7f\x11\x94\x5f\x61\xa2\xa2\x4d\x78\x3e\x87\x4f\x54\x5e\x5f\x81\xa0\x52\x20\x98\x76\x49\xb6\xa5\x3a\xd5\xa1\xc0\x08\x2c\x15\x88\x63\xf8\x50\x60\x08\x4a\xe4\x0c\x73\x20\xdc\x59\xc7\x29\x26\x20\x49\x53\x5a\x2a\x45\x14\x79\xf6\x0c\x45\x0e\x7e\x4c\x45\xcb\x56\xa0\x0d\x03\x2b\xf6\x96\x6b\xd0\xa4\x4c\x19\x81\x66\x9c\x41\x05\x04\x9b\xb8\x37\x32\x2d\xe0\x35\x23\x4a\x50\x6e\x7a\x33\x9f\xc3\xf5\x55\x85\x00\xc3\x8f\xe6\xcf\x84\xca\xda\x94\x3c\xfe\xd4\x42\xc4\x8f\x80\x64\x97\xb0\x2c\xb9\xcf\xa8\xe6\x8b\x2d\x15\xa8\x1e\x13\x01\x25\x2f\x76\x8c\x50\x02\xb2\xc0\x1d\xf7\x9a\xa2\x1a\x55\x6d\xf6\xae\xaf\x14\xac\x3a\xd8\x9b\x01\x7d\x62\x42\x0a\x74\xfd\x16\x6c\x43\xdc\x2e\x94\x72\x1d\xa8\x21\x44\x8c\xea\x2f\xfa\x37\xce\x40\xf2\x2d\xd5\xa0\x18\x88\xda\x08\x53\xf5\x98\xd3\x94\x2a\x68\x57\x81\xf9\x13\x3a\x30\xe5\x32\xf7\x4a\x14\xf4\x77\xb5\x70\xb2\x99\xa0\x7f\xc5\x5d\x0b\x98\xa0\x84\xed\xa3\x3a\x56\xc0\x2b\x94\xcc\xe5\x02\x4a\xce\x72\x09\x93\x4f\x54\x4e\xd4\xc9\x9f\xd0\x1d\x5a\x1a\xf5\x52\x9d\x72\x56\x6b\x9d\x24\x76\x12\xe3\xa6\x77\x6a\x41\x92\x4b\x8b\xe2\xea\x7c\x95\xe4\x58\x2c\xeb\xfc\xc0\x42\x50\x23\x79\x08\x7f\xce\x21\x53\xcd\x8e\xe1\x6b\xd9\x05\xc4\x76\x42\xb2\xd0\xa1\xa5\xac\x93\x86\xf9\x85\xa2\x46\x2a\xa1\xe5\x26\xa9\xc1\xbc\xac\xd8\x51\xce\x19\xa1\x50\x72\xba\x63\xc5\x56\x40\x9a\x64\x99\x50\x60\x7a\x4b\x48\x0c\x58\x55\x1c\xc9\x8b\x36\x71\x6f\x66\x84\xf8\x68\x44\xeb\x43\x58\x0b\xaa\x0a\xd1\x7f\xa3\x52\xe7\x9f\xb5\x8d\xf8\x42\xeb\x36\x97\xa3\x42\x6c\x5c\xa0\x70\xcf\x7d\x49\xb6\x31\x1f\xec\xb4\x67\xed\x64\x29\x0c\x94\x4d\xec\x5c\xe8\x57\xd8\x57\xe0\xaf\xd0\xbf\x33\x20\x47\x7e\x35\x4c\x93\x9c\x74\x8b\xb0\x03\x94\x6f\x09\xe9\x04\x65\x13\x63\x09\x21\x02\x2a\x8c\xc8\xc2\x17\x5b\x1c\x06\x2f\x00\x33\xed\x05\x7a\x95\xfc\x8d\x23\x8a\xe0\x62\x60\xe1\xff\x2d\xc0\x81\x65\x70\xd0\x69\xa5\xde\x37\x08\xa2\xd7\xde\x36\x14\xb4\x96\xc4\x5b\x42\xa8\xd9\xe5\x0b\xca\x43\x92\xc6\x8e\x8e\xd5\x89\x50\x22\xab\xdd\x65\x87\x69\x6a\x94\x31\xe1\xc2\x6c\x40\x8a\xbd\x34\x8c\x03\x9b\x45\x5b\x1f\xfb\x46\xfe\x3e\xe2\x6a\xc8\x05\x87\x1a\x81\x0e\xe8\x02\xed\xbf\xaa\x02\x5b\x03\xf0\xd5\x32\xfe\x58\x9a\x44\xab\x0f\x78\xef\x54\xce\x38\x0a\x7a\x98\x5d\x36\x82\xf5\x99\xe8\x33\xa2\xe8\xf7\x67\xda\x8d\x0c\xfb\xa1\x31\x8e\xc8\xf3\x44\x6a\x87\x97\x22\xdf\xd6\x2e\xff\x70\xb8\x83\x05\xd8\x0c\x79\x5f\x81\xae\xa2\xba\x0a\x09\xbe\xa0\xb4\xfc\x28\x99\x74\x8a\xcc\xa2\x92\xe9\xb4\x46\xc3\xcd\x87\xa0\x42\xa8\x21\xea\x44\x20\xfa\x02\x55\x08\xd3\x52\x75\x92\xc5\x01\x6e\x1d\x18\x15\x0f\x9d\x00\xf2\xf9\x9e\xfc\x4c\x45\x4f\xe0\x6c\x31\x2d\xa8\x84\x24\xcb\x20\x5d\xab\x58\x2f\x6c\x56\xf7\x39\x61\xf1\x58\x00\xac\xe3\xce\x4b\xc5\x2d\xe7\x30\xdf\x88\x02\x82\xdd\xa2\x69\x43\xbc\x33\x70\xe5\x1b\xb5\xa2\xa0\x23\x5d\x27\x0d\x6a\x17\xfd\xea\x94\x02\xd3\xa0\x49\x42\x10\x57\xc6\x98\x9d\x26\x80\x59\xb3\x80\x09\xea\x04\x1f\xb8\x19\x0f\x23\xe2\x27\xcf\xcc\xa7\x65\x22\xd2\x24\x53\xbb\x22\x98\x0a\x96\xaf\xb6\x59\xc2\xd5\x99\xa8\x8e\xff\x80\x7e\x1f\xc1\xe4\xfa\x4a\xf4\xdf\x69\xcf\xed\x3e\xd6\xfe\xd0\x87\xe2\x59\x0d\xda\x0c\x52\xec\x31\x26\xfc\x14\xca\xd5\xd7\x49\x00\xad\x20\x42\xc9\x8a\xda\x18\x67\xba\x03\xf6\xd5\xfd\x33\x30\xa2\x89\x54\x55\x8c\x4b\xa8\xa8\x2e\x3c\x8a\xae\x9a\x90\x69\x9b\x61\x3c\xdf\x74\x42\x18\x11\x10\xc7\x71\x75\x32\x74\x36\x2c\x34\x48\xbb\x9a\x36\x95\xb3\x6b\xb7\x3f\x4c\x09\xe1\xf5\x5d\x6c\x0c\xee\xd9\xe1\x46\x86\xfe\x63\xab\xf2\x7f\xb8\xb9\x12\x55\x51\x45\xd5\xba\x0c\xf3\x6f\xc4\xa6\xe2\x79\xf0\x8e\x5b\x46\xc4\x2d\xbb\x6b\x39\xce\xa0\xd9\xb0\x39\x54\x01\xc9\x97\xc9\x40\x38\xa2\xa7\x84\xa3\xb1\xa8\x39\x23\x40\x0d\x76\xcc\x16\x75\xf4\xed\x0c\x15\xf4\xfc\x50\x81\x4c\xf8\x7c\x39\x91\xe2\xbc\xc0\x60\xdc\xfd\x30\x53\x4e\xb6\xa5\xdf\xfb\x7a\x68\x14\xb6\x3e\x85\x8c\x74\x64\xec\x47\x08\x6d\x5f\xe0\x14\xab\x2d\xd4\x76\x25\x54\x03\x96\xf2\x4d\x3b\x87\xb2\x75\x6a\x6b\x71\x95\x4a\xb9\x29\x56\x1d\x18\x2b\xcb\xac\xaa\xd4\xac\x78\xa4\x1c\xa6\xa8\xeb\x25\x4c\xbe\x8d\xbf\x17\x13\x0f\x71\x51\xbd\xa1\xe5\x90\x27\x3f\x63\x4b\x74\x32\xca\x19\xd7\xea\x70\x3c\xa7\xee\xa9\x9e\xe3\x36\xc5\x71\xad\x38\x8e\xb1\x76\x7d\x7d\x0e\x4f\x6b\x60\xb0\xc7\xdb\x70\x59\xc3\x6b\x4f\xf7\x5c\x3d\x2e\xf7\xc8\x4d\xb7\x8c\xb4\x7d\x57\xc3\x0d\xf7\x3b\xc5\xe3\x87\x77\x3b\xc7\x9a\xe2\x2a\xd3\xf0\xdd\x47\x13\x23\x64\x94\x3b\x74\xad\xd2\xd0\x85\xc4\x9a\x24\xfd\x74\x1f\x78\x7d\x25\xb4\x25\x0a\xb8\xbd\x1b\xd2\x3e\x4a\x88\xd4\x22\x3a\xa2\x5e\x2d\x3d\x75\xec\x02\x92\xb2\xa4\x39\x51\x77\xcc\x80\x91\xa8\xd7\xf8\x6c\x56\xda\xeb\x94\xc4\xa0\x57\x12\x6d\xb7\xa4\x27\x1a\x5d\xa8\xc1\x21\x9e\x69\xca\xe1\xde\x24\x7b\x4c\x9e\xeb\x0b\x32\x9a\x2b\x82\x23\xf8\xcb\x02\xbe\xc7\xfe\xf0\x56\xef\x56\x66\x27\x66\x58\xf5\x3f\x17\x5b\x10\xeb\x62\x9b\x11\xd8\x0a\x3a\xe8\x4d\x59\x2e\x24\x4d\x48\x0c\xd7\xd2\xfa\x36\xec\xf8\xa1\x54\x73\x49\xb9\xca\x3b\xb7\x22\x59\x51\x65\xbc\x4e\xc7\xcf\x0e\x18\x2d\x8a\x4e\x75\xb3\x63\xb4\xab\xa4\xd4\x67\x5c\x6c\x69\xb4\xde\xe3\x4f\x7f\x54\xaf\x3d\x07\xdc\xd6\xf9\x85\xa3\xf4\x86\xe1\xb5\x51\x75\x36\x9c\x8c\x94\x0e\x07\xaf\x6f\x19\x76\x36\x07\x6d\x95\xd3\x36\xb8\x53\xaa\x1c\xdf\x17\x9f\x55\xe4\x74\xf9\x45\xbf\xc8\x69\xe5\x97\x47\x72\x95\x65\x92\x21\x16\x1b\x82\x3e\xea\x8d\xbb\x5a\x7a\x6e\x31\x83\xd3\x79\xcf\xfe\xea\x06\x7d\x5e\x0f\xcf\x3a\xb9\xff\x58\x4e\xd5\xff\x9c\x21\xd9\x26\x2e\x4a\x3b\x92\x51\x40\x74\xcf\xcd\xed\x70\xbd\xfa\x24\xa2\x3a\x0c\x1b\x5a\x55\xdb\x3f\x1a\xba\x53\x1d\x3b\x8d\xcc\xd4\xd9\xbb\x59\x3e\xdb\xab\x4d\x57\xba\x9a\xe2\x64\x99\xae\x57\xdd\x11\x90\xd6\x3b\x01\xb2\xc5\xf1\xf5\x7c\xde\x28\xde\xdd\xde\x3e\xcb\xa1\xe0\xf8\x49\x48\x01\x2b\x83\x1b\xd3\x98\x55\x1b\x5b\x67\xb3\x7c\x4e\x68\xca\xe9\x86\xe6\x92\x92\x19\x76\x69\x75\xe7\x49\x53\x36\x1d\xe4\xd0\xae\x81\xdb\xbb\x9a\x4b\x73\xc7\xa5\x09\xaf\xf6\xd5\x0c\xde\x60\xe5\x9a\xd1\xdc\x6b\xc7\x47\x23\x66\xec\xdf\x9d\xda\x30\xaf\x73\xb5\xe1\xb6\xa2\xa1\xb5\xb2\xe8\x65\x4f\x85\xdd\x98\xb7\x1b\x45\xea\xd5\xae\x26\x3b\xda\x83\xc5\x12\x12\xd3\x90\x79\x64\x72\xad\xbf\x60\x60\x3b\x6a\x31\xab\xf0\xb7\xa6\x20\x68\x5a\xe4\x04\xd3\x4d\x9a\xe4\x55\x5b\x9a\xb0\x14\x07\xc6\xa8\x31\x54\xbb\x39\x4a\x4f\x42\x55\x49\x2a\xa8\x9c\x41\xc1\x31\x6d\x57\xbf\xcd\x77\x3a\x26\x12\x89\x74\x4d\x37\xc9\x51\x25\x4e\x15\x31\x06\xaa\x91\x1e\xa3\xfe\x5b\x91\x30\xab\x13\x60\xf1\xc8\x64\xba\x46\xaa\xd5\xcf\x2f\xa0\xb4\x34\x11\xd4\x13\xfd\xa5\x53\x4d\x54\xfa\x6c\x76\xde\xc3\x66\x09\xe8\x4d\x27\xd1\x17\x69\x0d\x7d\xa2\xc6\xcb\x36\x66\x81\x2a\x02\x34\xb4\xa2\x82\x64\x3d\x59\xc5\x99\x33\x0e\x57\xbd\xfe\x1a\x73\xe5\x4d\x7c\x81\xa3\x46\xf4\x6a\x34\x58\xe5\x4b\x36\x4c\x6c\x12\x25\xc2\xfa\x08\xf5\x7c\x48\x37\x96\x64\x57\x3d\x33\x43\x76\xa5\xa3\xc8\x10\xf7\x15\x75\xb4\xb3\xad\x40\x24\x2d\x9e\xfa\xcd\x7e\x13\xc5\xed\xf4\xb8\x52\xa9\x3b\x3a\xde\xe6\xf4\xa9\xa4\xa9\xa4\x5a\x28\xf0\xed\x0d\xea\x45\x8b\xe9\x5b\x31\x31\x5c\xcf\x90\xb7\x3a\x81\xdb\xc4\x9f\xa8\xec\x6c\x92\xef\x22\x07\x3c\x18\x5a\xba\x61\xe2\x13\xf1\x90\x17\x8f\xcd\xd1\xae\x43\x83\xbe\x5c\xc3\xc9\xf1\x92\x9e\xff\xb6\x73\xb0\x0e\x5f\x5b\x39\x5a\xb5\xbf\xe0\xe0\xb8\x5e\xe3\xdd\x9b\x7d\xd9\x23\xe3\x81\x4e\x07\x5c\x0f\xc4\xff\x9e\x08\xaf\x35\xb9\x4b\xb8\x25\xcb\x6e\x30\x30\x18\x40\xc9\x91\xe6\xf8\x39\x20\x3a\x69\xf2\x33\xda\x49\x77\x55\x3c\xde\x0f\xdf\x6d\x37\xf2\x93\x1e\xa4\x34\x75\xed\xe7\x09\x46\x14\x8d\x41\x90\x1f\x54\x31\xee\xf2\x62\x33\x18\x06\xdc\x18\xd0\xf0\xfd\x3a\xe0\xb7\xdc\xff\x8b\xf8\xfe\x9a\xaf\x11\x01\xa0\x1f\x57\x0d\xb7\xf3\x55\x10\xd5\xed\x98\x9c\x66\xd4\xc0\x3c\x6d\x18\x36\xdd\xc1\xbf\x15\x5e\xde\x12\x83\x10\x1c\x9d\xfe\x4f\x84\x17\x4b\xf2\x97\x0b\x2f\xbd\x5a\x3e\x4b\xc9\x3d\x3a\x3e\x1e\x7d\xfc\xf0\xf3\x32\xf1\x27\xb0\xad\x9f\xb7\xa4\x1b\x56\x3a\x02\x79\x8e\xa5\xf7\x0b\xce\x53\xe2\x91\x17\x60\x1a\x71\x49\x7f\x6a\xe7\x7e\x0d\xea\x87\xa6\x4c\x7f\xeb\xd3\xae\x31\xf4\x1e\xb5\xfd\xd4\x40\xe4\x5d\x37\x14\x8a\xfc\xe9\xd6\xe7\xc6\xa2\xc6\xac\xec\x73\xe2\x10\xde\x60\xd8\x98\x7a\x51\xe5\x4f\x14\x82\x5c\x22\x9d\xcf\x28\x6d\xc1\x50\x97\x0a\x6c\xd9\x51\x28\xf4\x4f\x7e\x8f\x14\x06\x56\x2c\x5e\x78\xb0\xad\xfe\xde\x09\xb0\x5a\x7d\x17\x3a\x73\xdf\x43\x8d\x4c\x6d\x1f\xad\x21\xff\x97\x70\x93\x47\x61\xdb\x11\xfa\x2a\x67\x37\x80\xdd\xf3\xe3\xdd\xcb\xa0\xb6\x2f\xd6\x6d\x62\xe4\xaa\x3f\xc8\x35\xbc\xd1\xc9\x41\x6f\x8c\x73\x72\x5d\x4c\x87\x77\xc2\xc6\x97\x4d\xa5\xb0\x12\x73\x7b\x5b\x8d\xfe\x29\x70\xba\x4a\x38\xd1\xfe\x08\x43\x9d\x86\x87\x3e\xbc\x03\x24\xfd\x08\x41\xd7\x76\x2a\x48\x6a\x62\x7b\x40\xf2\xb5\x0a\xae\x4d\x8c\xa4\xf5\x6b\xfa\x4b\x17\x3e\xfa\x3b\x02\x37\xb8\xe0\x34\x48\xad\x73\xe3\x8a\xa0\x72\xae\xbf\x8b\x32\x9e\x47\x1d\x30\xba\xbc\xc1\x4b\x1a\x21\x05\xbb\xdf\xc7\xba\x4b\xf6\x2b\x87\xe8\xd8\x3f\x7c\x18\x39\xd3\x1b\xa3\x38\xda\x34\x53\x4d\x69\x15\x33\x4c\xdb\x7e\x5c\x6b\x09\x17\xbb\xf2\x76\x47\x0f\x4a\xda\x8c\x08\x98\xca\x42\x7f\xee\xad\xff\x7d\x4c\xe4\xc8\x5d\xcb\x7c\x59\x70\x5d\x3d\x58\xb7\x5a\xe9\xe8\xa8\xe8\xaf\xaf\x84\x0f\xf9\xdb\xbb\x2a\x23\x1c\x06\x7e\xcf\x3f\x2f\x39\x55\x7c\xdd\xb8\xef\x1b\xc0\x9d\x3e\x24\xb0\x92\x76\xf8\xda\x5f\x30\xd2\x1c\x9d\x39\x13\x3a\xe6\x75\x35\x9d\x0a\xe9\xcd\x0c\x87\x35\x3d\x57\x47\x51\x3d\xdf\x1b\x3d\x67\xe8\x1f\x34\x98\xb4\xd3\x50\xcf\x54\x16\x31\x26\xad\x34\x1f\xcb\xa3\x03\xc6\x2e\xfc\x48\x03\xae\x46\x7c\xa7\x99\xaf\x7b\xc9\x17\x35\x60\x03\x88\xe6\xb7\x39\xe3\xa6\xc5\x1e\x20\xce\xb2\xf1\x91\x46\xde\xfa\x52\xe5\x88\xc9\x1b\xf1\x9d\x68\xf4\x56\x57\xe7\x99\x7d\x7d\xe7\xcb\x1a\x7e\x8f\x76\xce\x12\x77\x4f\xe2\x73\xdc\x32\x87\x60\xd0\x6b\xa0\x23\xc6\xcb\xa7\xd9\xe9\x29\x66\x6a\x12\xef\x91\x66\xda\xc8\xef\xc7\x9a\xa9\x7b\xc9\x1f\x61\xa6\x9d\x26\x3a\x38\x4e\xfc\xf3\xd9\xa6\xe2\xea\x94\x3a\x0c\xf5\xf5\x19\x65\x98\x73\x5f\x77\x15\x76\x8e\x45\x7e\x49\x6b\x1c\xfb\xf9\xd7\x88\x5e\x88\xd3\x5e\x43\x11\x28\x46\x5e\xa2\x74\xac\x6c\xe8\xf3\xca\x47\x45\xce\xd1\xea\xd1\x11\xfe\x40\xdd\xd8\xa1\xaa\xde\x64\xe7\x3c\x6b\x18\x51\x34\x36\x3f\x46\xf8\xa3\x8a\x46\xe7\xc3\x96\x76\xb9\x81\x85\x0e\x2a\xfe\xfc\x7a\xb1\x0e\x80\x43\xe5\x22\xae\xfa\xdc\x6a\x71\x00\x13\x5f\x29\x67\x76\x6a\xc5\x6e\x05\xbf\x44\xad\xd8\xd6\x9d\xf3\xe9\x46\xfd\xe7\x7f\x03\x00\x00\xff\xff\xe9\x75\x72\xca\x0c\x43\x00\x00") +var _templateBuilderMutationTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x5b\xdb\x73\xdb\x36\x97\x7f\x26\xff\x8a\x53\x8d\x9b\x11\xbd\x2a\x95\xf6\x6d\xdd\xd5\x43\x36\x4e\x77\x3d\xb3\x9b\xec\x34\xee\xbe\x78\x32\x2d\x4d\x1c\x59\x18\x53\x24\x0b\x50\xb2\x3d\xfa\xf4\xbf\x7f\x83\x03\x80\x04\x78\xd3\x25\x49\xd3\xaf\x0f\x1d\x8b\xc4\xe5\x5c\x7e\xe7\xce\xec\x76\xf3\xcb\xf0\x6d\x51\xbe\x08\xfe\xb0\xaa\xe0\xa7\xd7\x3f\xfe\xfb\x0f\xa5\x40\x89\x79\x05\xbf\x24\x29\xde\x17\xc5\x23\xdc\xe4\x69\x0c\x6f\xb2\x0c\x68\x91\x04\xf5\x5e\x6c\x91\xc5\xe1\xed\x8a\x4b\x90\xc5\x46\xa4\x08\x69\xc1\x10\xb8\x84\x8c\xa7\x98\x4b\x64\xb0\xc9\x19\x0a\xa8\x56\x08\x6f\xca\x24\x5d\x21\xfc\x14\xbf\xb6\x6f\x61\x59\x6c\x72\x16\xf2\x9c\xde\xff\xcf\xcd\xdb\x77\xef\x3f\xbe\x83\x25\xcf\x10\xcc\x33\x51\x14\x15\x30\x2e\x30\xad\x0a\xf1\x02\xc5\x12\x2a\xe7\xb2\x4a\x20\xc6\xe1\xe5\x7c\xbf\x0f\xc3\xdd\x0e\x18\x2e\x79\x8e\x30\x59\x6f\xaa\xa4\xe2\x45\x3e\x01\xf3\xe2\xa2\x7c\x7c\x80\xab\x05\xdc\x27\x12\xe1\x22\x7e\x5b\xe4\x4b\xfe\x10\xff\x5f\x92\x3e\x26\x0f\xa8\x16\xed\x76\x50\xe1\xba\xcc\x92\x0a\x61\xb2\xc2\x84\xa1\x98\xc0\x05\x6d\xe7\xeb\xb2\x10\x15\x4c\xc3\x60\xb7\xfb\x01\x44\x92\x3f\x20\x5c\xe4\xea\xb4\x8b\xf8\x7d\xc1\x50\xaa\x55\x41\x30\x51\xd7\x74\x4f\x9e\xab\xc7\xb9\xf3\x60\xa2\xcf\xc1\x9c\xd1\xe9\xc1\xe4\x81\x57\xab\xcd\x7d\x9c\x16\xeb\xf9\xd2\x88\x9a\xe7\xe9\xe6\x3e\xa9\x0a\x31\xc7\xbc\x9a\x84\x51\x18\xa6\x45\x2e\x89\x86\xf9\x1c\x3e\x94\x28\x88\x3d\xa8\x5e\x4a\x94\x71\x18\x7c\x28\xdf\x0a\x54\xa4\x03\xc0\x02\x30\xaf\x62\xfb\x44\xbd\xbb\xc6\x0c\xfd\x77\xfa\x49\xf3\xee\x43\x8e\xad\x77\x1f\x72\x7a\xfd\x5b\xc9\x5a\xc7\xea\x27\xcd\x3b\x77\x6b\xfd\x24\x24\x3a\x95\x70\x6a\x12\x47\x65\x77\xfb\x52\xa2\x96\xd3\xfb\x64\xad\x84\x04\x0b\x98\x78\x0f\x7c\xa9\x45\xa4\xd4\x81\xe3\x48\xdf\x16\x01\xf4\x2e\x8f\xff\xd7\xfc\x34\xa7\x85\xf3\x39\x78\xab\xf6\x7b\x10\x68\x00\x2f\x21\xc9\xa1\x68\x64\xbc\x4a\x2a\xa0\x85\x48\x80\xdc\xed\xa0\xcc\x36\x22\xc9\x1c\xea\xd4\x79\x39\xdd\x6f\x50\xfb\x20\x92\x72\x15\x87\x8a\xf9\xce\x45\xb2\x12\x9b\xb4\x82\x5d\x18\xa4\x04\x96\x30\x28\x4a\xf8\x50\x86\x41\xf5\x52\xaa\x97\x3c\x7f\x50\xcc\xaa\xe3\x6f\xae\xe3\xff\xdc\xf0\x8c\xa1\xf8\x85\x63\xa6\x58\x87\xcb\xfa\x8d\x12\x1a\x89\xcf\x11\xed\xd2\xf0\x4b\xcb\x8d\x70\xd5\x86\x65\xff\x39\xcb\xe6\x10\x3a\x85\x2f\xed\xb3\xf8\xfd\x66\x8d\x82\xa7\xfa\x5d\x90\x30\x76\xc2\x31\x46\x4b\xde\xdf\x69\x86\x89\x40\x66\x08\x5b\x27\xe5\x9d\x66\xf5\x93\x16\xc7\xce\xe7\x03\x0d\x1f\xef\xd8\x03\x4a\x9f\x3e\x8c\x7f\xcb\xf9\x9f\x1b\xba\x0e\x9c\xff\x14\x21\xd8\x4f\x1f\x6a\x96\x5c\x99\x05\x96\xa0\xfe\x6d\xf7\x45\x91\x59\x66\x32\x79\xe4\x5d\x8a\xa9\xde\xeb\x1c\x1e\x83\x40\xe0\xba\xd8\x0e\xdd\x7b\xd4\x11\x03\x22\xde\x87\xe1\x36\x11\xf0\x3b\x19\xa3\x05\x3c\x2c\x60\x7a\xd9\x42\x60\x34\xcd\x79\x16\x85\x04\x5a\x7c\x6a\xc3\x33\x25\xbf\x21\xd5\x2b\xa8\x9f\x2f\x0b\x61\xe1\x1e\x87\xcb\x4d\x9e\xf6\xec\x9c\xa6\xa0\x01\x3d\x03\x02\x74\x04\xed\x8b\x15\xe6\x05\x56\x1b\x91\xc3\xab\xd6\xab\x5d\x18\x18\x73\xb8\xb2\x42\x4e\x67\x61\x10\x14\xe5\x95\x2b\xf8\xa2\x54\x0f\xab\x17\xef\x69\xc7\x7b\xa8\x35\x1e\xde\xae\x60\x9d\x3c\xe2\xb4\x07\x75\xd1\x2c\x0c\x48\x74\xf3\x39\xbc\xcd\xb8\x8a\x77\x9a\x42\x09\x09\x89\xe0\x0f\x25\x4d\xfd\xe6\x0f\x58\x8a\x62\x4d\xf6\x6d\x29\x8f\xe1\x66\xe9\x3d\x80\xa7\x44\xaa\xb3\xf0\x19\xd3\x4d\x85\x4c\x39\x84\x04\x2a\x91\xe4\x32\x49\x69\xc1\x54\x1d\x78\xfb\x1c\xcd\xfc\xe7\x49\x06\xa9\xbe\x9f\x4b\x43\x82\x8a\xac\x24\xeb\xe9\xba\xed\x44\x22\x43\xec\x34\x82\x4b\x43\xb6\xf2\x27\xfa\xaf\xab\x05\xbc\xd2\x0f\x77\x56\xa4\xeb\x58\xff\xb5\xb7\x8b\x62\x9e\xf3\x6a\x1a\xd5\xfa\xd0\x4f\x8d\x20\x6e\x9f\x1b\x21\xe4\x5a\x02\xb7\xcf\x7f\x10\x08\x2c\x0d\x52\xfb\xc5\x27\x14\xe8\xf1\xea\x70\x24\x7f\x56\x67\xf1\xca\x3d\x0b\x85\x28\x04\x14\xd5\x0a\xc5\x13\x97\x38\xc2\xdf\xed\xf3\x34\x82\xe9\xe5\xed\xf3\x4c\x6f\x8a\x14\x83\x7c\x09\xc1\xef\x33\x28\x1e\x15\x8f\xeb\x98\x09\xbe\x45\x11\x4f\x2f\xab\xe7\x6b\xfa\x33\xfa\x19\xbe\x2b\x1e\xd5\x4a\xcb\x57\xce\xb3\x19\x2c\xd7\x55\xfc\x4e\x1d\xb2\x9c\x4e\x6c\x32\xb0\xdf\x5f\x35\x4a\xe3\x12\xf2\xa2\x02\xb1\xc9\x73\x9e\x3f\x74\x74\x36\x89\x14\x48\x82\xea\x99\x44\x7b\xfb\xdc\x27\xd6\xea\xb9\x2d\xd2\xea\x79\xa6\xae\x0f\x29\x22\x69\xdf\x45\x7e\xfb\x37\x89\xe2\x9a\x12\x15\x6d\xc2\xf3\x39\x7c\xc4\xea\xe6\x1a\x24\x56\x92\xc0\xb4\x4d\xb2\x0d\xea\x54\x07\x81\x33\x58\x2a\x10\xc7\xf0\xbe\xa0\x10\x94\x54\x33\xca\x81\x68\x67\x13\xa7\xb8\x84\x24\x4d\xb1\x54\x8a\x28\xf2\xec\x05\x8a\x1c\xfc\x98\x4a\x96\xad\x40\x1b\x06\x56\xec\x1d\xd7\xa0\x49\x99\x72\x06\xed\x38\x43\x0a\x08\xd6\xf1\x60\x64\x5a\xc0\x2b\xce\x94\xa0\xdc\xf4\x66\x3e\x87\x9b\xeb\x1a\x01\x86\x1f\xcd\x9f\x09\x95\x8d\x29\x79\xfc\xa9\x85\x84\x1f\x09\xc9\x36\xe1\x59\x72\x9f\xa1\xe6\x8b\x2f\x15\xa8\x9e\x12\x09\xa5\x28\xb6\x9c\x21\x83\xaa\xa0\x1d\xf7\x9a\xa2\x06\x55\x5d\xf6\x6e\xae\x15\xac\x7a\xd8\x9b\x01\x3e\x73\x59\x49\x72\xfd\x16\x6c\x63\xdc\x2e\x94\x72\x1d\xa8\x11\x44\x8c\xea\x2f\x87\x37\xce\xa0\x12\x1b\xd4\xa0\x18\x89\xda\x04\x53\xf5\x58\x60\x8a\x0a\xda\x75\x60\xfe\x48\x0e\x4c\xb9\xcc\x9d\x12\x05\xfe\xa9\x16\x4e\xd6\x13\xf2\xaf\xb4\x6b\x01\x13\x92\xb0\x7d\xd4\xc4\x0a\xb8\x20\xc9\x5c\x2d\xa0\x14\x3c\xaf\x60\xf2\x11\xab\x89\x3a\xf9\x23\xb9\x43\x4b\xa3\x5e\xaa\x53\xce\x7a\xad\x93\xc4\x4e\x62\xda\xf4\x56\x2d\x48\xf2\xca\xa2\xb8\x3e\x5f\x25\x39\x16\xcb\x3a\x3f\xb0\x10\xd4\x48\x1e\xc3\x9f\x73\xc8\x54\xb3\x63\xf8\x5a\xf6\x01\xb1\x9b\x90\x2c\x74\x68\x29\x9b\xa4\x61\x7e\xa9\xa8\xa9\x94\xd0\x72\x93\xd4\x50\x5e\x56\x6c\x51\x08\xce\x10\x4a\x81\x5b\x5e\x6c\x24\xa4\x49\x96\x49\x05\xa6\x37\x8c\xc5\x40\x55\xc5\x81\xbc\x68\x1d\x0f\x66\x46\x84\x8f\x56\xb4\xde\x87\x8d\xa0\xea\x10\xfd\x5f\x58\xe9\xfc\xb3\xb1\x11\x5f\x68\xfd\xe6\x72\x50\x88\xad\x0b\x14\xee\x85\x2f\xc9\x2e\xe6\x83\xad\xf6\xac\xbd\x2c\x85\x81\xb2\x89\xad\x0b\xfd\x1a\xfb\x0a\xfc\x35\xfa\xb7\x06\xe4\xc4\xaf\x86\x69\x92\xb3\x7e\x11\xf6\x80\xf2\x0d\x63\xbd\xa0\x6c\x63\x2c\x61\x4c\x42\x8d\x91\xaa\xf0\xc5\x16\x87\xc1\x17\x80\x99\xf6\x02\x83\x4a\xfe\xce\x11\x45\x70\x39\xb2\xf0\xdf\x16\xe0\xc0\x32\xd8\xeb\xb4\x52\xef\x1b\x05\xd1\x2b\x6f\x1b\x09\x5a\x4b\xe2\x0d\x63\x68\x76\xf9\x82\xf2\x90\xa4\xb1\xa3\x63\x75\x22\x95\xc8\x1a\x77\xd9\x63\x9a\x1a\x65\x5c\xba\x30\x1b\x91\xe2\x20\x0d\xc7\x81\xcd\xa2\x6d\x88\x7d\x23\x7f\x1f\x71\x0d\xe4\x82\x7d\x83\x40\x07\x74\x81\xf6\x5f\x75\x81\xad\x01\x78\xb1\x8c\x3f\x94\x26\xd1\x1a\x02\xde\x5b\x95\x33\x1e\x05\x3d\xca\x2e\x5b\xc1\xfa\x4c\xf4\x19\x51\x0c\xfb\x33\xed\x46\xc6\xfd\xd0\x31\x8e\xc8\xf3\x44\x6a\x87\x97\x22\xdf\x35\x2e\x7f\xbf\xff\x04\x0b\xb0\x19\xf2\xae\x06\x5d\x4d\x75\x1d\x12\x7c\x41\x69\xf9\x21\x9b\xf4\x8a\xcc\xa2\x92\xeb\xb4\x46\xc3\xcd\x87\xa0\x42\xa8\x21\xea\x44\x20\xfa\x02\x55\x08\xd3\x52\x75\x92\xc5\x11\x6e\x1d\x18\x15\x8f\xbd\x00\xb2\x7c\x3b\x5e\xf5\x57\x94\xd8\x1b\xfa\x04\xbd\x48\xb2\x0c\xd2\x95\x8a\xef\xd2\x66\x72\x13\x8f\xdb\xc9\x89\xc1\xf0\x50\xd8\x6b\xa2\xcd\x97\x8a\x56\xce\x61\xbe\xe9\x04\x8c\x7a\x44\xd3\x96\x50\x67\xe0\x4a\x35\xea\xc4\x3e\x47\xa6\x4e\xf2\xd3\x2d\xf5\xd5\x29\x05\x25\x3f\x93\x84\x11\x9a\x8c\x09\x3b\xa5\xbf\x59\xb3\x80\x89\x54\x29\x0c\x3d\x70\xf3\x1c\xce\xe4\x2f\x9e\x71\x4f\xcb\x44\xa6\x49\xa6\x76\x45\x30\x95\x3c\x7f\xd8\x64\x89\x50\x67\x92\x3e\xfe\x01\xfa\x7d\x04\x93\x9b\x6b\x39\x7c\xa7\x3d\xb7\xff\x58\xfb\x43\x1f\x4a\x67\xb5\x68\x33\x58\xb1\xc7\x98\xa0\x53\x28\x07\xdf\x84\x7e\xac\x2d\x02\xd9\x03\xda\xc8\x66\x7a\x02\xf6\xd5\xfd\x0b\x70\xa6\x89\x54\xb5\x8b\x4b\xa8\xac\x2f\x3c\x88\xae\x86\x90\x69\x97\x61\x3a\xdf\xf4\x3f\x38\x93\x10\xc7\x71\x7d\x32\xf4\xb6\x29\x34\x48\xfb\x5a\x35\xb5\x8b\xeb\x36\x3d\x4c\xe1\xe0\x75\x5b\x6c\xe4\x1d\xd8\xe1\xc6\x83\xe1\x63\xeb\xa2\x7f\xbc\xa5\x12\xd5\xb1\x44\x55\xb8\x9c\xb2\x6e\xc2\xa6\xe2\x79\xf4\x8e\x3b\xce\xe4\x1d\xff\xd4\x71\x97\x41\xbb\x4d\xb3\xaf\xc3\x90\x2f\x93\x91\x20\x84\xa7\x04\xa1\x63\x51\x73\x46\x58\x1a\xed\x93\x2d\x9a\x98\xdb\x1b\x20\xf0\xfc\x00\x41\x4c\xf8\x7c\x39\xf1\xe1\xbc\x70\x60\x9c\xfc\x38\x53\x4e\x8e\xa5\xdf\xfb\x7a\x68\x95\xb3\x3e\x85\x9c\xf5\xe4\xe9\x07\x08\xed\x5e\xe0\x94\xa8\x1d\xd4\xf6\xa5\x51\x23\x96\xf2\x5d\x37\x73\xb2\xd5\x69\x67\x71\x9d\x40\xb9\x89\x55\x13\x0e\x6b\xcb\xac\x6b\xd3\xac\x78\x42\x01\x53\xd2\xf5\x12\x26\xdf\xc7\x3f\xca\x89\x87\xb8\xa8\xd9\xd0\x71\xc8\x93\x5f\xa9\x11\x3a\x39\xca\x19\x37\xea\x70\x3c\xa7\xee\xa4\x9e\xe3\x36\xe5\x61\xad\x38\x8e\xb1\x71\x7d\x43\x0e\x4f\x6b\x60\xb4\xb3\xdb\x72\x59\xe3\x6b\x4f\xf7\x5c\x03\x2e\xf7\xc0\x4d\x77\x9c\x75\x7d\x57\xcb\x0d\x0f\x3b\xc5\xc3\x87\xf7\x3b\xc7\x86\xe2\x3a\xd3\xf0\xdd\x47\x1b\x23\xec\x28\x77\xe8\x5a\xa5\xa1\x8b\x88\x35\xa9\xf9\xe9\x3e\xf0\xe6\x5a\x6a\x4b\x94\x70\xf7\x69\x4c\xfb\x24\x21\xd6\x88\xe8\x80\x7a\xb5\xf4\xd4\xb1\x0b\x48\xca\x12\x73\xa6\xee\x98\x01\x67\xd1\xa0\xf1\xd9\x5c\x74\xd0\x29\xc9\x51\xaf\x24\xbb\x6e\x49\xcf\x31\xfa\x50\x43\xa3\x3b\xd3\x8a\xa3\xbd\x49\xf6\x94\xbc\x34\x17\x64\x98\x2b\x82\x23\xf8\x8f\x05\xfc\x48\x5d\xe1\x8d\xde\xad\xcc\x4e\xce\xa8\xd6\x7f\x29\x36\x20\x57\xc5\x26\x63\xb0\x91\x38\xea\x4d\x79\x2e\x2b\x4c\x58\x0c\x37\x95\xf5\x6d\xd4\xe7\x23\xa9\xe6\x15\x0a\x95\x77\x6e\x64\xf2\x80\xca\x78\x9d\x3e\x9f\x1d\x2b\x5a\x14\x9d\xea\x66\x8f\xd1\xae\x92\xd2\x90\x71\xf1\xa5\xd1\xfa\x80\x3f\xfd\x59\xbd\xf6\x1c\x70\x57\xe7\x97\x8e\xd2\x5b\x86\xd7\x45\xd5\xd9\x70\x32\x52\xda\xef\xbd\x6e\x65\xe8\xb7\x04\x2f\xf0\x73\x6b\x1b\x6c\x6a\x1b\x05\x85\xb3\x4a\x9b\x3e\x6f\xe8\x97\x36\x9d\xac\xf2\x40\x86\xb2\x4c\x32\x42\x60\x4b\xbc\x07\x7d\x70\x5f\xfb\xce\x2d\x61\x68\x12\xef\x59\x5d\xd3\x8c\xcf\x9b\x41\x59\x2f\xf7\x1f\xca\xa9\xfa\x9f\x33\x10\x5b\xc7\x45\x69\xc7\x2f\x0a\x7e\xee\xb9\xb9\x1d\xa4\xd7\x9f\x3f\xd4\x87\x51\xf3\xaa\x6e\xf1\x47\x63\x77\xaa\x63\xa7\x91\x99\x30\x7b\x37\x57\x2f\xf6\x6a\xd3\x81\xae\x27\x36\x59\xa6\xab\x54\x77\xdc\xa3\x35\xcf\x80\x6d\x68\x54\x3d\x9f\xb7\x0a\x75\xb7\x8f\xcf\x73\x28\x04\x7d\xfe\x51\xc0\x83\x41\x8e\x69\xc2\xaa\x8d\x9d\xb3\x79\x3e\x67\x98\x0a\x5c\x63\x5e\x21\x9b\x51\x47\x56\x77\x99\x34\x65\xd3\x51\x0e\xed\x1a\xb8\xfb\xd4\x70\x69\xee\xb8\x32\x41\xd5\xbe\x9a\xc1\x6b\xaa\x57\x33\xcc\xbd\xd6\x7b\x74\xc4\x3c\xfd\x87\x53\x9b\xe3\x4d\x86\x36\xde\x42\x34\xb4\xd6\x76\xbc\x1c\xa8\xab\x5b\xb3\x75\xa3\x48\xbd\xda\xd5\x64\x4f\x2b\xb0\x58\x42\x62\x9a\x2f\x4f\xbc\x5a\xe9\xaf\x15\xf8\x16\x2d\x66\x15\xfe\x56\x08\x12\xd3\x22\x67\x94\x64\x62\x92\xd7\x2d\x68\xc6\x53\x1a\x0e\x93\xc6\x48\xed\xe6\x28\x3d\xf5\x54\x85\xa8\xc4\x6a\x06\x85\xa0\x64\x5d\xfd\x36\xdf\xe4\x98\xf8\x23\xd3\x15\xae\x93\x83\x4a\x9c\x2a\x62\x0c\x54\x23\x3d\x32\xfd\x7f\x45\xc2\xac\x49\x7b\xe5\x13\xaf\xd2\x15\x51\xad\x7e\x7e\x05\xa5\xa5\x89\x44\x4f\xf4\x57\x4e\x0d\x51\xeb\xb3\xdd\x65\x0f\xdb\x85\x9f\x37\x89\x24\x5f\xa4\x35\xf4\x11\x4d\x2c\x6a\xcd\xfd\x94\xdf\x6f\x69\x45\x85\xc6\x66\x8a\x4a\xf3\x65\x1a\xa4\x7a\xbd\x34\xee\xca\x9b\xf9\x02\x27\x8d\xe8\xd5\x64\xb0\xca\x97\xac\xb9\x5c\x27\x4a\x84\xcd\x11\xea\xf9\x98\x6e\x2c\xc9\xae\x7a\x66\x86\xec\x5a\x47\x91\x21\xee\x1b\xea\x68\x6b\xdb\x7e\x44\x5a\x3c\xf5\x1b\xfb\x26\x76\xdb\x49\x71\xad\x52\x77\x4c\xbc\xc9\xf1\xb9\xc4\xb4\x42\x2d\x14\xf8\xfe\x96\xf4\xa2\xc5\xf4\xbd\x9c\x18\xae\x67\xc4\x5b\x93\xb6\xad\xe3\x8f\x58\xf5\x36\xc4\xb7\x91\x03\x1e\x0a\x2d\xfd\x30\xf1\x89\x78\xcc\x8b\xa7\xf6\x18\xd7\xa1\x41\x5f\xae\xe1\xe4\x78\x49\xcf\x7f\xdb\x99\x57\x8f\xaf\xad\x1d\xad\xda\x5f\x08\x70\x5c\xaf\xf1\xee\xed\x1e\xec\x81\x51\x40\xaf\x03\x6e\x86\xdf\xff\x9d\x48\xaf\x21\xb9\x4d\x84\x25\xcb\x6e\x30\x30\x18\x41\xc9\x81\x46\xf8\x39\x20\x3a\x69\xca\x73\xb4\x93\xee\xab\x73\xbc\x1f\xbe\xdb\x6e\xe5\x27\x03\x48\x69\xeb\xda\xcf\x13\x8c\x28\x5a\x43\x1f\x3f\xa8\x52\xdc\x15\xc5\x7a\x34\x0c\xb8\x31\xa0\xe5\xfb\x75\xc0\xef\xb8\xff\x2f\xe2\xfb\x1b\xbe\x8e\x08\x00\xc3\xb8\x6a\xb9\x9d\x6f\x82\xa8\x7e\xc7\xe4\xb4\xa0\x46\x66\x67\xe3\xb0\xe9\x0f\xfe\x9d\xf0\xf2\x86\x19\x84\xd0\x98\xf4\x5f\x22\xbc\x58\x92\xbf\x5e\x78\x19\xd4\xf2\x59\x4a\x1e\xd0\xf1\xe1\xe8\xe3\x87\x9f\x2f\x13\x7f\x02\xdb\xf0\x79\xc3\xfa\x61\xa5\x23\x90\xe7\x58\x06\xbf\xd6\x3c\x25\x1e\x79\x01\xa6\x15\x97\xf4\x67\x75\xee\x97\x9f\x7e\x68\xca\xf4\x77\x3d\xdd\x1a\x43\xef\x51\xdb\x4f\x0d\x44\xde\x75\x63\xa1\xc8\x9f\x69\x7d\x6e\x2c\x6a\x4d\xc8\x3e\x27\x0e\xd1\x0d\x86\x8d\xa9\x17\x55\xfe\x46\x21\xc8\x25\xd2\xf9\x64\xd2\x16\x0c\x4d\xa9\xc0\x97\x3d\x85\xc2\xf0\x94\xf7\x40\x61\x60\xc5\xe2\x85\x07\xdb\xe0\x1f\x9c\xf6\xaa\xd5\x9f\x42\x67\xc6\xbb\x6f\x90\xa9\xed\xa3\x33\xd0\xff\x1a\x6e\xf2\x20\x6c\x7b\x42\x5f\xed\xec\x46\xb0\x7b\x7e\xbc\xfb\x32\xa8\x1d\x8a\x75\xeb\x98\xb8\x1a\x0e\x72\x2d\x6f\x74\x72\xd0\x3b\xc6\x39\xb9\x2e\xa6\xc7\x3b\x51\xab\xcb\xa6\x52\x54\x89\xb9\xdd\xad\x56\xd7\x14\x04\x3e\x24\x82\x69\x7f\x44\xa1\x4e\xc3\x43\x1f\xde\x03\x92\x61\x84\x90\x6b\x3b\x15\x24\x0d\xb1\x03\x20\xf9\x56\x05\x57\xbb\x18\xb6\x0d\xc4\xe9\x5f\x52\xf5\xe8\x4f\x07\xdc\xc8\x42\x03\x20\xb5\xce\x0d\x2a\x12\xab\xb9\xfe\x00\xca\xb8\x1d\x75\xc0\xd1\xb5\x0d\x5d\xd2\x8a\x27\xd4\xf0\x3e\xd4\x5a\xb2\x1f\x36\x44\x87\xfe\x85\xc3\x91\x63\xbc\x63\xb4\x86\x6d\x1b\xd5\x94\xd6\x01\xc3\x74\xea\x8f\xeb\x2b\xd1\x62\x57\xde\xee\xb4\x41\x49\x9b\x33\x09\xd3\xaa\xd0\xdf\x75\xeb\x7f\x08\x13\x39\x72\xd7\x32\x5f\x16\x42\x97\x0e\xd6\xa7\xd6\x3a\x3a\x28\xfa\x9b\x6b\xe9\xe3\xfd\xee\x53\x9d\x0e\x8e\xa3\x7e\xe0\xdf\x91\x9c\x2a\xbe\x7e\xd0\x0f\xcd\xdc\x4e\x9f\x0b\x58\x49\x3b\x7c\xed\x2e\x39\x6b\x4f\xcb\x9c\xa1\x1c\xf7\x5a\x9a\x4e\x79\xf4\x7a\x46\xf3\x99\x81\xab\xa3\xa8\x19\xe9\x1d\x3d\x5a\x18\x9e\x2d\x98\x9c\xd3\x50\xcf\x55\x0a\x71\x4c\x4e\x69\xbe\x8a\x27\xef\x4b\x2d\xf8\x23\x0d\xb8\x9e\xea\x9d\x66\xbe\xee\x25\x5f\xd5\x80\x0d\x20\xda\x9f\xe3\x1c\x37\x20\xf6\x00\x71\x96\x8d\x1f\x69\xe4\x9d\x8f\x53\x0e\x98\xbc\x11\xdf\x89\x46\x6f\x75\x75\x9e\xd9\x37\x77\x7e\x59\xc3\x1f\xd0\xce\x59\xe2\x1e\xc8\x7a\x0e\x5b\xe6\x18\x0c\x06\x0d\xf4\x88\x89\xf2\x69\x76\x7a\x8a\x99\x9a\xac\xfb\x48\x33\x6d\x25\xf7\xc7\x9a\xa9\x7b\xc9\x5f\x61\xa6\xbd\x26\x3a\x3a\x4b\xfc\xfb\xd9\xa6\xe2\xea\x94\x22\x8c\xf4\xf5\x19\x35\x98\x73\x5f\x7f\x09\x76\x8e\x45\x7e\x4d\x6b\x3c\xf6\x8b\xaf\x23\x1a\x21\x4e\x6f\x8d\x44\xa0\x18\xf9\x12\x75\x63\x6d\x43\x9f\x57\x3b\x2a\x72\x0e\x96\x8e\x8e\xf0\x47\x8a\xc6\x1e\x55\x0d\x26\x3b\xe7\x59\xc3\x11\x15\x63\xfb\x7b\x8d\xbf\xaa\x62\x74\xbe\x65\xe9\x96\x1b\x54\xd7\x90\xe2\xcf\x2f\x16\x9b\x00\x38\x56\x2b\xd2\xaa\xcf\x2d\x15\x47\x30\xf1\x8d\x72\x66\x9b\x69\x7e\xbd\x42\xb1\xab\x38\xe7\xa3\x8d\xe6\xcf\x7f\x06\x00\x00\xff\xff\xfd\x5d\xba\xf1\xf2\x42\x00\x00") func templateBuilderMutationTmplBytes() ([]byte, error) { return bindataRead( @@ -201,7 +201,7 @@ func templateBuilderMutationTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/builder/mutation.tmpl", size: 17164, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/builder/mutation.tmpl", size: 17138, 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/mutation.tmpl b/entc/gen/template/builder/mutation.tmpl index 3ce778184..931a6c7f4 100644 --- a/entc/gen/template/builder/mutation.tmpl +++ b/entc/gen/template/builder/mutation.tmpl @@ -169,8 +169,8 @@ func (m *{{ $mutation }}) ID() (id {{ $n.ID.Type }}, exists bool) { } {{ end }} - {{ $func = print "Reset" $f.StructField }} - // {{ $func }} reset all changes of the {{ $f.Name }} field. + {{ $func = $f.MutationReset }} + // {{ $func }} reset all changes of the "{{ $f.Name }}" field. func (m *{{ $mutation }}) {{ $func }}() { m.{{ $f.BuilderField }} = nil {{- if $f.Type.Numeric }} @@ -265,8 +265,8 @@ func (m *{{ $mutation }}) ID() (id {{ $n.ID.Type }}, exists bool) { } - {{ $func := print "Reset" $e.StructField }} - // {{ $func }} reset all changes of the {{ $e.Name }} edge. + {{ $func := $e.MutationReset }} + // {{ $func }} reset all changes of the "{{ $e.Name }}" edge. func (m *{{ $mutation }}) {{ $func }}() { m.{{ $e.BuilderField }} = nil {{- if $e.Unique }} @@ -447,7 +447,7 @@ func (m *{{ $mutation }}) ResetField(name string) error { {{- range $f := $n.Fields }} {{- $const := print $n.Package "." $f.Constant }} case {{ $const }}: - m.Reset{{ $f.StructField }}() + m.{{ $f.MutationReset }}() return nil {{- end }} } @@ -580,7 +580,7 @@ func (m *{{ $mutation }}) ResetEdge(name string) error { {{- range $e := $n.Edges }} {{- $const := print $n.Package "." $e.Constant }} case {{ $const }}: - m.Reset{{ $e.StructField }}() + m.{{ $e.MutationReset }}() return nil {{- end }} } diff --git a/entc/gen/type.go b/entc/gen/type.go index c6e64012d..a36863251 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -626,6 +626,17 @@ func (f Field) MutationGet() string { return name } +// MutationReset returns the method name for resetting the field value. +// The default name is "Reset". If the the method conflicts +// with the mutation methods, suffix the method with "Field". +func (f Field) MutationReset() string { + name := "Reset" + pascal(f.Name) + if _, ok := mutMethods[name]; ok { + name += "Field" + } + return name +} + // IsTime returns true if the field is a timestamp field. func (f Field) IsTime() bool { return f.Type != nil && f.Type.Type == field.TypeTime } @@ -834,6 +845,17 @@ func (e Edge) OwnFK() bool { return false } +// MutationReset returns the method name for resetting the edge value. +// The default name is "Reset". If the the method conflicts +// with the mutation methods, suffix the method with "Edge". +func (e Edge) MutationReset() string { + name := "Reset" + pascal(e.Name) + if _, ok := mutMethods[name]; ok { + name += "Edge" + } + return name +} + // Column returns the first element from the columns slice. func (r Relation) Column() string { if len(r.Columns) == 0 { diff --git a/entc/integration/customid/ent/mutation.go b/entc/integration/customid/ent/mutation.go index 2e41af766..1655e2347 100644 --- a/entc/integration/customid/ent/mutation.go +++ b/entc/integration/customid/ent/mutation.go @@ -110,7 +110,7 @@ func (m *BlobMutation) UUID() (r uuid.UUID, exists bool) { return *v, true } -// ResetUUID reset all changes of the uuid field. +// ResetUUID reset all changes of the "uuid" field. func (m *BlobMutation) ResetUUID() { m.uuid = nil } @@ -148,7 +148,7 @@ func (m *BlobMutation) ParentIDs() (ids []uuid.UUID) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *BlobMutation) ResetParent() { m.parent = nil m.clearedparent = false @@ -190,7 +190,7 @@ func (m *BlobMutation) LinksIDs() (ids []uuid.UUID) { return } -// ResetLinks reset all changes of the links edge. +// ResetLinks reset all changes of the "links" edge. func (m *BlobMutation) ResetLinks() { m.links = nil m.removedlinks = nil @@ -465,7 +465,7 @@ func (m *CarMutation) Model() (r string, exists bool) { return *v, true } -// ResetModel reset all changes of the model field. +// ResetModel reset all changes of the "model" field. func (m *CarMutation) ResetModel() { m.model = nil } @@ -503,7 +503,7 @@ func (m *CarMutation) OwnerIDs() (ids []string) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CarMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -784,7 +784,7 @@ func (m *GroupMutation) UsersIDs() (ids []int) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -1056,7 +1056,7 @@ func (m *PetMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -1098,7 +1098,7 @@ func (m *PetMutation) CarsIDs() (ids []int) { return } -// ResetCars reset all changes of the cars edge. +// ResetCars reset all changes of the "cars" edge. func (m *PetMutation) ResetCars() { m.cars = nil m.removedcars = nil @@ -1140,7 +1140,7 @@ func (m *PetMutation) FriendsIDs() (ids []string) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *PetMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -1179,7 +1179,7 @@ func (m *PetMutation) BestFriendIDs() (ids []string) { return } -// ResetBestFriend reset all changes of the best_friend edge. +// ResetBestFriend reset all changes of the "best_friend" edge. func (m *PetMutation) ResetBestFriend() { m.best_friend = nil m.clearedbest_friend = false @@ -1511,7 +1511,7 @@ func (m *UserMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -1550,7 +1550,7 @@ func (m *UserMutation) ParentIDs() (ids []int) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *UserMutation) ResetParent() { m.parent = nil m.clearedparent = false @@ -1592,7 +1592,7 @@ func (m *UserMutation) ChildrenIDs() (ids []int) { return } -// ResetChildren reset all changes of the children edge. +// ResetChildren reset all changes of the "children" edge. func (m *UserMutation) ResetChildren() { m.children = nil m.removedchildren = nil @@ -1634,7 +1634,7 @@ func (m *UserMutation) PetsIDs() (ids []string) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil diff --git a/entc/integration/ent/client.go b/entc/integration/ent/client.go index 85d273ab1..4d10f1b93 100644 --- a/entc/integration/ent/client.go +++ b/entc/integration/ent/client.go @@ -587,6 +587,22 @@ func (c *FileClient) QueryType(f *File) *FileTypeQuery { return query } +// QueryField queries the field edge of a File. +func (c *FileClient) QueryField(f *File) *FieldTypeQuery { + query := &FieldTypeQuery{config: c.config} + query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { + id := f.ID + step := sqlgraph.NewStep( + sqlgraph.From(file.Table, file.FieldID, id), + sqlgraph.To(fieldtype.Table, fieldtype.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, file.FieldTable, file.FieldColumn), + ) + fromV = sqlgraph.Neighbors(f.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *FileClient) Hooks() []Hook { return c.hooks.File diff --git a/entc/integration/ent/fieldtype.go b/entc/integration/ent/fieldtype.go index 301ac186e..db36d4fba 100644 --- a/entc/integration/ent/fieldtype.go +++ b/entc/integration/ent/fieldtype.go @@ -67,6 +67,7 @@ type FieldType struct { OptionalFloat float64 `json:"optional_float,omitempty"` // OptionalFloat32 holds the value of the "optional_float32" field. OptionalFloat32 float32 `json:"optional_float32,omitempty"` + file_field *int } // scanValues returns the types for scanning values from sql.Rows. @@ -100,6 +101,13 @@ func (*FieldType) scanValues() []interface{} { } } +// fkValues returns the types for scanning foreign-keys values from sql.Rows. +func (*FieldType) fkValues() []interface{} { + return []interface{}{ + &sql.NullInt64{}, // file_field + } +} + // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the FieldType fields. func (ft *FieldType) assignValues(values ...interface{}) error { @@ -237,6 +245,15 @@ func (ft *FieldType) assignValues(values ...interface{}) error { } else if value.Valid { ft.OptionalFloat32 = float32(value.Float64) } + values = values[24:] + if len(values) == len(fieldtype.ForeignKeys) { + if value, ok := values[0].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field file_field", value) + } else if value.Valid { + ft.file_field = new(int) + *ft.file_field = int(value.Int64) + } + } return nil } diff --git a/entc/integration/ent/fieldtype/fieldtype.go b/entc/integration/ent/fieldtype/fieldtype.go index 952ee09c3..f6d292ae2 100644 --- a/entc/integration/ent/fieldtype/fieldtype.go +++ b/entc/integration/ent/fieldtype/fieldtype.go @@ -73,6 +73,11 @@ var Columns = []string{ FieldOptionalFloat32, } +// ForeignKeys holds the SQL foreign-keys that are owned by the FieldType type. +var ForeignKeys = []string{ + "file_field", +} + var ( // ValidateOptionalInt32Validator is a validator for the "validate_optional_int32" field. It is called by the builders before save. ValidateOptionalInt32Validator func(int32) error diff --git a/entc/integration/ent/fieldtype_query.go b/entc/integration/ent/fieldtype_query.go index 83b3a7ab4..65f2df6e4 100644 --- a/entc/integration/ent/fieldtype_query.go +++ b/entc/integration/ent/fieldtype_query.go @@ -27,6 +27,7 @@ type FieldTypeQuery struct { order []OrderFunc unique []string predicates []predicate.FieldType + withFKs bool // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -299,13 +300,20 @@ func (ftq *FieldTypeQuery) prepareQuery(ctx context.Context) error { func (ftq *FieldTypeQuery) sqlAll(ctx context.Context) ([]*FieldType, error) { var ( - nodes = []*FieldType{} - _spec = ftq.querySpec() + nodes = []*FieldType{} + withFKs = ftq.withFKs + _spec = ftq.querySpec() ) + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, fieldtype.ForeignKeys...) + } _spec.ScanValues = func() []interface{} { node := &FieldType{config: ftq.config} nodes = append(nodes, node) values := node.scanValues() + if withFKs { + values = append(values, node.fkValues()...) + } return values } _spec.Assign = func(values ...interface{}) error { diff --git a/entc/integration/ent/file.go b/entc/integration/ent/file.go index 8b3e1b630..fcf381576 100644 --- a/entc/integration/ent/file.go +++ b/entc/integration/ent/file.go @@ -43,9 +43,11 @@ type FileEdges struct { Owner *User // Type holds the value of the type edge. Type *FileType + // Field holds the value of the field edge. + Field []*FieldType // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool + loadedTypes [3]bool } // OwnerOrErr returns the Owner value or an error if the edge @@ -76,6 +78,15 @@ func (e FileEdges) TypeOrErr() (*FileType, error) { return nil, &NotLoadedError{edge: "type"} } +// FieldOrErr returns the Field value or an error if the edge +// was not loaded in eager-loading. +func (e FileEdges) FieldOrErr() ([]*FieldType, error) { + if e.loadedTypes[2] { + return e.Field, nil + } + return nil, &NotLoadedError{edge: "field"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*File) scanValues() []interface{} { return []interface{}{ @@ -163,6 +174,11 @@ func (f *File) QueryType() *FileTypeQuery { return (&FileClient{config: f.config}).QueryType(f) } +// QueryField queries the field edge of the File. +func (f *File) QueryField() *FieldTypeQuery { + return (&FileClient{config: f.config}).QueryField(f) +} + // Update returns a builder for updating this File. // Note that, you need to call File.Unwrap() before calling this method, if this File // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/entc/integration/ent/file/file.go b/entc/integration/ent/file/file.go index ad1c0bffd..9f1127bcd 100644 --- a/entc/integration/ent/file/file.go +++ b/entc/integration/ent/file/file.go @@ -20,6 +20,8 @@ const ( EdgeOwner = "owner" // EdgeType holds the string denoting the type edge name in mutations. EdgeType = "type" + // EdgeField holds the string denoting the field edge name in mutations. + EdgeField = "field" // Table holds the table name of the file in the database. Table = "files" @@ -37,6 +39,13 @@ const ( TypeInverseTable = "file_types" // TypeColumn is the table column denoting the type relation/edge. TypeColumn = "file_type_files" + // FieldTable is the table the holds the field relation/edge. + FieldTable = "field_types" + // FieldInverseTable is the table name for the FieldType entity. + // It exists in this package in order to avoid circular dependency with the "fieldtype" package. + FieldInverseTable = "field_types" + // FieldColumn is the table column denoting the field relation/edge. + FieldColumn = "file_field" ) // Columns holds all SQL columns for file fields. diff --git a/entc/integration/ent/file/where.go b/entc/integration/ent/file/where.go index 91b1039d2..1fc835427 100644 --- a/entc/integration/ent/file/where.go +++ b/entc/integration/ent/file/where.go @@ -616,6 +616,34 @@ func HasTypeWith(preds ...predicate.FileType) predicate.File { }) } +// HasField applies the HasEdge predicate on the "field" edge. +func HasField() predicate.File { + return predicate.File(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(FieldTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, FieldTable, FieldColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasFieldWith applies the HasEdge predicate on the "field" edge with a given conditions (other predicates). +func HasFieldWith(preds ...predicate.FieldType) predicate.File { + return predicate.File(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(FieldInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, FieldTable, FieldColumn), + ) + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups list of predicates with the AND operator between them. func And(predicates ...predicate.File) predicate.File { return predicate.File(func(s *sql.Selector) { diff --git a/entc/integration/ent/file_create.go b/entc/integration/ent/file_create.go index e8104ff95..3f6711160 100644 --- a/entc/integration/ent/file_create.go +++ b/entc/integration/ent/file_create.go @@ -12,6 +12,7 @@ import ( "fmt" "github.com/facebookincubator/ent/dialect/sql/sqlgraph" + "github.com/facebookincubator/ent/entc/integration/ent/fieldtype" "github.com/facebookincubator/ent/entc/integration/ent/file" "github.com/facebookincubator/ent/entc/integration/ent/filetype" "github.com/facebookincubator/ent/entc/integration/ent/user" @@ -111,6 +112,21 @@ func (fc *FileCreate) SetType(f *FileType) *FileCreate { return fc.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fc *FileCreate) AddFieldIDs(ids ...int) *FileCreate { + fc.mutation.AddFieldIDs(ids...) + return fc +} + +// AddField adds the field edges to FieldType. +func (fc *FileCreate) AddField(f ...*FieldType) *FileCreate { + ids := make([]int, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fc.AddFieldIDs(ids...) +} + // Save creates the File in the database. func (fc *FileCreate) Save(ctx context.Context) (*File, error) { if _, ok := fc.mutation.Size(); !ok { @@ -241,6 +257,25 @@ func (fc *FileCreate) sqlSave(ctx context.Context) (*File, error) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := fc.mutation.FieldIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: file.FieldTable, + Columns: []string{file.FieldColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: fieldtype.FieldID, + }, + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } if err := sqlgraph.CreateNode(ctx, fc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr diff --git a/entc/integration/ent/file_query.go b/entc/integration/ent/file_query.go index 220d9f586..465b391a4 100644 --- a/entc/integration/ent/file_query.go +++ b/entc/integration/ent/file_query.go @@ -8,12 +8,14 @@ package ent import ( "context" + "database/sql/driver" "errors" "fmt" "math" "github.com/facebookincubator/ent/dialect/sql" "github.com/facebookincubator/ent/dialect/sql/sqlgraph" + "github.com/facebookincubator/ent/entc/integration/ent/fieldtype" "github.com/facebookincubator/ent/entc/integration/ent/file" "github.com/facebookincubator/ent/entc/integration/ent/filetype" "github.com/facebookincubator/ent/entc/integration/ent/predicate" @@ -32,6 +34,7 @@ type FileQuery struct { // eager-loading edges. withOwner *UserQuery withType *FileTypeQuery + withField *FieldTypeQuery withFKs bool // intermediate query (i.e. traversal path). sql *sql.Selector @@ -98,6 +101,24 @@ func (fq *FileQuery) QueryType() *FileTypeQuery { return query } +// QueryField chains the current query on the field edge. +func (fq *FileQuery) QueryField() *FieldTypeQuery { + query := &FieldTypeQuery{config: fq.config} + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := fq.prepareQuery(ctx); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(file.Table, file.FieldID, fq.sqlQuery()), + sqlgraph.To(fieldtype.Table, fieldtype.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, file.FieldTable, file.FieldColumn), + ) + fromU = sqlgraph.SetNeighbors(fq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first File entity in the query. Returns *NotFoundError when no file was found. func (fq *FileQuery) First(ctx context.Context) (*File, error) { fs, err := fq.Limit(1).All(ctx) @@ -299,6 +320,17 @@ func (fq *FileQuery) WithType(opts ...func(*FileTypeQuery)) *FileQuery { return fq } +// WithField tells the query-builder to eager-loads the nodes that are connected to +// the "field" edge. The optional arguments used to configure the query builder of the edge. +func (fq *FileQuery) WithField(opts ...func(*FieldTypeQuery)) *FileQuery { + query := &FieldTypeQuery{config: fq.config} + for _, opt := range opts { + opt(query) + } + fq.withField = query + return fq +} + // GroupBy used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -366,9 +398,10 @@ func (fq *FileQuery) sqlAll(ctx context.Context) ([]*File, error) { nodes = []*File{} withFKs = fq.withFKs _spec = fq.querySpec() - loadedTypes = [2]bool{ + loadedTypes = [3]bool{ fq.withOwner != nil, fq.withType != nil, + fq.withField != nil, } ) if fq.withOwner != nil || fq.withType != nil { @@ -451,6 +484,34 @@ func (fq *FileQuery) sqlAll(ctx context.Context) ([]*File, error) { } } + if query := fq.withField; query != nil { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*File) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + } + query.withFKs = true + query.Where(predicate.FieldType(func(s *sql.Selector) { + s.Where(sql.InValues(file.FieldColumn, fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, n := range neighbors { + fk := n.file_field + if fk == nil { + return nil, fmt.Errorf(`foreign-key "file_field" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return nil, fmt.Errorf(`unexpected foreign-key "file_field" returned %v for node %v`, *fk, n.ID) + } + node.Edges.Field = append(node.Edges.Field, n) + } + } + return nodes, nil } diff --git a/entc/integration/ent/file_update.go b/entc/integration/ent/file_update.go index 99c5b3baf..3807036a7 100644 --- a/entc/integration/ent/file_update.go +++ b/entc/integration/ent/file_update.go @@ -12,6 +12,7 @@ import ( "github.com/facebookincubator/ent/dialect/sql" "github.com/facebookincubator/ent/dialect/sql/sqlgraph" + "github.com/facebookincubator/ent/entc/integration/ent/fieldtype" "github.com/facebookincubator/ent/entc/integration/ent/file" "github.com/facebookincubator/ent/entc/integration/ent/filetype" "github.com/facebookincubator/ent/entc/integration/ent/predicate" @@ -138,6 +139,21 @@ func (fu *FileUpdate) SetType(f *FileType) *FileUpdate { return fu.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fu *FileUpdate) AddFieldIDs(ids ...int) *FileUpdate { + fu.mutation.AddFieldIDs(ids...) + return fu +} + +// AddField adds the field edges to FieldType. +func (fu *FileUpdate) AddField(f ...*FieldType) *FileUpdate { + ids := make([]int, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fu.AddFieldIDs(ids...) +} + // ClearOwner clears the owner edge to User. func (fu *FileUpdate) ClearOwner() *FileUpdate { fu.mutation.ClearOwner() @@ -150,6 +166,21 @@ func (fu *FileUpdate) ClearType() *FileUpdate { return fu } +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (fu *FileUpdate) RemoveFieldIDs(ids ...int) *FileUpdate { + fu.mutation.RemoveFieldIDs(ids...) + return fu +} + +// RemoveField removes field edges to FieldType. +func (fu *FileUpdate) RemoveField(f ...*FieldType) *FileUpdate { + ids := make([]int, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fu.RemoveFieldIDs(ids...) +} + // Save executes the query and returns the number of rows/vertices matched by this operation. func (fu *FileUpdate) Save(ctx context.Context) (int, error) { if v, ok := fu.mutation.Size(); ok { @@ -341,6 +372,44 @@ func (fu *FileUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if nodes := fu.mutation.RemovedFieldIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: file.FieldTable, + Columns: []string{file.FieldColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: fieldtype.FieldID, + }, + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := fu.mutation.FieldIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: file.FieldTable, + Columns: []string{file.FieldColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: fieldtype.FieldID, + }, + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, fu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{file.Label} @@ -464,6 +533,21 @@ func (fuo *FileUpdateOne) SetType(f *FileType) *FileUpdateOne { return fuo.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fuo *FileUpdateOne) AddFieldIDs(ids ...int) *FileUpdateOne { + fuo.mutation.AddFieldIDs(ids...) + return fuo +} + +// AddField adds the field edges to FieldType. +func (fuo *FileUpdateOne) AddField(f ...*FieldType) *FileUpdateOne { + ids := make([]int, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fuo.AddFieldIDs(ids...) +} + // ClearOwner clears the owner edge to User. func (fuo *FileUpdateOne) ClearOwner() *FileUpdateOne { fuo.mutation.ClearOwner() @@ -476,6 +560,21 @@ func (fuo *FileUpdateOne) ClearType() *FileUpdateOne { return fuo } +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (fuo *FileUpdateOne) RemoveFieldIDs(ids ...int) *FileUpdateOne { + fuo.mutation.RemoveFieldIDs(ids...) + return fuo +} + +// RemoveField removes field edges to FieldType. +func (fuo *FileUpdateOne) RemoveField(f ...*FieldType) *FileUpdateOne { + ids := make([]int, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fuo.RemoveFieldIDs(ids...) +} + // Save executes the query and returns the updated entity. func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { if v, ok := fuo.mutation.Size(); ok { @@ -665,6 +764,44 @@ func (fuo *FileUpdateOne) sqlSave(ctx context.Context) (f *File, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if nodes := fuo.mutation.RemovedFieldIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: file.FieldTable, + Columns: []string{file.FieldColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: fieldtype.FieldID, + }, + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := fuo.mutation.FieldIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: file.FieldTable, + Columns: []string{file.FieldColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeInt, + Column: fieldtype.FieldID, + }, + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } f = &File{config: fuo.config} _spec.Assign = f.assignValues _spec.ScanValues = f.scanValues() diff --git a/entc/integration/ent/migrate/schema.go b/entc/integration/ent/migrate/schema.go index f42c86243..e9fb50eee 100644 --- a/entc/integration/ent/migrate/schema.go +++ b/entc/integration/ent/migrate/schema.go @@ -77,13 +77,22 @@ var ( {Name: "state", Type: field.TypeEnum, Nullable: true, Enums: []string{"on", "off"}}, {Name: "optional_float", Type: field.TypeFloat64, Nullable: true}, {Name: "optional_float32", Type: field.TypeFloat32, Nullable: true}, + {Name: "file_field", Type: field.TypeInt, Nullable: true}, } // FieldTypesTable holds the schema information for the "field_types" table. FieldTypesTable = &schema.Table{ - Name: "field_types", - Columns: FieldTypesColumns, - PrimaryKey: []*schema.Column{FieldTypesColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "field_types", + Columns: FieldTypesColumns, + PrimaryKey: []*schema.Column{FieldTypesColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "field_types_files_field", + Columns: []*schema.Column{FieldTypesColumns[25]}, + + RefColumns: []*schema.Column{FilesColumns[0]}, + OnDelete: schema.SetNull, + }, + }, } // FilesColumns holds the columns for the "files" table. FilesColumns = []*schema.Column{ @@ -457,6 +466,7 @@ var ( func init() { CardsTable.ForeignKeys[0].RefTable = UsersTable + FieldTypesTable.ForeignKeys[0].RefTable = FilesTable FilesTable.ForeignKeys[0].RefTable = FileTypesTable FilesTable.ForeignKeys[1].RefTable = GroupsTable FilesTable.ForeignKeys[2].RefTable = UsersTable diff --git a/entc/integration/ent/mutation.go b/entc/integration/ent/mutation.go index 216b4e1fa..0f6c89993 100644 --- a/entc/integration/ent/mutation.go +++ b/entc/integration/ent/mutation.go @@ -120,7 +120,7 @@ func (m *CardMutation) CreateTime() (r time.Time, exists bool) { return *v, true } -// ResetCreateTime reset all changes of the create_time field. +// ResetCreateTime reset all changes of the "create_time" field. func (m *CardMutation) ResetCreateTime() { m.create_time = nil } @@ -139,7 +139,7 @@ func (m *CardMutation) UpdateTime() (r time.Time, exists bool) { return *v, true } -// ResetUpdateTime reset all changes of the update_time field. +// ResetUpdateTime reset all changes of the "update_time" field. func (m *CardMutation) ResetUpdateTime() { m.update_time = nil } @@ -158,7 +158,7 @@ func (m *CardMutation) Number() (r string, exists bool) { return *v, true } -// ResetNumber reset all changes of the number field. +// ResetNumber reset all changes of the "number" field. func (m *CardMutation) ResetNumber() { m.number = nil } @@ -189,7 +189,7 @@ func (m *CardMutation) NameCleared() bool { return ok } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *CardMutation) ResetName() { m.name = nil delete(m.clearedFields, card.FieldName) @@ -228,7 +228,7 @@ func (m *CardMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CardMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -270,7 +270,7 @@ func (m *CardMutation) SpecIDs() (ids []int) { return } -// ResetSpec reset all changes of the spec edge. +// ResetSpec reset all changes of the "spec" edge. func (m *CardMutation) ResetSpec() { m.spec = nil m.removedspec = nil @@ -621,7 +621,7 @@ func (m *CommentMutation) AddedUniqueInt() (r int, exists bool) { return *v, true } -// ResetUniqueInt reset all changes of the unique_int field. +// ResetUniqueInt reset all changes of the "unique_int" field. func (m *CommentMutation) ResetUniqueInt() { m.unique_int = nil m.addunique_int = nil @@ -660,7 +660,7 @@ func (m *CommentMutation) AddedUniqueFloat() (r float64, exists bool) { return *v, true } -// ResetUniqueFloat reset all changes of the unique_float field. +// ResetUniqueFloat reset all changes of the "unique_float" field. func (m *CommentMutation) ResetUniqueFloat() { m.unique_float = nil m.addunique_float = nil @@ -712,7 +712,7 @@ func (m *CommentMutation) NillableIntCleared() bool { return ok } -// ResetNillableInt reset all changes of the nillable_int field. +// ResetNillableInt reset all changes of the "nillable_int" field. func (m *CommentMutation) ResetNillableInt() { m.nillable_int = nil m.addnillable_int = nil @@ -1088,7 +1088,7 @@ func (m *FieldTypeMutation) AddedInt() (r int, exists bool) { return *v, true } -// ResetInt reset all changes of the int field. +// ResetInt reset all changes of the "int" field. func (m *FieldTypeMutation) ResetInt() { m.int = nil m.addint = nil @@ -1127,7 +1127,7 @@ func (m *FieldTypeMutation) AddedInt8() (r int8, exists bool) { return *v, true } -// ResetInt8 reset all changes of the int8 field. +// ResetInt8 reset all changes of the "int8" field. func (m *FieldTypeMutation) ResetInt8() { m.int8 = nil m.addint8 = nil @@ -1166,7 +1166,7 @@ func (m *FieldTypeMutation) AddedInt16() (r int16, exists bool) { return *v, true } -// ResetInt16 reset all changes of the int16 field. +// ResetInt16 reset all changes of the "int16" field. func (m *FieldTypeMutation) ResetInt16() { m.int16 = nil m.addint16 = nil @@ -1205,7 +1205,7 @@ func (m *FieldTypeMutation) AddedInt32() (r int32, exists bool) { return *v, true } -// ResetInt32 reset all changes of the int32 field. +// ResetInt32 reset all changes of the "int32" field. func (m *FieldTypeMutation) ResetInt32() { m.int32 = nil m.addint32 = nil @@ -1244,7 +1244,7 @@ func (m *FieldTypeMutation) AddedInt64() (r int64, exists bool) { return *v, true } -// ResetInt64 reset all changes of the int64 field. +// ResetInt64 reset all changes of the "int64" field. func (m *FieldTypeMutation) ResetInt64() { m.int64 = nil m.addint64 = nil @@ -1296,7 +1296,7 @@ func (m *FieldTypeMutation) OptionalIntCleared() bool { return ok } -// ResetOptionalInt reset all changes of the optional_int field. +// ResetOptionalInt reset all changes of the "optional_int" field. func (m *FieldTypeMutation) ResetOptionalInt() { m.optional_int = nil m.addoptional_int = nil @@ -1349,7 +1349,7 @@ func (m *FieldTypeMutation) OptionalInt8Cleared() bool { return ok } -// ResetOptionalInt8 reset all changes of the optional_int8 field. +// ResetOptionalInt8 reset all changes of the "optional_int8" field. func (m *FieldTypeMutation) ResetOptionalInt8() { m.optional_int8 = nil m.addoptional_int8 = nil @@ -1402,7 +1402,7 @@ func (m *FieldTypeMutation) OptionalInt16Cleared() bool { return ok } -// ResetOptionalInt16 reset all changes of the optional_int16 field. +// ResetOptionalInt16 reset all changes of the "optional_int16" field. func (m *FieldTypeMutation) ResetOptionalInt16() { m.optional_int16 = nil m.addoptional_int16 = nil @@ -1455,7 +1455,7 @@ func (m *FieldTypeMutation) OptionalInt32Cleared() bool { return ok } -// ResetOptionalInt32 reset all changes of the optional_int32 field. +// ResetOptionalInt32 reset all changes of the "optional_int32" field. func (m *FieldTypeMutation) ResetOptionalInt32() { m.optional_int32 = nil m.addoptional_int32 = nil @@ -1508,7 +1508,7 @@ func (m *FieldTypeMutation) OptionalInt64Cleared() bool { return ok } -// ResetOptionalInt64 reset all changes of the optional_int64 field. +// ResetOptionalInt64 reset all changes of the "optional_int64" field. func (m *FieldTypeMutation) ResetOptionalInt64() { m.optional_int64 = nil m.addoptional_int64 = nil @@ -1561,7 +1561,7 @@ func (m *FieldTypeMutation) NillableIntCleared() bool { return ok } -// ResetNillableInt reset all changes of the nillable_int field. +// ResetNillableInt reset all changes of the "nillable_int" field. func (m *FieldTypeMutation) ResetNillableInt() { m.nillable_int = nil m.addnillable_int = nil @@ -1614,7 +1614,7 @@ func (m *FieldTypeMutation) NillableInt8Cleared() bool { return ok } -// ResetNillableInt8 reset all changes of the nillable_int8 field. +// ResetNillableInt8 reset all changes of the "nillable_int8" field. func (m *FieldTypeMutation) ResetNillableInt8() { m.nillable_int8 = nil m.addnillable_int8 = nil @@ -1667,7 +1667,7 @@ func (m *FieldTypeMutation) NillableInt16Cleared() bool { return ok } -// ResetNillableInt16 reset all changes of the nillable_int16 field. +// ResetNillableInt16 reset all changes of the "nillable_int16" field. func (m *FieldTypeMutation) ResetNillableInt16() { m.nillable_int16 = nil m.addnillable_int16 = nil @@ -1720,7 +1720,7 @@ func (m *FieldTypeMutation) NillableInt32Cleared() bool { return ok } -// ResetNillableInt32 reset all changes of the nillable_int32 field. +// ResetNillableInt32 reset all changes of the "nillable_int32" field. func (m *FieldTypeMutation) ResetNillableInt32() { m.nillable_int32 = nil m.addnillable_int32 = nil @@ -1773,7 +1773,7 @@ func (m *FieldTypeMutation) NillableInt64Cleared() bool { return ok } -// ResetNillableInt64 reset all changes of the nillable_int64 field. +// ResetNillableInt64 reset all changes of the "nillable_int64" field. func (m *FieldTypeMutation) ResetNillableInt64() { m.nillable_int64 = nil m.addnillable_int64 = nil @@ -1826,7 +1826,7 @@ func (m *FieldTypeMutation) ValidateOptionalInt32Cleared() bool { return ok } -// ResetValidateOptionalInt32 reset all changes of the validate_optional_int32 field. +// ResetValidateOptionalInt32 reset all changes of the "validate_optional_int32" field. func (m *FieldTypeMutation) ResetValidateOptionalInt32() { m.validate_optional_int32 = nil m.addvalidate_optional_int32 = nil @@ -1879,7 +1879,7 @@ func (m *FieldTypeMutation) OptionalUintCleared() bool { return ok } -// ResetOptionalUint reset all changes of the optional_uint field. +// ResetOptionalUint reset all changes of the "optional_uint" field. func (m *FieldTypeMutation) ResetOptionalUint() { m.optional_uint = nil m.addoptional_uint = nil @@ -1932,7 +1932,7 @@ func (m *FieldTypeMutation) OptionalUint8Cleared() bool { return ok } -// ResetOptionalUint8 reset all changes of the optional_uint8 field. +// ResetOptionalUint8 reset all changes of the "optional_uint8" field. func (m *FieldTypeMutation) ResetOptionalUint8() { m.optional_uint8 = nil m.addoptional_uint8 = nil @@ -1985,7 +1985,7 @@ func (m *FieldTypeMutation) OptionalUint16Cleared() bool { return ok } -// ResetOptionalUint16 reset all changes of the optional_uint16 field. +// ResetOptionalUint16 reset all changes of the "optional_uint16" field. func (m *FieldTypeMutation) ResetOptionalUint16() { m.optional_uint16 = nil m.addoptional_uint16 = nil @@ -2038,7 +2038,7 @@ func (m *FieldTypeMutation) OptionalUint32Cleared() bool { return ok } -// ResetOptionalUint32 reset all changes of the optional_uint32 field. +// ResetOptionalUint32 reset all changes of the "optional_uint32" field. func (m *FieldTypeMutation) ResetOptionalUint32() { m.optional_uint32 = nil m.addoptional_uint32 = nil @@ -2091,7 +2091,7 @@ func (m *FieldTypeMutation) OptionalUint64Cleared() bool { return ok } -// ResetOptionalUint64 reset all changes of the optional_uint64 field. +// ResetOptionalUint64 reset all changes of the "optional_uint64" field. func (m *FieldTypeMutation) ResetOptionalUint64() { m.optional_uint64 = nil m.addoptional_uint64 = nil @@ -2124,7 +2124,7 @@ func (m *FieldTypeMutation) StateCleared() bool { return ok } -// ResetState reset all changes of the state field. +// ResetState reset all changes of the "state" field. func (m *FieldTypeMutation) ResetState() { m.state = nil delete(m.clearedFields, fieldtype.FieldState) @@ -2176,7 +2176,7 @@ func (m *FieldTypeMutation) OptionalFloatCleared() bool { return ok } -// ResetOptionalFloat reset all changes of the optional_float field. +// ResetOptionalFloat reset all changes of the "optional_float" field. func (m *FieldTypeMutation) ResetOptionalFloat() { m.optional_float = nil m.addoptional_float = nil @@ -2229,7 +2229,7 @@ func (m *FieldTypeMutation) OptionalFloat32Cleared() bool { return ok } -// ResetOptionalFloat32 reset all changes of the optional_float32 field. +// ResetOptionalFloat32 reset all changes of the "optional_float32" field. func (m *FieldTypeMutation) ResetOptionalFloat32() { m.optional_float32 = nil m.addoptional_float32 = nil @@ -3155,6 +3155,8 @@ type FileMutation struct { clearedowner bool _type *int cleared_type bool + field map[int]struct{} + removedfield map[int]struct{} } var _ ent.Mutation = (*FileMutation)(nil) @@ -3230,7 +3232,7 @@ func (m *FileMutation) AddedSize() (r int, exists bool) { return *v, true } -// ResetSize reset all changes of the size field. +// ResetSize reset all changes of the "size" field. func (m *FileMutation) ResetSize() { m.size = nil m.addsize = nil @@ -3250,7 +3252,7 @@ func (m *FileMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *FileMutation) ResetName() { m.name = nil } @@ -3281,7 +3283,7 @@ func (m *FileMutation) UserCleared() bool { return ok } -// ResetUser reset all changes of the user field. +// ResetUser reset all changes of the "user" field. func (m *FileMutation) ResetUser() { m.user = nil delete(m.clearedFields, file.FieldUser) @@ -3313,7 +3315,7 @@ func (m *FileMutation) GroupCleared() bool { return ok } -// ResetGroup reset all changes of the group field. +// ResetGroup reset all changes of the "group" field. func (m *FileMutation) ResetGroup() { m.group = nil delete(m.clearedFields, file.FieldGroup) @@ -3352,7 +3354,7 @@ func (m *FileMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *FileMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -3391,12 +3393,54 @@ func (m *FileMutation) TypeIDs() (ids []int) { return } -// ResetType reset all changes of the type edge. +// ResetType reset all changes of the "type" edge. func (m *FileMutation) ResetType() { m._type = nil m.cleared_type = false } +// AddFieldIDs adds the field edge to FieldType by ids. +func (m *FileMutation) AddFieldIDs(ids ...int) { + if m.field == nil { + m.field = make(map[int]struct{}) + } + for i := range ids { + m.field[ids[i]] = struct{}{} + } +} + +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (m *FileMutation) RemoveFieldIDs(ids ...int) { + if m.removedfield == nil { + m.removedfield = make(map[int]struct{}) + } + for i := range ids { + m.removedfield[ids[i]] = struct{}{} + } +} + +// RemovedField returns the removed ids of field. +func (m *FileMutation) RemovedFieldIDs() (ids []int) { + for id := range m.removedfield { + ids = append(ids, id) + } + return +} + +// FieldIDs returns the field ids in the mutation. +func (m *FileMutation) FieldIDs() (ids []int) { + for id := range m.field { + ids = append(ids, id) + } + return +} + +// ResetFieldEdge reset all changes of the "field" edge. +func (m *FileMutation) ResetFieldEdge() { + m.field = nil + m.removedfield = nil +} + // Op returns the operation name. func (m *FileMutation) Op() Op { return m.op @@ -3576,13 +3620,16 @@ func (m *FileMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this // mutation. func (m *FileMutation) AddedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.owner != nil { edges = append(edges, file.EdgeOwner) } if m._type != nil { edges = append(edges, file.EdgeType) } + if m.field != nil { + edges = append(edges, file.EdgeField) + } return edges } @@ -3598,6 +3645,12 @@ func (m *FileMutation) AddedIDs(name string) []ent.Value { if id := m._type; id != nil { return []ent.Value{*id} } + case file.EdgeField: + ids := make([]ent.Value, 0, len(m.field)) + for id := range m.field { + ids = append(ids, id) + } + return ids } return nil } @@ -3605,7 +3658,10 @@ func (m *FileMutation) AddedIDs(name string) []ent.Value { // RemovedEdges returns all edge names that were removed in this // mutation. func (m *FileMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) + if m.removedfield != nil { + edges = append(edges, file.EdgeField) + } return edges } @@ -3613,6 +3669,12 @@ func (m *FileMutation) RemovedEdges() []string { // the given edge name. func (m *FileMutation) RemovedIDs(name string) []ent.Value { switch name { + case file.EdgeField: + ids := make([]ent.Value, 0, len(m.removedfield)) + for id := range m.removedfield { + ids = append(ids, id) + } + return ids } return nil } @@ -3620,7 +3682,7 @@ func (m *FileMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this // mutation. func (m *FileMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.clearedowner { edges = append(edges, file.EdgeOwner) } @@ -3667,6 +3729,9 @@ func (m *FileMutation) ResetEdge(name string) error { case file.EdgeType: m.ResetType() return nil + case file.EdgeField: + m.ResetFieldEdge() + return nil } return fmt.Errorf("unknown File edge %s", name) } @@ -3738,7 +3803,7 @@ func (m *FileTypeMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *FileTypeMutation) ResetName() { m.name = nil } @@ -3779,7 +3844,7 @@ func (m *FileTypeMutation) FilesIDs() (ids []int) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *FileTypeMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -4047,7 +4112,7 @@ func (m *GroupMutation) Active() (r bool, exists bool) { return *v, true } -// ResetActive reset all changes of the active field. +// ResetActive reset all changes of the "active" field. func (m *GroupMutation) ResetActive() { m.active = nil } @@ -4066,7 +4131,7 @@ func (m *GroupMutation) Expire() (r time.Time, exists bool) { return *v, true } -// ResetExpire reset all changes of the expire field. +// ResetExpire reset all changes of the "expire" field. func (m *GroupMutation) ResetExpire() { m.expire = nil } @@ -4097,7 +4162,7 @@ func (m *GroupMutation) TypeCleared() bool { return ok } -// ResetType reset all changes of the type field. +// ResetType reset all changes of the "type" field. func (m *GroupMutation) ResetType() { m._type = nil delete(m.clearedFields, group.FieldType) @@ -4149,7 +4214,7 @@ func (m *GroupMutation) MaxUsersCleared() bool { return ok } -// ResetMaxUsers reset all changes of the max_users field. +// ResetMaxUsers reset all changes of the "max_users" field. func (m *GroupMutation) ResetMaxUsers() { m.max_users = nil m.addmax_users = nil @@ -4170,7 +4235,7 @@ func (m *GroupMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GroupMutation) ResetName() { m.name = nil } @@ -4211,7 +4276,7 @@ func (m *GroupMutation) FilesIDs() (ids []int) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *GroupMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -4253,7 +4318,7 @@ func (m *GroupMutation) BlockedIDs() (ids []int) { return } -// ResetBlocked reset all changes of the blocked edge. +// ResetBlocked reset all changes of the "blocked" edge. func (m *GroupMutation) ResetBlocked() { m.blocked = nil m.removedblocked = nil @@ -4295,7 +4360,7 @@ func (m *GroupMutation) UsersIDs() (ids []int) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -4334,7 +4399,7 @@ func (m *GroupMutation) InfoIDs() (ids []int) { return } -// ResetInfo reset all changes of the info edge. +// ResetInfo reset all changes of the "info" edge. func (m *GroupMutation) ResetInfo() { m.info = nil m.clearedinfo = false @@ -4743,7 +4808,7 @@ func (m *GroupInfoMutation) Desc() (r string, exists bool) { return *v, true } -// ResetDesc reset all changes of the desc field. +// ResetDesc reset all changes of the "desc" field. func (m *GroupInfoMutation) ResetDesc() { m.desc = nil } @@ -4781,7 +4846,7 @@ func (m *GroupInfoMutation) AddedMaxUsers() (r int, exists bool) { return *v, true } -// ResetMaxUsers reset all changes of the max_users field. +// ResetMaxUsers reset all changes of the "max_users" field. func (m *GroupInfoMutation) ResetMaxUsers() { m.max_users = nil m.addmax_users = nil @@ -4823,7 +4888,7 @@ func (m *GroupInfoMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *GroupInfoMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -5341,7 +5406,7 @@ func (m *NodeMutation) ValueCleared() bool { return ok } -// ResetValue reset all changes of the value field. +// ResetValue reset all changes of the "value" field. func (m *NodeMutation) ResetValue() { m.value = nil m.addvalue = nil @@ -5381,7 +5446,7 @@ func (m *NodeMutation) PrevIDs() (ids []int) { return } -// ResetPrev reset all changes of the prev edge. +// ResetPrev reset all changes of the "prev" edge. func (m *NodeMutation) ResetPrev() { m.prev = nil m.clearedprev = false @@ -5420,7 +5485,7 @@ func (m *NodeMutation) NextIDs() (ids []int) { return } -// ResetNext reset all changes of the next edge. +// ResetNext reset all changes of the "next" edge. func (m *NodeMutation) ResetNext() { m.next = nil m.clearednext = false @@ -5718,7 +5783,7 @@ func (m *PetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *PetMutation) ResetName() { m.name = nil } @@ -5756,7 +5821,7 @@ func (m *PetMutation) TeamIDs() (ids []int) { return } -// ResetTeam reset all changes of the team edge. +// ResetTeam reset all changes of the "team" edge. func (m *PetMutation) ResetTeam() { m.team = nil m.clearedteam = false @@ -5795,7 +5860,7 @@ func (m *PetMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -6088,7 +6153,7 @@ func (m *SpecMutation) CardIDs() (ids []int) { return } -// ResetCard reset all changes of the card edge. +// ResetCard reset all changes of the "card" edge. func (m *SpecMutation) ResetCard() { m.card = nil m.removedcard = nil @@ -6392,7 +6457,7 @@ func (m *UserMutation) OptionalIntCleared() bool { return ok } -// ResetOptionalInt reset all changes of the optional_int field. +// ResetOptionalInt reset all changes of the "optional_int" field. func (m *UserMutation) ResetOptionalInt() { m.optional_int = nil m.addoptional_int = nil @@ -6432,7 +6497,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -6452,7 +6517,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -6471,7 +6536,7 @@ func (m *UserMutation) Last() (r string, exists bool) { return *v, true } -// ResetLast reset all changes of the last field. +// ResetLast reset all changes of the "last" field. func (m *UserMutation) ResetLast() { m.last = nil } @@ -6502,7 +6567,7 @@ func (m *UserMutation) NicknameCleared() bool { return ok } -// ResetNickname reset all changes of the nickname field. +// ResetNickname reset all changes of the "nickname" field. func (m *UserMutation) ResetNickname() { m.nickname = nil delete(m.clearedFields, user.FieldNickname) @@ -6534,7 +6599,7 @@ func (m *UserMutation) PhoneCleared() bool { return ok } -// ResetPhone reset all changes of the phone field. +// ResetPhone reset all changes of the "phone" field. func (m *UserMutation) ResetPhone() { m.phone = nil delete(m.clearedFields, user.FieldPhone) @@ -6566,7 +6631,7 @@ func (m *UserMutation) PasswordCleared() bool { return ok } -// ResetPassword reset all changes of the password field. +// ResetPassword reset all changes of the "password" field. func (m *UserMutation) ResetPassword() { m.password = nil delete(m.clearedFields, user.FieldPassword) @@ -6586,7 +6651,7 @@ func (m *UserMutation) Role() (r user.Role, exists bool) { return *v, true } -// ResetRole reset all changes of the role field. +// ResetRole reset all changes of the "role" field. func (m *UserMutation) ResetRole() { m.role = nil } @@ -6617,7 +6682,7 @@ func (m *UserMutation) SSOCertCleared() bool { return ok } -// ResetSSOCert reset all changes of the SSOCert field. +// ResetSSOCert reset all changes of the "SSOCert" field. func (m *UserMutation) ResetSSOCert() { m._SSOCert = nil delete(m.clearedFields, user.FieldSSOCert) @@ -6656,7 +6721,7 @@ func (m *UserMutation) CardIDs() (ids []int) { return } -// ResetCard reset all changes of the card edge. +// ResetCard reset all changes of the "card" edge. func (m *UserMutation) ResetCard() { m.card = nil m.clearedcard = false @@ -6698,7 +6763,7 @@ func (m *UserMutation) PetsIDs() (ids []int) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil @@ -6740,7 +6805,7 @@ func (m *UserMutation) FilesIDs() (ids []int) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *UserMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -6782,7 +6847,7 @@ func (m *UserMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -6824,7 +6889,7 @@ func (m *UserMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -6866,7 +6931,7 @@ func (m *UserMutation) FollowersIDs() (ids []int) { return } -// ResetFollowers reset all changes of the followers edge. +// ResetFollowers reset all changes of the "followers" edge. func (m *UserMutation) ResetFollowers() { m.followers = nil m.removedfollowers = nil @@ -6908,7 +6973,7 @@ func (m *UserMutation) FollowingIDs() (ids []int) { return } -// ResetFollowing reset all changes of the following edge. +// ResetFollowing reset all changes of the "following" edge. func (m *UserMutation) ResetFollowing() { m.following = nil m.removedfollowing = nil @@ -6947,7 +7012,7 @@ func (m *UserMutation) TeamIDs() (ids []int) { return } -// ResetTeam reset all changes of the team edge. +// ResetTeam reset all changes of the "team" edge. func (m *UserMutation) ResetTeam() { m.team = nil m.clearedteam = false @@ -6986,7 +7051,7 @@ func (m *UserMutation) SpouseIDs() (ids []int) { return } -// ResetSpouse reset all changes of the spouse edge. +// ResetSpouse reset all changes of the "spouse" edge. func (m *UserMutation) ResetSpouse() { m.spouse = nil m.clearedspouse = false @@ -7028,7 +7093,7 @@ func (m *UserMutation) ChildrenIDs() (ids []int) { return } -// ResetChildren reset all changes of the children edge. +// ResetChildren reset all changes of the "children" edge. func (m *UserMutation) ResetChildren() { m.children = nil m.removedchildren = nil @@ -7067,7 +7132,7 @@ func (m *UserMutation) ParentIDs() (ids []int) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *UserMutation) ResetParent() { m.parent = nil m.clearedparent = false diff --git a/entc/integration/ent/schema/file.go b/entc/integration/ent/schema/file.go index 1ed79ddc6..7de5c7ec2 100644 --- a/entc/integration/ent/schema/file.go +++ b/entc/integration/ent/schema/file.go @@ -43,6 +43,7 @@ func (File) Edges() []ent.Edge { edge.From("type", FileType.Type). Ref("files"). Unique(), + edge.To("field", FieldType.Type), } } diff --git a/entc/integration/gremlin/ent/client.go b/entc/integration/gremlin/ent/client.go index 7636c6d5a..7a522a9bb 100644 --- a/entc/integration/gremlin/ent/client.go +++ b/entc/integration/gremlin/ent/client.go @@ -546,6 +546,17 @@ func (c *FileClient) QueryType(f *File) *FileTypeQuery { return query } +// QueryField queries the field edge of a File. +func (c *FileClient) QueryField(f *File) *FieldTypeQuery { + query := &FieldTypeQuery{config: c.config} + query.path = func(ctx context.Context) (fromV *dsl.Traversal, _ error) { + + fromV = g.V(f.ID).OutE(file.FieldLabel).InV() + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *FileClient) Hooks() []Hook { return c.hooks.File diff --git a/entc/integration/gremlin/ent/file.go b/entc/integration/gremlin/ent/file.go index b5ab891b7..8c068160b 100644 --- a/entc/integration/gremlin/ent/file.go +++ b/entc/integration/gremlin/ent/file.go @@ -39,9 +39,11 @@ type FileEdges struct { Owner *User // Type holds the value of the type edge. Type *FileType + // Field holds the value of the field edge. + Field []*FieldType // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [2]bool + loadedTypes [3]bool } // OwnerOrErr returns the Owner value or an error if the edge @@ -72,6 +74,15 @@ func (e FileEdges) TypeOrErr() (*FileType, error) { return nil, &NotLoadedError{edge: "type"} } +// FieldOrErr returns the Field value or an error if the edge +// was not loaded in eager-loading. +func (e FileEdges) FieldOrErr() ([]*FieldType, error) { + if e.loadedTypes[2] { + return e.Field, nil + } + return nil, &NotLoadedError{edge: "field"} +} + // FromResponse scans the gremlin response data into File. func (f *File) FromResponse(res *gremlin.Response) error { vmap, err := res.ReadValueMap() @@ -106,6 +117,11 @@ func (f *File) QueryType() *FileTypeQuery { return (&FileClient{config: f.config}).QueryType(f) } +// QueryField queries the field edge of the File. +func (f *File) QueryField() *FieldTypeQuery { + return (&FileClient{config: f.config}).QueryField(f) +} + // Update returns a builder for updating this File. // Note that, you need to call File.Unwrap() before calling this method, if this File // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/entc/integration/gremlin/ent/file/file.go b/entc/integration/gremlin/ent/file/file.go index c214ff60a..0d76ea17e 100644 --- a/entc/integration/gremlin/ent/file/file.go +++ b/entc/integration/gremlin/ent/file/file.go @@ -20,11 +20,15 @@ const ( EdgeOwner = "owner" // EdgeType holds the string denoting the type edge name in mutations. EdgeType = "type" + // EdgeField holds the string denoting the field edge name in mutations. + EdgeField = "field" // OwnerInverseLabel holds the string label denoting the owner inverse edge type in the database. OwnerInverseLabel = "user_files" // TypeInverseLabel holds the string label denoting the type inverse edge type in the database. TypeInverseLabel = "file_type_files" + // FieldLabel holds the string label denoting the field edge type in the database. + FieldLabel = "file_field" ) var ( diff --git a/entc/integration/gremlin/ent/file/where.go b/entc/integration/gremlin/ent/file/where.go index 4e54104d7..a78d04d6d 100644 --- a/entc/integration/gremlin/ent/file/where.go +++ b/entc/integration/gremlin/ent/file/where.go @@ -495,6 +495,24 @@ func HasTypeWith(preds ...predicate.FileType) predicate.File { }) } +// HasField applies the HasEdge predicate on the "field" edge. +func HasField() predicate.File { + return predicate.File(func(t *dsl.Traversal) { + t.OutE(FieldLabel).OutV() + }) +} + +// HasFieldWith applies the HasEdge predicate on the "field" edge with a given conditions (other predicates). +func HasFieldWith(preds ...predicate.FieldType) predicate.File { + return predicate.File(func(t *dsl.Traversal) { + tr := __.InV() + for _, p := range preds { + p(tr) + } + t.OutE(FieldLabel).Where(tr).OutV() + }) +} + // And groups list of predicates with the AND operator between them. func And(predicates ...predicate.File) predicate.File { return predicate.File(func(tr *dsl.Traversal) { diff --git a/entc/integration/gremlin/ent/file_create.go b/entc/integration/gremlin/ent/file_create.go index 5153d4baf..2d54b400d 100644 --- a/entc/integration/gremlin/ent/file_create.go +++ b/entc/integration/gremlin/ent/file_create.go @@ -13,7 +13,9 @@ import ( "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl" + "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/__" "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/p" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/file" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/filetype" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/user" @@ -112,6 +114,21 @@ func (fc *FileCreate) SetType(f *FileType) *FileCreate { return fc.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fc *FileCreate) AddFieldIDs(ids ...string) *FileCreate { + fc.mutation.AddFieldIDs(ids...) + return fc +} + +// AddField adds the field edges to FieldType. +func (fc *FileCreate) AddField(f ...*FieldType) *FileCreate { + ids := make([]string, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fc.AddFieldIDs(ids...) +} + // Save creates the File in the database. func (fc *FileCreate) Save(ctx context.Context) (*File, error) { if _, ok := fc.mutation.Size(); !ok { @@ -178,6 +195,11 @@ func (fc *FileCreate) gremlinSave(ctx context.Context) (*File, error) { } func (fc *FileCreate) gremlin() *dsl.Traversal { + type constraint struct { + pred *dsl.Traversal // constraint predicate. + test *dsl.Traversal // test matches and its constant. + } + constraints := make([]*constraint, 0, 1) v := g.AddV(file.Label) if value, ok := fc.mutation.Size(); ok { v.Property(dsl.Single, file.FieldSize, value) @@ -197,5 +219,19 @@ func (fc *FileCreate) gremlin() *dsl.Traversal { for _, id := range fc.mutation.TypeIDs() { v.AddE(filetype.FilesLabel).From(g.V(id)).InV() } - return v.ValueMap(true) + for _, id := range fc.mutation.FieldIDs() { + v.AddE(file.FieldLabel).To(g.V(id)).OutV() + constraints = append(constraints, &constraint{ + pred: g.E().HasLabel(file.FieldLabel).InV().HasID(id).Count(), + test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(file.Label, file.FieldLabel, id)), + }) + } + if len(constraints) == 0 { + return v.ValueMap(true) + } + tr := constraints[0].pred.Coalesce(constraints[0].test, v.ValueMap(true)) + for _, cr := range constraints[1:] { + tr = cr.pred.Coalesce(cr.test, tr) + } + return tr } diff --git a/entc/integration/gremlin/ent/file_query.go b/entc/integration/gremlin/ent/file_query.go index e960f6db4..89e66bf5c 100644 --- a/entc/integration/gremlin/ent/file_query.go +++ b/entc/integration/gremlin/ent/file_query.go @@ -32,6 +32,7 @@ type FileQuery struct { // eager-loading edges. withOwner *UserQuery withType *FileTypeQuery + withField *FieldTypeQuery // intermediate query (i.e. traversal path). gremlin *dsl.Traversal path func(context.Context) (*dsl.Traversal, error) @@ -89,6 +90,20 @@ func (fq *FileQuery) QueryType() *FileTypeQuery { return query } +// QueryField chains the current query on the field edge. +func (fq *FileQuery) QueryField() *FieldTypeQuery { + query := &FieldTypeQuery{config: fq.config} + query.path = func(ctx context.Context) (fromU *dsl.Traversal, err error) { + if err := fq.prepareQuery(ctx); err != nil { + return nil, err + } + gremlin := fq.gremlinQuery() + fromU = gremlin.OutE(file.FieldLabel).InV() + return fromU, nil + } + return query +} + // First returns the first File entity in the query. Returns *NotFoundError when no file was found. func (fq *FileQuery) First(ctx context.Context) (*File, error) { fs, err := fq.Limit(1).All(ctx) @@ -290,6 +305,17 @@ func (fq *FileQuery) WithType(opts ...func(*FileTypeQuery)) *FileQuery { return fq } +// WithField tells the query-builder to eager-loads the nodes that are connected to +// the "field" edge. The optional arguments used to configure the query builder of the edge. +func (fq *FileQuery) WithField(opts ...func(*FieldTypeQuery)) *FileQuery { + query := &FieldTypeQuery{config: fq.config} + for _, opt := range opts { + opt(query) + } + fq.withField = query + return fq +} + // GroupBy used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // diff --git a/entc/integration/gremlin/ent/file_update.go b/entc/integration/gremlin/ent/file_update.go index 62c63b86b..fbeb1bbfa 100644 --- a/entc/integration/gremlin/ent/file_update.go +++ b/entc/integration/gremlin/ent/file_update.go @@ -14,6 +14,7 @@ import ( "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl" "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/__" "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/g" + "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl/p" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/file" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/filetype" "github.com/facebookincubator/ent/entc/integration/gremlin/ent/predicate" @@ -139,6 +140,21 @@ func (fu *FileUpdate) SetType(f *FileType) *FileUpdate { return fu.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fu *FileUpdate) AddFieldIDs(ids ...string) *FileUpdate { + fu.mutation.AddFieldIDs(ids...) + return fu +} + +// AddField adds the field edges to FieldType. +func (fu *FileUpdate) AddField(f ...*FieldType) *FileUpdate { + ids := make([]string, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fu.AddFieldIDs(ids...) +} + // ClearOwner clears the owner edge to User. func (fu *FileUpdate) ClearOwner() *FileUpdate { fu.mutation.ClearOwner() @@ -151,6 +167,21 @@ func (fu *FileUpdate) ClearType() *FileUpdate { return fu } +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (fu *FileUpdate) RemoveFieldIDs(ids ...string) *FileUpdate { + fu.mutation.RemoveFieldIDs(ids...) + return fu +} + +// RemoveField removes field edges to FieldType. +func (fu *FileUpdate) RemoveField(f ...*FieldType) *FileUpdate { + ids := make([]string, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fu.RemoveFieldIDs(ids...) +} + // Save executes the query and returns the number of rows/vertices matched by this operation. func (fu *FileUpdate) Save(ctx context.Context) (int, error) { if v, ok := fu.mutation.Size(); ok { @@ -220,6 +251,11 @@ func (fu *FileUpdate) gremlinSave(ctx context.Context) (int, error) { } func (fu *FileUpdate) gremlin() *dsl.Traversal { + type constraint struct { + pred *dsl.Traversal // constraint predicate. + test *dsl.Traversal // test matches and its constant. + } + constraints := make([]*constraint, 0, 1) v := g.V().HasLabel(file.Label) for _, p := range fu.predicates { p(v) @@ -269,7 +305,28 @@ func (fu *FileUpdate) gremlin() *dsl.Traversal { for _, id := range fu.mutation.TypeIDs() { v.AddE(filetype.FilesLabel).From(g.V(id)).InV() } + for _, id := range fu.mutation.RemovedFieldIDs() { + tr := rv.Clone().OutE(file.FieldLabel).Where(__.OtherV().HasID(id)).Drop().Iterate() + trs = append(trs, tr) + } + for _, id := range fu.mutation.FieldIDs() { + v.AddE(file.FieldLabel).To(g.V(id)).OutV() + constraints = append(constraints, &constraint{ + pred: g.E().HasLabel(file.FieldLabel).InV().HasID(id).Count(), + test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(file.Label, file.FieldLabel, id)), + }) + } v.Count() + if len(constraints) > 0 { + constraints = append(constraints, &constraint{ + pred: rv.Count(), + test: __.Is(p.GT(1)).Constant(&ConstraintError{msg: "update traversal contains more than one vertex"}), + }) + v = constraints[0].pred.Coalesce(constraints[0].test, v) + for _, cr := range constraints[1:] { + v = cr.pred.Coalesce(cr.test, v) + } + } trs = append(trs, v) return dsl.Join(trs...) } @@ -386,6 +443,21 @@ func (fuo *FileUpdateOne) SetType(f *FileType) *FileUpdateOne { return fuo.SetTypeID(f.ID) } +// AddFieldIDs adds the field edge to FieldType by ids. +func (fuo *FileUpdateOne) AddFieldIDs(ids ...string) *FileUpdateOne { + fuo.mutation.AddFieldIDs(ids...) + return fuo +} + +// AddField adds the field edges to FieldType. +func (fuo *FileUpdateOne) AddField(f ...*FieldType) *FileUpdateOne { + ids := make([]string, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fuo.AddFieldIDs(ids...) +} + // ClearOwner clears the owner edge to User. func (fuo *FileUpdateOne) ClearOwner() *FileUpdateOne { fuo.mutation.ClearOwner() @@ -398,6 +470,21 @@ func (fuo *FileUpdateOne) ClearType() *FileUpdateOne { return fuo } +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (fuo *FileUpdateOne) RemoveFieldIDs(ids ...string) *FileUpdateOne { + fuo.mutation.RemoveFieldIDs(ids...) + return fuo +} + +// RemoveField removes field edges to FieldType. +func (fuo *FileUpdateOne) RemoveField(f ...*FieldType) *FileUpdateOne { + ids := make([]string, len(f)) + for i := range f { + ids[i] = f[i].ID + } + return fuo.RemoveFieldIDs(ids...) +} + // Save executes the query and returns the updated entity. func (fuo *FileUpdateOne) Save(ctx context.Context) (*File, error) { if v, ok := fuo.mutation.Size(); ok { @@ -475,6 +562,11 @@ func (fuo *FileUpdateOne) gremlinSave(ctx context.Context) (*File, error) { } func (fuo *FileUpdateOne) gremlin(id string) *dsl.Traversal { + type constraint struct { + pred *dsl.Traversal // constraint predicate. + test *dsl.Traversal // test matches and its constant. + } + constraints := make([]*constraint, 0, 1) v := g.V(id) var ( rv = v.Clone() @@ -521,7 +613,24 @@ func (fuo *FileUpdateOne) gremlin(id string) *dsl.Traversal { for _, id := range fuo.mutation.TypeIDs() { v.AddE(filetype.FilesLabel).From(g.V(id)).InV() } + for _, id := range fuo.mutation.RemovedFieldIDs() { + tr := rv.Clone().OutE(file.FieldLabel).Where(__.OtherV().HasID(id)).Drop().Iterate() + trs = append(trs, tr) + } + for _, id := range fuo.mutation.FieldIDs() { + v.AddE(file.FieldLabel).To(g.V(id)).OutV() + constraints = append(constraints, &constraint{ + pred: g.E().HasLabel(file.FieldLabel).InV().HasID(id).Count(), + test: __.Is(p.NEQ(0)).Constant(NewErrUniqueEdge(file.Label, file.FieldLabel, id)), + }) + } v.ValueMap(true) + if len(constraints) > 0 { + v = constraints[0].pred.Coalesce(constraints[0].test, v) + for _, cr := range constraints[1:] { + v = cr.pred.Coalesce(cr.test, v) + } + } trs = append(trs, v) return dsl.Join(trs...) } diff --git a/entc/integration/gremlin/ent/mutation.go b/entc/integration/gremlin/ent/mutation.go index 0196b46e9..47f0a35a8 100644 --- a/entc/integration/gremlin/ent/mutation.go +++ b/entc/integration/gremlin/ent/mutation.go @@ -120,7 +120,7 @@ func (m *CardMutation) CreateTime() (r time.Time, exists bool) { return *v, true } -// ResetCreateTime reset all changes of the create_time field. +// ResetCreateTime reset all changes of the "create_time" field. func (m *CardMutation) ResetCreateTime() { m.create_time = nil } @@ -139,7 +139,7 @@ func (m *CardMutation) UpdateTime() (r time.Time, exists bool) { return *v, true } -// ResetUpdateTime reset all changes of the update_time field. +// ResetUpdateTime reset all changes of the "update_time" field. func (m *CardMutation) ResetUpdateTime() { m.update_time = nil } @@ -158,7 +158,7 @@ func (m *CardMutation) Number() (r string, exists bool) { return *v, true } -// ResetNumber reset all changes of the number field. +// ResetNumber reset all changes of the "number" field. func (m *CardMutation) ResetNumber() { m.number = nil } @@ -189,7 +189,7 @@ func (m *CardMutation) NameCleared() bool { return ok } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *CardMutation) ResetName() { m.name = nil delete(m.clearedFields, card.FieldName) @@ -228,7 +228,7 @@ func (m *CardMutation) OwnerIDs() (ids []string) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CardMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -270,7 +270,7 @@ func (m *CardMutation) SpecIDs() (ids []string) { return } -// ResetSpec reset all changes of the spec edge. +// ResetSpec reset all changes of the "spec" edge. func (m *CardMutation) ResetSpec() { m.spec = nil m.removedspec = nil @@ -621,7 +621,7 @@ func (m *CommentMutation) AddedUniqueInt() (r int, exists bool) { return *v, true } -// ResetUniqueInt reset all changes of the unique_int field. +// ResetUniqueInt reset all changes of the "unique_int" field. func (m *CommentMutation) ResetUniqueInt() { m.unique_int = nil m.addunique_int = nil @@ -660,7 +660,7 @@ func (m *CommentMutation) AddedUniqueFloat() (r float64, exists bool) { return *v, true } -// ResetUniqueFloat reset all changes of the unique_float field. +// ResetUniqueFloat reset all changes of the "unique_float" field. func (m *CommentMutation) ResetUniqueFloat() { m.unique_float = nil m.addunique_float = nil @@ -712,7 +712,7 @@ func (m *CommentMutation) NillableIntCleared() bool { return ok } -// ResetNillableInt reset all changes of the nillable_int field. +// ResetNillableInt reset all changes of the "nillable_int" field. func (m *CommentMutation) ResetNillableInt() { m.nillable_int = nil m.addnillable_int = nil @@ -1088,7 +1088,7 @@ func (m *FieldTypeMutation) AddedInt() (r int, exists bool) { return *v, true } -// ResetInt reset all changes of the int field. +// ResetInt reset all changes of the "int" field. func (m *FieldTypeMutation) ResetInt() { m.int = nil m.addint = nil @@ -1127,7 +1127,7 @@ func (m *FieldTypeMutation) AddedInt8() (r int8, exists bool) { return *v, true } -// ResetInt8 reset all changes of the int8 field. +// ResetInt8 reset all changes of the "int8" field. func (m *FieldTypeMutation) ResetInt8() { m.int8 = nil m.addint8 = nil @@ -1166,7 +1166,7 @@ func (m *FieldTypeMutation) AddedInt16() (r int16, exists bool) { return *v, true } -// ResetInt16 reset all changes of the int16 field. +// ResetInt16 reset all changes of the "int16" field. func (m *FieldTypeMutation) ResetInt16() { m.int16 = nil m.addint16 = nil @@ -1205,7 +1205,7 @@ func (m *FieldTypeMutation) AddedInt32() (r int32, exists bool) { return *v, true } -// ResetInt32 reset all changes of the int32 field. +// ResetInt32 reset all changes of the "int32" field. func (m *FieldTypeMutation) ResetInt32() { m.int32 = nil m.addint32 = nil @@ -1244,7 +1244,7 @@ func (m *FieldTypeMutation) AddedInt64() (r int64, exists bool) { return *v, true } -// ResetInt64 reset all changes of the int64 field. +// ResetInt64 reset all changes of the "int64" field. func (m *FieldTypeMutation) ResetInt64() { m.int64 = nil m.addint64 = nil @@ -1296,7 +1296,7 @@ func (m *FieldTypeMutation) OptionalIntCleared() bool { return ok } -// ResetOptionalInt reset all changes of the optional_int field. +// ResetOptionalInt reset all changes of the "optional_int" field. func (m *FieldTypeMutation) ResetOptionalInt() { m.optional_int = nil m.addoptional_int = nil @@ -1349,7 +1349,7 @@ func (m *FieldTypeMutation) OptionalInt8Cleared() bool { return ok } -// ResetOptionalInt8 reset all changes of the optional_int8 field. +// ResetOptionalInt8 reset all changes of the "optional_int8" field. func (m *FieldTypeMutation) ResetOptionalInt8() { m.optional_int8 = nil m.addoptional_int8 = nil @@ -1402,7 +1402,7 @@ func (m *FieldTypeMutation) OptionalInt16Cleared() bool { return ok } -// ResetOptionalInt16 reset all changes of the optional_int16 field. +// ResetOptionalInt16 reset all changes of the "optional_int16" field. func (m *FieldTypeMutation) ResetOptionalInt16() { m.optional_int16 = nil m.addoptional_int16 = nil @@ -1455,7 +1455,7 @@ func (m *FieldTypeMutation) OptionalInt32Cleared() bool { return ok } -// ResetOptionalInt32 reset all changes of the optional_int32 field. +// ResetOptionalInt32 reset all changes of the "optional_int32" field. func (m *FieldTypeMutation) ResetOptionalInt32() { m.optional_int32 = nil m.addoptional_int32 = nil @@ -1508,7 +1508,7 @@ func (m *FieldTypeMutation) OptionalInt64Cleared() bool { return ok } -// ResetOptionalInt64 reset all changes of the optional_int64 field. +// ResetOptionalInt64 reset all changes of the "optional_int64" field. func (m *FieldTypeMutation) ResetOptionalInt64() { m.optional_int64 = nil m.addoptional_int64 = nil @@ -1561,7 +1561,7 @@ func (m *FieldTypeMutation) NillableIntCleared() bool { return ok } -// ResetNillableInt reset all changes of the nillable_int field. +// ResetNillableInt reset all changes of the "nillable_int" field. func (m *FieldTypeMutation) ResetNillableInt() { m.nillable_int = nil m.addnillable_int = nil @@ -1614,7 +1614,7 @@ func (m *FieldTypeMutation) NillableInt8Cleared() bool { return ok } -// ResetNillableInt8 reset all changes of the nillable_int8 field. +// ResetNillableInt8 reset all changes of the "nillable_int8" field. func (m *FieldTypeMutation) ResetNillableInt8() { m.nillable_int8 = nil m.addnillable_int8 = nil @@ -1667,7 +1667,7 @@ func (m *FieldTypeMutation) NillableInt16Cleared() bool { return ok } -// ResetNillableInt16 reset all changes of the nillable_int16 field. +// ResetNillableInt16 reset all changes of the "nillable_int16" field. func (m *FieldTypeMutation) ResetNillableInt16() { m.nillable_int16 = nil m.addnillable_int16 = nil @@ -1720,7 +1720,7 @@ func (m *FieldTypeMutation) NillableInt32Cleared() bool { return ok } -// ResetNillableInt32 reset all changes of the nillable_int32 field. +// ResetNillableInt32 reset all changes of the "nillable_int32" field. func (m *FieldTypeMutation) ResetNillableInt32() { m.nillable_int32 = nil m.addnillable_int32 = nil @@ -1773,7 +1773,7 @@ func (m *FieldTypeMutation) NillableInt64Cleared() bool { return ok } -// ResetNillableInt64 reset all changes of the nillable_int64 field. +// ResetNillableInt64 reset all changes of the "nillable_int64" field. func (m *FieldTypeMutation) ResetNillableInt64() { m.nillable_int64 = nil m.addnillable_int64 = nil @@ -1826,7 +1826,7 @@ func (m *FieldTypeMutation) ValidateOptionalInt32Cleared() bool { return ok } -// ResetValidateOptionalInt32 reset all changes of the validate_optional_int32 field. +// ResetValidateOptionalInt32 reset all changes of the "validate_optional_int32" field. func (m *FieldTypeMutation) ResetValidateOptionalInt32() { m.validate_optional_int32 = nil m.addvalidate_optional_int32 = nil @@ -1879,7 +1879,7 @@ func (m *FieldTypeMutation) OptionalUintCleared() bool { return ok } -// ResetOptionalUint reset all changes of the optional_uint field. +// ResetOptionalUint reset all changes of the "optional_uint" field. func (m *FieldTypeMutation) ResetOptionalUint() { m.optional_uint = nil m.addoptional_uint = nil @@ -1932,7 +1932,7 @@ func (m *FieldTypeMutation) OptionalUint8Cleared() bool { return ok } -// ResetOptionalUint8 reset all changes of the optional_uint8 field. +// ResetOptionalUint8 reset all changes of the "optional_uint8" field. func (m *FieldTypeMutation) ResetOptionalUint8() { m.optional_uint8 = nil m.addoptional_uint8 = nil @@ -1985,7 +1985,7 @@ func (m *FieldTypeMutation) OptionalUint16Cleared() bool { return ok } -// ResetOptionalUint16 reset all changes of the optional_uint16 field. +// ResetOptionalUint16 reset all changes of the "optional_uint16" field. func (m *FieldTypeMutation) ResetOptionalUint16() { m.optional_uint16 = nil m.addoptional_uint16 = nil @@ -2038,7 +2038,7 @@ func (m *FieldTypeMutation) OptionalUint32Cleared() bool { return ok } -// ResetOptionalUint32 reset all changes of the optional_uint32 field. +// ResetOptionalUint32 reset all changes of the "optional_uint32" field. func (m *FieldTypeMutation) ResetOptionalUint32() { m.optional_uint32 = nil m.addoptional_uint32 = nil @@ -2091,7 +2091,7 @@ func (m *FieldTypeMutation) OptionalUint64Cleared() bool { return ok } -// ResetOptionalUint64 reset all changes of the optional_uint64 field. +// ResetOptionalUint64 reset all changes of the "optional_uint64" field. func (m *FieldTypeMutation) ResetOptionalUint64() { m.optional_uint64 = nil m.addoptional_uint64 = nil @@ -2124,7 +2124,7 @@ func (m *FieldTypeMutation) StateCleared() bool { return ok } -// ResetState reset all changes of the state field. +// ResetState reset all changes of the "state" field. func (m *FieldTypeMutation) ResetState() { m.state = nil delete(m.clearedFields, fieldtype.FieldState) @@ -2176,7 +2176,7 @@ func (m *FieldTypeMutation) OptionalFloatCleared() bool { return ok } -// ResetOptionalFloat reset all changes of the optional_float field. +// ResetOptionalFloat reset all changes of the "optional_float" field. func (m *FieldTypeMutation) ResetOptionalFloat() { m.optional_float = nil m.addoptional_float = nil @@ -2229,7 +2229,7 @@ func (m *FieldTypeMutation) OptionalFloat32Cleared() bool { return ok } -// ResetOptionalFloat32 reset all changes of the optional_float32 field. +// ResetOptionalFloat32 reset all changes of the "optional_float32" field. func (m *FieldTypeMutation) ResetOptionalFloat32() { m.optional_float32 = nil m.addoptional_float32 = nil @@ -3155,6 +3155,8 @@ type FileMutation struct { clearedowner bool _type *string cleared_type bool + field map[string]struct{} + removedfield map[string]struct{} } var _ ent.Mutation = (*FileMutation)(nil) @@ -3230,7 +3232,7 @@ func (m *FileMutation) AddedSize() (r int, exists bool) { return *v, true } -// ResetSize reset all changes of the size field. +// ResetSize reset all changes of the "size" field. func (m *FileMutation) ResetSize() { m.size = nil m.addsize = nil @@ -3250,7 +3252,7 @@ func (m *FileMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *FileMutation) ResetName() { m.name = nil } @@ -3281,7 +3283,7 @@ func (m *FileMutation) UserCleared() bool { return ok } -// ResetUser reset all changes of the user field. +// ResetUser reset all changes of the "user" field. func (m *FileMutation) ResetUser() { m.user = nil delete(m.clearedFields, file.FieldUser) @@ -3313,7 +3315,7 @@ func (m *FileMutation) GroupCleared() bool { return ok } -// ResetGroup reset all changes of the group field. +// ResetGroup reset all changes of the "group" field. func (m *FileMutation) ResetGroup() { m.group = nil delete(m.clearedFields, file.FieldGroup) @@ -3352,7 +3354,7 @@ func (m *FileMutation) OwnerIDs() (ids []string) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *FileMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -3391,12 +3393,54 @@ func (m *FileMutation) TypeIDs() (ids []string) { return } -// ResetType reset all changes of the type edge. +// ResetType reset all changes of the "type" edge. func (m *FileMutation) ResetType() { m._type = nil m.cleared_type = false } +// AddFieldIDs adds the field edge to FieldType by ids. +func (m *FileMutation) AddFieldIDs(ids ...string) { + if m.field == nil { + m.field = make(map[string]struct{}) + } + for i := range ids { + m.field[ids[i]] = struct{}{} + } +} + +// RemoveFieldIDs removes the field edge to FieldType by ids. +func (m *FileMutation) RemoveFieldIDs(ids ...string) { + if m.removedfield == nil { + m.removedfield = make(map[string]struct{}) + } + for i := range ids { + m.removedfield[ids[i]] = struct{}{} + } +} + +// RemovedField returns the removed ids of field. +func (m *FileMutation) RemovedFieldIDs() (ids []string) { + for id := range m.removedfield { + ids = append(ids, id) + } + return +} + +// FieldIDs returns the field ids in the mutation. +func (m *FileMutation) FieldIDs() (ids []string) { + for id := range m.field { + ids = append(ids, id) + } + return +} + +// ResetFieldEdge reset all changes of the "field" edge. +func (m *FileMutation) ResetFieldEdge() { + m.field = nil + m.removedfield = nil +} + // Op returns the operation name. func (m *FileMutation) Op() Op { return m.op @@ -3576,13 +3620,16 @@ func (m *FileMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this // mutation. func (m *FileMutation) AddedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.owner != nil { edges = append(edges, file.EdgeOwner) } if m._type != nil { edges = append(edges, file.EdgeType) } + if m.field != nil { + edges = append(edges, file.EdgeField) + } return edges } @@ -3598,6 +3645,12 @@ func (m *FileMutation) AddedIDs(name string) []ent.Value { if id := m._type; id != nil { return []ent.Value{*id} } + case file.EdgeField: + ids := make([]ent.Value, 0, len(m.field)) + for id := range m.field { + ids = append(ids, id) + } + return ids } return nil } @@ -3605,7 +3658,10 @@ func (m *FileMutation) AddedIDs(name string) []ent.Value { // RemovedEdges returns all edge names that were removed in this // mutation. func (m *FileMutation) RemovedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) + if m.removedfield != nil { + edges = append(edges, file.EdgeField) + } return edges } @@ -3613,6 +3669,12 @@ func (m *FileMutation) RemovedEdges() []string { // the given edge name. func (m *FileMutation) RemovedIDs(name string) []ent.Value { switch name { + case file.EdgeField: + ids := make([]ent.Value, 0, len(m.removedfield)) + for id := range m.removedfield { + ids = append(ids, id) + } + return ids } return nil } @@ -3620,7 +3682,7 @@ func (m *FileMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this // mutation. func (m *FileMutation) ClearedEdges() []string { - edges := make([]string, 0, 2) + edges := make([]string, 0, 3) if m.clearedowner { edges = append(edges, file.EdgeOwner) } @@ -3667,6 +3729,9 @@ func (m *FileMutation) ResetEdge(name string) error { case file.EdgeType: m.ResetType() return nil + case file.EdgeField: + m.ResetFieldEdge() + return nil } return fmt.Errorf("unknown File edge %s", name) } @@ -3738,7 +3803,7 @@ func (m *FileTypeMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *FileTypeMutation) ResetName() { m.name = nil } @@ -3779,7 +3844,7 @@ func (m *FileTypeMutation) FilesIDs() (ids []string) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *FileTypeMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -4047,7 +4112,7 @@ func (m *GroupMutation) Active() (r bool, exists bool) { return *v, true } -// ResetActive reset all changes of the active field. +// ResetActive reset all changes of the "active" field. func (m *GroupMutation) ResetActive() { m.active = nil } @@ -4066,7 +4131,7 @@ func (m *GroupMutation) Expire() (r time.Time, exists bool) { return *v, true } -// ResetExpire reset all changes of the expire field. +// ResetExpire reset all changes of the "expire" field. func (m *GroupMutation) ResetExpire() { m.expire = nil } @@ -4097,7 +4162,7 @@ func (m *GroupMutation) TypeCleared() bool { return ok } -// ResetType reset all changes of the type field. +// ResetType reset all changes of the "type" field. func (m *GroupMutation) ResetType() { m._type = nil delete(m.clearedFields, group.FieldType) @@ -4149,7 +4214,7 @@ func (m *GroupMutation) MaxUsersCleared() bool { return ok } -// ResetMaxUsers reset all changes of the max_users field. +// ResetMaxUsers reset all changes of the "max_users" field. func (m *GroupMutation) ResetMaxUsers() { m.max_users = nil m.addmax_users = nil @@ -4170,7 +4235,7 @@ func (m *GroupMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GroupMutation) ResetName() { m.name = nil } @@ -4211,7 +4276,7 @@ func (m *GroupMutation) FilesIDs() (ids []string) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *GroupMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -4253,7 +4318,7 @@ func (m *GroupMutation) BlockedIDs() (ids []string) { return } -// ResetBlocked reset all changes of the blocked edge. +// ResetBlocked reset all changes of the "blocked" edge. func (m *GroupMutation) ResetBlocked() { m.blocked = nil m.removedblocked = nil @@ -4295,7 +4360,7 @@ func (m *GroupMutation) UsersIDs() (ids []string) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -4334,7 +4399,7 @@ func (m *GroupMutation) InfoIDs() (ids []string) { return } -// ResetInfo reset all changes of the info edge. +// ResetInfo reset all changes of the "info" edge. func (m *GroupMutation) ResetInfo() { m.info = nil m.clearedinfo = false @@ -4743,7 +4808,7 @@ func (m *GroupInfoMutation) Desc() (r string, exists bool) { return *v, true } -// ResetDesc reset all changes of the desc field. +// ResetDesc reset all changes of the "desc" field. func (m *GroupInfoMutation) ResetDesc() { m.desc = nil } @@ -4781,7 +4846,7 @@ func (m *GroupInfoMutation) AddedMaxUsers() (r int, exists bool) { return *v, true } -// ResetMaxUsers reset all changes of the max_users field. +// ResetMaxUsers reset all changes of the "max_users" field. func (m *GroupInfoMutation) ResetMaxUsers() { m.max_users = nil m.addmax_users = nil @@ -4823,7 +4888,7 @@ func (m *GroupInfoMutation) GroupsIDs() (ids []string) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *GroupInfoMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -5341,7 +5406,7 @@ func (m *NodeMutation) ValueCleared() bool { return ok } -// ResetValue reset all changes of the value field. +// ResetValue reset all changes of the "value" field. func (m *NodeMutation) ResetValue() { m.value = nil m.addvalue = nil @@ -5381,7 +5446,7 @@ func (m *NodeMutation) PrevIDs() (ids []string) { return } -// ResetPrev reset all changes of the prev edge. +// ResetPrev reset all changes of the "prev" edge. func (m *NodeMutation) ResetPrev() { m.prev = nil m.clearedprev = false @@ -5420,7 +5485,7 @@ func (m *NodeMutation) NextIDs() (ids []string) { return } -// ResetNext reset all changes of the next edge. +// ResetNext reset all changes of the "next" edge. func (m *NodeMutation) ResetNext() { m.next = nil m.clearednext = false @@ -5718,7 +5783,7 @@ func (m *PetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *PetMutation) ResetName() { m.name = nil } @@ -5756,7 +5821,7 @@ func (m *PetMutation) TeamIDs() (ids []string) { return } -// ResetTeam reset all changes of the team edge. +// ResetTeam reset all changes of the "team" edge. func (m *PetMutation) ResetTeam() { m.team = nil m.clearedteam = false @@ -5795,7 +5860,7 @@ func (m *PetMutation) OwnerIDs() (ids []string) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -6088,7 +6153,7 @@ func (m *SpecMutation) CardIDs() (ids []string) { return } -// ResetCard reset all changes of the card edge. +// ResetCard reset all changes of the "card" edge. func (m *SpecMutation) ResetCard() { m.card = nil m.removedcard = nil @@ -6392,7 +6457,7 @@ func (m *UserMutation) OptionalIntCleared() bool { return ok } -// ResetOptionalInt reset all changes of the optional_int field. +// ResetOptionalInt reset all changes of the "optional_int" field. func (m *UserMutation) ResetOptionalInt() { m.optional_int = nil m.addoptional_int = nil @@ -6432,7 +6497,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -6452,7 +6517,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -6471,7 +6536,7 @@ func (m *UserMutation) Last() (r string, exists bool) { return *v, true } -// ResetLast reset all changes of the last field. +// ResetLast reset all changes of the "last" field. func (m *UserMutation) ResetLast() { m.last = nil } @@ -6502,7 +6567,7 @@ func (m *UserMutation) NicknameCleared() bool { return ok } -// ResetNickname reset all changes of the nickname field. +// ResetNickname reset all changes of the "nickname" field. func (m *UserMutation) ResetNickname() { m.nickname = nil delete(m.clearedFields, user.FieldNickname) @@ -6534,7 +6599,7 @@ func (m *UserMutation) PhoneCleared() bool { return ok } -// ResetPhone reset all changes of the phone field. +// ResetPhone reset all changes of the "phone" field. func (m *UserMutation) ResetPhone() { m.phone = nil delete(m.clearedFields, user.FieldPhone) @@ -6566,7 +6631,7 @@ func (m *UserMutation) PasswordCleared() bool { return ok } -// ResetPassword reset all changes of the password field. +// ResetPassword reset all changes of the "password" field. func (m *UserMutation) ResetPassword() { m.password = nil delete(m.clearedFields, user.FieldPassword) @@ -6586,7 +6651,7 @@ func (m *UserMutation) Role() (r user.Role, exists bool) { return *v, true } -// ResetRole reset all changes of the role field. +// ResetRole reset all changes of the "role" field. func (m *UserMutation) ResetRole() { m.role = nil } @@ -6617,7 +6682,7 @@ func (m *UserMutation) SSOCertCleared() bool { return ok } -// ResetSSOCert reset all changes of the SSOCert field. +// ResetSSOCert reset all changes of the "SSOCert" field. func (m *UserMutation) ResetSSOCert() { m._SSOCert = nil delete(m.clearedFields, user.FieldSSOCert) @@ -6656,7 +6721,7 @@ func (m *UserMutation) CardIDs() (ids []string) { return } -// ResetCard reset all changes of the card edge. +// ResetCard reset all changes of the "card" edge. func (m *UserMutation) ResetCard() { m.card = nil m.clearedcard = false @@ -6698,7 +6763,7 @@ func (m *UserMutation) PetsIDs() (ids []string) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil @@ -6740,7 +6805,7 @@ func (m *UserMutation) FilesIDs() (ids []string) { return } -// ResetFiles reset all changes of the files edge. +// ResetFiles reset all changes of the "files" edge. func (m *UserMutation) ResetFiles() { m.files = nil m.removedfiles = nil @@ -6782,7 +6847,7 @@ func (m *UserMutation) GroupsIDs() (ids []string) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -6824,7 +6889,7 @@ func (m *UserMutation) FriendsIDs() (ids []string) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -6866,7 +6931,7 @@ func (m *UserMutation) FollowersIDs() (ids []string) { return } -// ResetFollowers reset all changes of the followers edge. +// ResetFollowers reset all changes of the "followers" edge. func (m *UserMutation) ResetFollowers() { m.followers = nil m.removedfollowers = nil @@ -6908,7 +6973,7 @@ func (m *UserMutation) FollowingIDs() (ids []string) { return } -// ResetFollowing reset all changes of the following edge. +// ResetFollowing reset all changes of the "following" edge. func (m *UserMutation) ResetFollowing() { m.following = nil m.removedfollowing = nil @@ -6947,7 +7012,7 @@ func (m *UserMutation) TeamIDs() (ids []string) { return } -// ResetTeam reset all changes of the team edge. +// ResetTeam reset all changes of the "team" edge. func (m *UserMutation) ResetTeam() { m.team = nil m.clearedteam = false @@ -6986,7 +7051,7 @@ func (m *UserMutation) SpouseIDs() (ids []string) { return } -// ResetSpouse reset all changes of the spouse edge. +// ResetSpouse reset all changes of the "spouse" edge. func (m *UserMutation) ResetSpouse() { m.spouse = nil m.clearedspouse = false @@ -7028,7 +7093,7 @@ func (m *UserMutation) ChildrenIDs() (ids []string) { return } -// ResetChildren reset all changes of the children edge. +// ResetChildren reset all changes of the "children" edge. func (m *UserMutation) ResetChildren() { m.children = nil m.removedchildren = nil @@ -7067,7 +7132,7 @@ func (m *UserMutation) ParentIDs() (ids []string) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *UserMutation) ResetParent() { m.parent = nil m.clearedparent = false diff --git a/entc/integration/hooks/ent/mutation.go b/entc/integration/hooks/ent/mutation.go index f10e439da..139891638 100644 --- a/entc/integration/hooks/ent/mutation.go +++ b/entc/integration/hooks/ent/mutation.go @@ -98,7 +98,7 @@ func (m *CardMutation) Number() (r string, exists bool) { return *v, true } -// ResetNumber reset all changes of the number field. +// ResetNumber reset all changes of the "number" field. func (m *CardMutation) ResetNumber() { m.number = nil } @@ -129,7 +129,7 @@ func (m *CardMutation) NameCleared() bool { return ok } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *CardMutation) ResetName() { m.name = nil delete(m.clearedFields, card.FieldName) @@ -149,7 +149,7 @@ func (m *CardMutation) CreatedAt() (r time.Time, exists bool) { return *v, true } -// ResetCreatedAt reset all changes of the created_at field. +// ResetCreatedAt reset all changes of the "created_at" field. func (m *CardMutation) ResetCreatedAt() { m.created_at = nil } @@ -187,7 +187,7 @@ func (m *CardMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CardMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -484,7 +484,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -525,7 +525,7 @@ func (m *UserMutation) CardsIDs() (ids []int) { return } -// ResetCards reset all changes of the cards edge. +// ResetCards reset all changes of the "cards" edge. func (m *UserMutation) ResetCards() { m.cards = nil m.removedcards = nil @@ -567,7 +567,7 @@ func (m *UserMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -606,7 +606,7 @@ func (m *UserMutation) BestFriendIDs() (ids []int) { return } -// ResetBestFriend reset all changes of the best_friend edge. +// ResetBestFriend reset all changes of the "best_friend" edge. func (m *UserMutation) ResetBestFriend() { m.best_friend = nil m.clearedbest_friend = false diff --git a/entc/integration/idtype/ent/mutation.go b/entc/integration/idtype/ent/mutation.go index afba82364..77bc3ccc1 100644 --- a/entc/integration/idtype/ent/mutation.go +++ b/entc/integration/idtype/ent/mutation.go @@ -97,7 +97,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -135,7 +135,7 @@ func (m *UserMutation) SpouseIDs() (ids []uint64) { return } -// ResetSpouse reset all changes of the spouse edge. +// ResetSpouse reset all changes of the "spouse" edge. func (m *UserMutation) ResetSpouse() { m.spouse = nil m.clearedspouse = false @@ -177,7 +177,7 @@ func (m *UserMutation) FollowersIDs() (ids []uint64) { return } -// ResetFollowers reset all changes of the followers edge. +// ResetFollowers reset all changes of the "followers" edge. func (m *UserMutation) ResetFollowers() { m.followers = nil m.removedfollowers = nil @@ -219,7 +219,7 @@ func (m *UserMutation) FollowingIDs() (ids []uint64) { return } -// ResetFollowing reset all changes of the following edge. +// ResetFollowing reset all changes of the "following" edge. func (m *UserMutation) ResetFollowing() { m.following = nil m.removedfollowing = nil diff --git a/entc/integration/json/ent/mutation.go b/entc/integration/json/ent/mutation.go index 187315ce7..ed4eed52f 100644 --- a/entc/integration/json/ent/mutation.go +++ b/entc/integration/json/ent/mutation.go @@ -111,7 +111,7 @@ func (m *UserMutation) URLCleared() bool { return ok } -// ResetURL reset all changes of the url field. +// ResetURL reset all changes of the "url" field. func (m *UserMutation) ResetURL() { m.url = nil delete(m.clearedFields, user.FieldURL) @@ -143,7 +143,7 @@ func (m *UserMutation) RawCleared() bool { return ok } -// ResetRaw reset all changes of the raw field. +// ResetRaw reset all changes of the "raw" field. func (m *UserMutation) ResetRaw() { m.raw = nil delete(m.clearedFields, user.FieldRaw) @@ -175,7 +175,7 @@ func (m *UserMutation) DirsCleared() bool { return ok } -// ResetDirs reset all changes of the dirs field. +// ResetDirs reset all changes of the "dirs" field. func (m *UserMutation) ResetDirs() { m.dirs = nil delete(m.clearedFields, user.FieldDirs) @@ -207,7 +207,7 @@ func (m *UserMutation) IntsCleared() bool { return ok } -// ResetInts reset all changes of the ints field. +// ResetInts reset all changes of the "ints" field. func (m *UserMutation) ResetInts() { m.ints = nil delete(m.clearedFields, user.FieldInts) @@ -239,7 +239,7 @@ func (m *UserMutation) FloatsCleared() bool { return ok } -// ResetFloats reset all changes of the floats field. +// ResetFloats reset all changes of the "floats" field. func (m *UserMutation) ResetFloats() { m.floats = nil delete(m.clearedFields, user.FieldFloats) @@ -271,7 +271,7 @@ func (m *UserMutation) StringsCleared() bool { return ok } -// ResetStrings reset all changes of the strings field. +// ResetStrings reset all changes of the "strings" field. func (m *UserMutation) ResetStrings() { m.strings = nil delete(m.clearedFields, user.FieldStrings) diff --git a/entc/integration/migrate/entv1/mutation.go b/entc/integration/migrate/entv1/mutation.go index 7e12f6178..3c88ac1e6 100644 --- a/entc/integration/migrate/entv1/mutation.go +++ b/entc/integration/migrate/entv1/mutation.go @@ -113,7 +113,7 @@ func (m *CarMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CarMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -390,7 +390,7 @@ func (m *UserMutation) AddedAge() (r int32, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -410,7 +410,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -429,7 +429,7 @@ func (m *UserMutation) Nickname() (r string, exists bool) { return *v, true } -// ResetNickname reset all changes of the nickname field. +// ResetNickname reset all changes of the "nickname" field. func (m *UserMutation) ResetNickname() { m.nickname = nil } @@ -460,7 +460,7 @@ func (m *UserMutation) AddressCleared() bool { return ok } -// ResetAddress reset all changes of the address field. +// ResetAddress reset all changes of the "address" field. func (m *UserMutation) ResetAddress() { m.address = nil delete(m.clearedFields, user.FieldAddress) @@ -492,7 +492,7 @@ func (m *UserMutation) RenamedCleared() bool { return ok } -// ResetRenamed reset all changes of the renamed field. +// ResetRenamed reset all changes of the "renamed" field. func (m *UserMutation) ResetRenamed() { m.renamed = nil delete(m.clearedFields, user.FieldRenamed) @@ -524,7 +524,7 @@ func (m *UserMutation) BlobCleared() bool { return ok } -// ResetBlob reset all changes of the blob field. +// ResetBlob reset all changes of the "blob" field. func (m *UserMutation) ResetBlob() { m.blob = nil delete(m.clearedFields, user.FieldBlob) @@ -556,7 +556,7 @@ func (m *UserMutation) StateCleared() bool { return ok } -// ResetState reset all changes of the state field. +// ResetState reset all changes of the "state" field. func (m *UserMutation) ResetState() { m.state = nil delete(m.clearedFields, user.FieldState) @@ -595,7 +595,7 @@ func (m *UserMutation) ParentIDs() (ids []int) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *UserMutation) ResetParent() { m.parent = nil m.clearedparent = false @@ -637,7 +637,7 @@ func (m *UserMutation) ChildrenIDs() (ids []int) { return } -// ResetChildren reset all changes of the children edge. +// ResetChildren reset all changes of the "children" edge. func (m *UserMutation) ResetChildren() { m.children = nil m.removedchildren = nil @@ -676,7 +676,7 @@ func (m *UserMutation) SpouseIDs() (ids []int) { return } -// ResetSpouse reset all changes of the spouse edge. +// ResetSpouse reset all changes of the "spouse" edge. func (m *UserMutation) ResetSpouse() { m.spouse = nil m.clearedspouse = false @@ -715,7 +715,7 @@ func (m *UserMutation) CarIDs() (ids []int) { return } -// ResetCar reset all changes of the car edge. +// ResetCar reset all changes of the "car" edge. func (m *UserMutation) ResetCar() { m.car = nil m.clearedcar = false diff --git a/entc/integration/migrate/entv2/mutation.go b/entc/integration/migrate/entv2/mutation.go index f29470f87..adcbe22a5 100644 --- a/entc/integration/migrate/entv2/mutation.go +++ b/entc/integration/migrate/entv2/mutation.go @@ -115,7 +115,7 @@ func (m *CarMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CarMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -782,7 +782,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -802,7 +802,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -821,7 +821,7 @@ func (m *UserMutation) Nickname() (r string, exists bool) { return *v, true } -// ResetNickname reset all changes of the nickname field. +// ResetNickname reset all changes of the "nickname" field. func (m *UserMutation) ResetNickname() { m.nickname = nil } @@ -840,7 +840,7 @@ func (m *UserMutation) Phone() (r string, exists bool) { return *v, true } -// ResetPhone reset all changes of the phone field. +// ResetPhone reset all changes of the "phone" field. func (m *UserMutation) ResetPhone() { m.phone = nil } @@ -871,7 +871,7 @@ func (m *UserMutation) BufferCleared() bool { return ok } -// ResetBuffer reset all changes of the buffer field. +// ResetBuffer reset all changes of the "buffer" field. func (m *UserMutation) ResetBuffer() { m.buffer = nil delete(m.clearedFields, user.FieldBuffer) @@ -891,7 +891,7 @@ func (m *UserMutation) Title() (r string, exists bool) { return *v, true } -// ResetTitle reset all changes of the title field. +// ResetTitle reset all changes of the "title" field. func (m *UserMutation) ResetTitle() { m.title = nil } @@ -922,7 +922,7 @@ func (m *UserMutation) NewNameCleared() bool { return ok } -// ResetNewName reset all changes of the new_name field. +// ResetNewName reset all changes of the "new_name" field. func (m *UserMutation) ResetNewName() { m.new_name = nil delete(m.clearedFields, user.FieldNewName) @@ -954,7 +954,7 @@ func (m *UserMutation) BlobCleared() bool { return ok } -// ResetBlob reset all changes of the blob field. +// ResetBlob reset all changes of the "blob" field. func (m *UserMutation) ResetBlob() { m.blob = nil delete(m.clearedFields, user.FieldBlob) @@ -986,7 +986,7 @@ func (m *UserMutation) StateCleared() bool { return ok } -// ResetState reset all changes of the state field. +// ResetState reset all changes of the "state" field. func (m *UserMutation) ResetState() { m.state = nil delete(m.clearedFields, user.FieldState) @@ -1028,7 +1028,7 @@ func (m *UserMutation) CarIDs() (ids []int) { return } -// ResetCar reset all changes of the car edge. +// ResetCar reset all changes of the "car" edge. func (m *UserMutation) ResetCar() { m.car = nil m.removedcar = nil @@ -1067,7 +1067,7 @@ func (m *UserMutation) PetsIDs() (ids []int) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.clearedpets = false diff --git a/entc/integration/privacy/ent/mutation.go b/entc/integration/privacy/ent/mutation.go index 851fe822a..d46ed3682 100644 --- a/entc/integration/privacy/ent/mutation.go +++ b/entc/integration/privacy/ent/mutation.go @@ -96,7 +96,7 @@ func (m *GalaxyMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GalaxyMutation) ResetName() { m.name = nil } @@ -115,7 +115,7 @@ func (m *GalaxyMutation) GetType() (r galaxy.Type, exists bool) { return *v, true } -// ResetType reset all changes of the type field. +// ResetType reset all changes of the "type" field. func (m *GalaxyMutation) ResetType() { m._type = nil } @@ -156,7 +156,7 @@ func (m *GalaxyMutation) PlanetsIDs() (ids []int) { return } -// ResetPlanets reset all changes of the planets edge. +// ResetPlanets reset all changes of the "planets" edge. func (m *GalaxyMutation) ResetPlanets() { m.planets = nil m.removedplanets = nil @@ -430,7 +430,7 @@ func (m *PlanetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *PlanetMutation) ResetName() { m.name = nil } @@ -481,7 +481,7 @@ func (m *PlanetMutation) AgeCleared() bool { return ok } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *PlanetMutation) ResetAge() { m.age = nil m.addage = nil @@ -524,7 +524,7 @@ func (m *PlanetMutation) NeighborsIDs() (ids []int) { return } -// ResetNeighbors reset all changes of the neighbors edge. +// ResetNeighbors reset all changes of the "neighbors" edge. func (m *PlanetMutation) ResetNeighbors() { m.neighbors = nil m.removedneighbors = nil diff --git a/entc/integration/template/ent/mutation.go b/entc/integration/template/ent/mutation.go index 6bb9b4ae8..fedf38b03 100644 --- a/entc/integration/template/ent/mutation.go +++ b/entc/integration/template/ent/mutation.go @@ -116,7 +116,7 @@ func (m *GroupMutation) AddedMaxUsers() (r int, exists bool) { return *v, true } -// ResetMaxUsers reset all changes of the max_users field. +// ResetMaxUsers reset all changes of the "max_users" field. func (m *GroupMutation) ResetMaxUsers() { m.max_users = nil m.addmax_users = nil @@ -386,7 +386,7 @@ func (m *PetMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *PetMutation) ResetAge() { m.age = nil m.addage = nil @@ -418,7 +418,7 @@ func (m *PetMutation) LicensedAtCleared() bool { return ok } -// ResetLicensedAt reset all changes of the licensed_at field. +// ResetLicensedAt reset all changes of the "licensed_at" field. func (m *PetMutation) ResetLicensedAt() { m.licensed_at = nil delete(m.clearedFields, pet.FieldLicensedAt) @@ -457,7 +457,7 @@ func (m *PetMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -752,7 +752,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -793,7 +793,7 @@ func (m *UserMutation) PetsIDs() (ids []int) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil @@ -835,7 +835,7 @@ func (m *UserMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil diff --git a/examples/edgeindex/ent/mutation.go b/examples/edgeindex/ent/mutation.go index 6d935cf68..7e6b6e60f 100644 --- a/examples/edgeindex/ent/mutation.go +++ b/examples/edgeindex/ent/mutation.go @@ -95,7 +95,7 @@ func (m *CityMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *CityMutation) ResetName() { m.name = nil } @@ -136,7 +136,7 @@ func (m *CityMutation) StreetsIDs() (ids []int) { return } -// ResetStreets reset all changes of the streets edge. +// ResetStreets reset all changes of the "streets" edge. func (m *CityMutation) ResetStreets() { m.streets = nil m.removedstreets = nil @@ -393,7 +393,7 @@ func (m *StreetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *StreetMutation) ResetName() { m.name = nil } @@ -431,7 +431,7 @@ func (m *StreetMutation) CityIDs() (ids []int) { return } -// ResetCity reset all changes of the city edge. +// ResetCity reset all changes of the "city" edge. func (m *StreetMutation) ResetCity() { m.city = nil m.clearedcity = false diff --git a/examples/m2m2types/ent/mutation.go b/examples/m2m2types/ent/mutation.go index 865c30a4d..e156f3be2 100644 --- a/examples/m2m2types/ent/mutation.go +++ b/examples/m2m2types/ent/mutation.go @@ -95,7 +95,7 @@ func (m *GroupMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GroupMutation) ResetName() { m.name = nil } @@ -136,7 +136,7 @@ func (m *GroupMutation) UsersIDs() (ids []int) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -414,7 +414,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -434,7 +434,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -475,7 +475,7 @@ func (m *UserMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil diff --git a/examples/m2mbidi/ent/mutation.go b/examples/m2mbidi/ent/mutation.go index fd71ceea6..ac297b308 100644 --- a/examples/m2mbidi/ent/mutation.go +++ b/examples/m2mbidi/ent/mutation.go @@ -114,7 +114,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -134,7 +134,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -175,7 +175,7 @@ func (m *UserMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil diff --git a/examples/m2mrecur/ent/mutation.go b/examples/m2mrecur/ent/mutation.go index 4a84c5659..89daba92c 100644 --- a/examples/m2mrecur/ent/mutation.go +++ b/examples/m2mrecur/ent/mutation.go @@ -116,7 +116,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -136,7 +136,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -177,7 +177,7 @@ func (m *UserMutation) FollowersIDs() (ids []int) { return } -// ResetFollowers reset all changes of the followers edge. +// ResetFollowers reset all changes of the "followers" edge. func (m *UserMutation) ResetFollowers() { m.followers = nil m.removedfollowers = nil @@ -219,7 +219,7 @@ func (m *UserMutation) FollowingIDs() (ids []int) { return } -// ResetFollowing reset all changes of the following edge. +// ResetFollowing reset all changes of the "following" edge. func (m *UserMutation) ResetFollowing() { m.following = nil m.removedfollowing = nil diff --git a/examples/o2m2types/ent/mutation.go b/examples/o2m2types/ent/mutation.go index b96854078..84cc43344 100644 --- a/examples/o2m2types/ent/mutation.go +++ b/examples/o2m2types/ent/mutation.go @@ -95,7 +95,7 @@ func (m *PetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *PetMutation) ResetName() { m.name = nil } @@ -133,7 +133,7 @@ func (m *PetMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -408,7 +408,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -428,7 +428,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -469,7 +469,7 @@ func (m *UserMutation) PetsIDs() (ids []int) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil diff --git a/examples/o2mrecur/ent/mutation.go b/examples/o2mrecur/ent/mutation.go index dc3f317a0..3a2f52d5a 100644 --- a/examples/o2mrecur/ent/mutation.go +++ b/examples/o2mrecur/ent/mutation.go @@ -115,7 +115,7 @@ func (m *NodeMutation) AddedValue() (r int, exists bool) { return *v, true } -// ResetValue reset all changes of the value field. +// ResetValue reset all changes of the "value" field. func (m *NodeMutation) ResetValue() { m.value = nil m.addvalue = nil @@ -154,7 +154,7 @@ func (m *NodeMutation) ParentIDs() (ids []int) { return } -// ResetParent reset all changes of the parent edge. +// ResetParent reset all changes of the "parent" edge. func (m *NodeMutation) ResetParent() { m.parent = nil m.clearedparent = false @@ -196,7 +196,7 @@ func (m *NodeMutation) ChildrenIDs() (ids []int) { return } -// ResetChildren reset all changes of the children edge. +// ResetChildren reset all changes of the "children" edge. func (m *NodeMutation) ResetChildren() { m.children = nil m.removedchildren = nil diff --git a/examples/o2o2types/ent/mutation.go b/examples/o2o2types/ent/mutation.go index 3d81fb486..1d983f29b 100644 --- a/examples/o2o2types/ent/mutation.go +++ b/examples/o2o2types/ent/mutation.go @@ -97,7 +97,7 @@ func (m *CardMutation) Expired() (r time.Time, exists bool) { return *v, true } -// ResetExpired reset all changes of the expired field. +// ResetExpired reset all changes of the "expired" field. func (m *CardMutation) ResetExpired() { m.expired = nil } @@ -116,7 +116,7 @@ func (m *CardMutation) Number() (r string, exists bool) { return *v, true } -// ResetNumber reset all changes of the number field. +// ResetNumber reset all changes of the "number" field. func (m *CardMutation) ResetNumber() { m.number = nil } @@ -154,7 +154,7 @@ func (m *CardMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CardMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -444,7 +444,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -464,7 +464,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -502,7 +502,7 @@ func (m *UserMutation) CardIDs() (ids []int) { return } -// ResetCard reset all changes of the card edge. +// ResetCard reset all changes of the "card" edge. func (m *UserMutation) ResetCard() { m.card = nil m.clearedcard = false diff --git a/examples/o2obidi/ent/mutation.go b/examples/o2obidi/ent/mutation.go index 32a384220..da3678f9f 100644 --- a/examples/o2obidi/ent/mutation.go +++ b/examples/o2obidi/ent/mutation.go @@ -114,7 +114,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -134,7 +134,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -172,7 +172,7 @@ func (m *UserMutation) SpouseIDs() (ids []int) { return } -// ResetSpouse reset all changes of the spouse edge. +// ResetSpouse reset all changes of the "spouse" edge. func (m *UserMutation) ResetSpouse() { m.spouse = nil m.clearedspouse = false diff --git a/examples/o2orecur/ent/mutation.go b/examples/o2orecur/ent/mutation.go index 336e5868b..5e6c097ac 100644 --- a/examples/o2orecur/ent/mutation.go +++ b/examples/o2orecur/ent/mutation.go @@ -115,7 +115,7 @@ func (m *NodeMutation) AddedValue() (r int, exists bool) { return *v, true } -// ResetValue reset all changes of the value field. +// ResetValue reset all changes of the "value" field. func (m *NodeMutation) ResetValue() { m.value = nil m.addvalue = nil @@ -154,7 +154,7 @@ func (m *NodeMutation) PrevIDs() (ids []int) { return } -// ResetPrev reset all changes of the prev edge. +// ResetPrev reset all changes of the "prev" edge. func (m *NodeMutation) ResetPrev() { m.prev = nil m.clearedprev = false @@ -193,7 +193,7 @@ func (m *NodeMutation) NextIDs() (ids []int) { return } -// ResetNext reset all changes of the next edge. +// ResetNext reset all changes of the "next" edge. func (m *NodeMutation) ResetNext() { m.next = nil m.clearednext = false diff --git a/examples/start/ent/mutation.go b/examples/start/ent/mutation.go index d24d99e49..b76c0fc72 100644 --- a/examples/start/ent/mutation.go +++ b/examples/start/ent/mutation.go @@ -99,7 +99,7 @@ func (m *CarMutation) Model() (r string, exists bool) { return *v, true } -// ResetModel reset all changes of the model field. +// ResetModel reset all changes of the "model" field. func (m *CarMutation) ResetModel() { m.model = nil } @@ -118,7 +118,7 @@ func (m *CarMutation) RegisteredAt() (r time.Time, exists bool) { return *v, true } -// ResetRegisteredAt reset all changes of the registered_at field. +// ResetRegisteredAt reset all changes of the "registered_at" field. func (m *CarMutation) ResetRegisteredAt() { m.registered_at = nil } @@ -156,7 +156,7 @@ func (m *CarMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *CarMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -425,7 +425,7 @@ func (m *GroupMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GroupMutation) ResetName() { m.name = nil } @@ -466,7 +466,7 @@ func (m *GroupMutation) UsersIDs() (ids []int) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -746,7 +746,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -766,7 +766,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -807,7 +807,7 @@ func (m *UserMutation) CarsIDs() (ids []int) { return } -// ResetCars reset all changes of the cars edge. +// ResetCars reset all changes of the "cars" edge. func (m *UserMutation) ResetCars() { m.cars = nil m.removedcars = nil @@ -849,7 +849,7 @@ func (m *UserMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil diff --git a/examples/traversal/ent/mutation.go b/examples/traversal/ent/mutation.go index 04dfd636f..8c6795ecb 100644 --- a/examples/traversal/ent/mutation.go +++ b/examples/traversal/ent/mutation.go @@ -99,7 +99,7 @@ func (m *GroupMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *GroupMutation) ResetName() { m.name = nil } @@ -140,7 +140,7 @@ func (m *GroupMutation) UsersIDs() (ids []int) { return } -// ResetUsers reset all changes of the users edge. +// ResetUsers reset all changes of the "users" edge. func (m *GroupMutation) ResetUsers() { m.users = nil m.removedusers = nil @@ -179,7 +179,7 @@ func (m *GroupMutation) AdminIDs() (ids []int) { return } -// ResetAdmin reset all changes of the admin edge. +// ResetAdmin reset all changes of the "admin" edge. func (m *GroupMutation) ResetAdmin() { m.admin = nil m.clearedadmin = false @@ -456,7 +456,7 @@ func (m *PetMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *PetMutation) ResetName() { m.name = nil } @@ -497,7 +497,7 @@ func (m *PetMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *PetMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -536,7 +536,7 @@ func (m *PetMutation) OwnerIDs() (ids []int) { return } -// ResetOwner reset all changes of the owner edge. +// ResetOwner reset all changes of the "owner" edge. func (m *PetMutation) ResetOwner() { m.owner = nil m.clearedowner = false @@ -838,7 +838,7 @@ func (m *UserMutation) AddedAge() (r int, exists bool) { return *v, true } -// ResetAge reset all changes of the age field. +// ResetAge reset all changes of the "age" field. func (m *UserMutation) ResetAge() { m.age = nil m.addage = nil @@ -858,7 +858,7 @@ func (m *UserMutation) Name() (r string, exists bool) { return *v, true } -// ResetName reset all changes of the name field. +// ResetName reset all changes of the "name" field. func (m *UserMutation) ResetName() { m.name = nil } @@ -899,7 +899,7 @@ func (m *UserMutation) PetsIDs() (ids []int) { return } -// ResetPets reset all changes of the pets edge. +// ResetPets reset all changes of the "pets" edge. func (m *UserMutation) ResetPets() { m.pets = nil m.removedpets = nil @@ -941,7 +941,7 @@ func (m *UserMutation) FriendsIDs() (ids []int) { return } -// ResetFriends reset all changes of the friends edge. +// ResetFriends reset all changes of the "friends" edge. func (m *UserMutation) ResetFriends() { m.friends = nil m.removedfriends = nil @@ -983,7 +983,7 @@ func (m *UserMutation) GroupsIDs() (ids []int) { return } -// ResetGroups reset all changes of the groups edge. +// ResetGroups reset all changes of the "groups" edge. func (m *UserMutation) ResetGroups() { m.groups = nil m.removedgroups = nil @@ -1025,7 +1025,7 @@ func (m *UserMutation) ManageIDs() (ids []int) { return } -// ResetManage reset all changes of the manage edge. +// ResetManage reset all changes of the "manage" edge. func (m *UserMutation) ResetManage() { m.manage = nil m.removedmanage = nil