diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index adc443008..478c5cbc1 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -966,7 +966,7 @@ func templateImportTmpl() (*asset, error) { return a, nil } -var _templateMetaTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x4d\x6f\xdb\x3c\x12\x3e\x4b\xbf\x62\x20\xb8\x40\x1c\x24\x72\xdb\xdb\x06\xc8\xa1\x9b\xa4\x68\xb0\x45\x51\x20\x49\x2f\x8b\x45\x41\x8b\x43\x9b\x28\x45\xba\x24\x95\x34\xab\x57\xff\xfd\x05\xbf\x24\x2a\xb6\xfb\xb6\xbd\x04\x22\x39\xf3\xcc\x07\x67\x1e\x8e\xd3\xf7\xab\xd3\xf2\x4a\xed\x9e\x35\xdf\x6c\x2d\xbc\x7d\xfd\xe6\x5f\xe7\x3b\x8d\x06\xa5\x85\xf7\xa4\xc1\xb5\x52\xdf\xe0\x56\x36\x35\xbc\x13\x02\xbc\x90\x01\x77\xae\x1f\x91\xd6\xe5\xfd\x96\x1b\x30\xaa\xd3\x0d\x42\xa3\x28\x02\x37\x20\x78\x83\xd2\x20\x85\x4e\x52\xd4\x60\xb7\x08\xef\x76\xa4\xd9\x22\xbc\xad\x5f\xa7\x53\x60\xaa\x93\xb4\xe4\xd2\x9f\x7f\xbc\xbd\xba\xf9\x74\x77\x03\x8c\x0b\x84\xb8\xa7\x95\xb2\x40\xb9\xc6\xc6\x2a\xfd\x0c\x8a\x81\xcd\x8c\x59\x8d\x58\x97\xa7\xab\x61\x28\xcb\xbe\x07\x8a\x8c\x4b\x84\xaa\x45\x4b\x2a\x08\x9b\xe7\xf0\xc4\xed\x16\xf0\x87\x45\x49\x61\x01\xd5\x67\xd2\x7c\x23\x1b\xac\x60\x51\xc7\x4f\x38\x1f\x86\xb2\xe8\x7b\xb0\xd8\xee\x04\xb1\x08\xd5\x16\x09\x45\x5d\x41\xed\x50\xfa\x1e\x9c\x6e\x34\x32\x09\xf1\x76\xa7\xb4\xad\x60\xe1\x8f\x1a\x25\x8d\x85\x93\xb2\x58\xad\xe0\x23\x59\xa3\x80\xad\x12\xd4\xf8\x28\x8c\xd5\x5c\x6e\x40\xf8\x6d\x8a\x52\x59\xb7\x74\x27\x7d\x0f\x42\x3d\xa1\x86\x45\xfd\x89\xb4\x08\xc3\x00\xf6\x79\x37\x86\x4f\x89\x25\x6b\x62\xb0\x2e\x8b\x80\x79\x09\x55\xdf\xc3\xa2\x0e\xab\x61\xa8\xbc\x3d\xbf\x75\x7b\x5d\x5f\x39\x1f\x88\xb4\x0e\x66\xcf\xfa\xcc\x2e\xa7\xc0\x38\x0a\x7a\xc0\xd0\x21\xb0\x64\xf6\xf6\xba\xbe\xb3\x4a\x93\x0d\xfe\x07\x9f\x83\x79\x97\x62\x4d\xe4\x06\x61\xc1\xe0\xe2\x12\x16\xf5\x7b\x07\x6c\x5c\x52\x0a\x7f\xba\x08\x96\xdc\x19\xcb\x51\xcb\x22\xf9\x1e\x04\xfe\xd1\xe9\x29\x59\x6c\xcc\xd6\xb1\x28\x8a\x19\x6e\xf4\x9f\x1d\xf4\x3e\x5d\xae\x53\x89\x91\x60\x88\xe4\x86\x6e\x30\x0f\x04\xe9\x26\x9c\xe0\xe1\x38\xfc\xf9\x6f\x84\x81\x63\x18\x5e\x53\xba\x05\x97\xd0\x76\x96\x58\xae\xa4\x49\x71\x24\xdc\x18\xc6\xa8\x76\x20\x80\x85\x6d\x77\xc2\xf9\xb8\xd3\x5c\x5a\x06\x15\xe5\x44\x60\x63\x57\xaf\xcc\xca\xf5\xc5\xaa\x89\x8e\x1b\xd7\x01\x31\x1d\x10\x1b\xe0\xc7\x58\xdc\x01\xc6\x57\xf6\xd2\x97\x7d\xd8\x38\x0e\xfb\x48\x34\x27\x6b\x81\x2f\x61\xfb\x1e\x38\x83\x2d\x31\xf7\x73\xe8\x9f\x59\x9c\x37\x1c\x67\xa0\x5c\x7f\x7c\x20\xe6\x1a\x19\xe9\x84\x0d\x8b\x2f\x44\x70\x4a\xac\xd2\xc6\x35\x4f\xd7\x7e\x50\xea\x9b\x09\x47\x9f\x95\xe0\x8d\xbb\xe1\x12\x00\xc0\x5f\x9d\x4c\x02\xfe\x62\x47\xf1\x4c\x84\xb3\x43\xca\xfb\x00\x97\x40\x28\xcd\xd6\x6f\x72\x90\xe8\x77\x91\x00\x65\x66\xc8\x97\xc9\x27\x65\x11\xec\x96\x58\x5f\x0a\x63\xd6\x60\x8d\x42\x3d\x01\xd1\xae\x00\xb8\xe5\x44\xf0\xff\x23\x85\xf5\x73\x60\xc1\x4e\x5a\xde\x62\x40\xd8\x45\xd6\x52\xa1\xe6\x47\x71\x5f\x32\x81\x21\x11\xc8\x6e\x27\x78\xe3\xb7\x6a\xb8\xdf\xa2\x46\xa6\x34\x9e\x05\x04\x6e\xc1\x6c\x55\x27\x28\xac\x11\x02\x8b\xe1\xd8\x43\x2d\xe1\x12\x88\x01\xa6\x84\x50\x4f\xe6\xc2\xab\xf8\x3f\x45\x10\x85\xaf\x91\x0c\xae\x94\x64\x7c\x33\xb2\xe8\x30\xac\xa2\x9f\x55\xd4\xc9\x13\xf2\x48\xb4\x23\xc7\x23\x89\x29\xc2\xf7\x7f\x1d\x6e\x76\xf2\x3f\x94\xb6\x76\x8b\xa8\x98\xc0\x8a\xc3\xf7\x55\x14\x45\x5c\x38\xbd\xf0\x79\x48\x33\xf0\x82\x79\xc1\x56\xa1\xd4\x3c\xc7\x3d\x18\xd4\xd7\xfe\x31\xa1\xe1\x20\x69\x5c\xba\xc4\xfa\x87\x24\x6e\x38\xf1\x20\x32\xb3\x30\x23\x44\x96\xf1\x61\xf2\x9c\x78\x8c\x3a\x15\xf4\x89\x54\xd6\xad\x6f\xcd\x8d\xec\xda\x65\x94\x0d\xce\xd2\x28\x13\xf8\x33\x6a\x44\x02\xf0\x52\x91\x7c\x92\xdc\x8c\x7f\xd2\xe6\x23\x11\x9d\x2f\x99\x46\x63\x28\x14\xa6\x74\x62\xa3\x97\x74\x5a\x47\xe3\x33\xcc\xa9\x13\x9d\x9b\xf7\xbc\xc5\xf0\xf5\xf0\xe0\x33\xc0\x3a\xd9\x9c\x2c\x61\x4c\x44\x80\xbd\x77\x6f\xd9\x14\xf8\x98\xa3\xf1\x02\x59\xfd\xb0\xa3\xc4\xe2\xf5\x68\xe8\x58\xe0\x33\xb9\x3f\x0e\xbf\xf3\x28\x7f\x18\xfc\x14\xf9\x1f\xc5\xeb\x07\x91\x05\xab\x33\xe2\xca\xc3\xf5\xec\x1f\x62\x1d\x25\x66\x02\x7e\x30\xb8\xb8\x84\x91\x83\x9d\x0f\x70\xf2\xca\x2c\x01\xb5\x56\xba\x4a\x1e\xe4\x6e\xa4\xf4\xc8\x18\x23\x37\x40\x5c\x3a\x22\x7e\x4a\x44\x35\xcb\x44\x15\x53\x01\xb7\xd6\x29\x34\x44\x88\x89\x8c\xd6\x1d\x17\x14\xb5\xa3\x2c\xc7\x29\x60\xc8\x23\x4e\x49\x4b\x76\xfc\x93\x71\x24\x1b\xf9\x62\x39\x67\xfb\xd5\x69\x9a\xe2\x9a\xce\x58\xd5\x86\x69\xc8\x79\x89\xb2\x6b\x21\xb6\x92\x9f\xf8\xa6\xd7\x7a\x3e\x77\xa4\x69\x2e\x5d\x98\xeb\xa8\x64\x77\x75\x0a\xaa\xe5\x81\x7b\x13\x8f\x7a\x8f\x99\x76\xb6\xb6\xe8\xed\xd5\xc1\x40\x7c\x7b\x9d\xfa\xc5\x25\x58\xcd\xdb\x44\x75\x29\xcf\x77\xe1\x75\x5f\x64\x1c\x98\x0d\x03\xc1\x6e\x8c\xc7\x8c\xe8\x47\x8a\x6f\x8a\xcf\x25\xd3\x0b\xe6\x28\x61\x90\x28\xcb\xbc\x75\xe6\x4d\xe3\xf6\x57\xa7\x00\x8c\x4b\xea\xf1\xbd\xaa\x7f\x6a\x8e\x34\x84\x8b\x33\xa4\x6b\xc6\x5a\x5f\xcf\xd2\x00\xc4\x6a\x97\xbc\x59\x99\x72\x06\xf8\xdd\x9d\x4f\xf6\xbf\xf8\xe6\x8a\x32\x7b\xb5\xec\x10\x7c\x8c\x8b\x49\x66\xbf\x26\x73\xdf\xb2\xb0\x43\x5d\x15\x61\xb6\x0e\xf9\x9a\x33\x00\x5c\xe6\x48\xa3\x97\xf3\xc6\x3b\x54\x78\xfb\xf7\xe4\x53\xe2\x47\xae\x71\x94\xff\xd5\xb4\xec\xc7\x39\x43\x4e\x63\x5b\x98\xd8\x02\xe8\xe4\xd4\xb2\x8c\x95\xa6\xb1\x41\xfe\x88\xda\xd9\x18\xbf\x17\xac\xfe\x77\x68\x38\x5f\xde\xf1\xba\x42\xe7\xcf\x94\xe6\x36\x97\x10\x6a\xf3\x64\x99\x46\xd0\xde\x59\xd6\x68\x3b\x2d\xe3\xd6\x4b\xfd\x65\x59\x14\x43\x72\xe6\x20\x1b\x9d\xe7\xf5\xfd\x2b\x8c\x92\xa1\x47\x4e\x09\x55\x19\x73\xfd\x5b\xfc\xe2\x63\xce\x0c\xff\x3c\x7c\xcf\x88\x21\x68\xf3\xc4\x6d\xb3\x85\x3d\x71\x7f\x79\x0d\x31\xbe\xd1\xe2\x25\xf3\x03\x97\x1c\xb8\x44\xba\x53\x78\x0d\xc3\x70\xf6\x82\xf4\xef\xac\xee\x1a\xfb\x3e\xfe\xd6\xc8\xa6\x7b\xf8\x0b\x76\xc4\x34\x44\xe4\x13\xc2\x45\x28\xe9\x78\x13\x92\x0b\xbf\x8e\xb5\x3f\x3f\x64\xad\xad\x6f\x5c\x1c\xec\x24\x4c\x5c\x13\xcd\x5c\x00\x97\x3e\xe7\x59\x3e\x7d\xea\x0f\xbc\x68\x17\xf0\xea\x7b\x75\xf6\x32\x7e\x77\xdb\xc5\xe0\xaf\xbc\x98\x28\xf8\xd8\x6f\x5d\x3f\xe3\x13\x4a\xb9\x9b\x1d\x88\x48\x3f\x7a\x5f\x72\xf7\xbb\x49\xc5\x13\x4f\x43\xa4\x9b\x31\xd5\x23\x6a\xcd\x69\x18\x32\x95\xf6\xff\x10\x50\x7e\x8c\x9e\x20\xc3\x7f\x0e\x52\xf5\x78\xfe\x8b\x0c\x5d\x8f\x7c\x9f\xff\xc0\x9f\x79\x93\x4f\x60\x7f\x07\x00\x00\xff\xff\xb3\x58\x43\xfe\xcd\x10\x00\x00") +var _templateMetaTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x4d\x6f\xdb\x3c\x12\x3e\x4b\xbf\x62\x20\xb8\x40\x1c\x24\x72\xdf\xf7\xb6\x01\x72\xe8\x26\x29\x1a\x6c\x51\x14\x48\xd2\xcb\x62\x51\xd0\xe2\xd0\x26\x4a\x91\x2e\x49\x25\xcd\x0a\xfe\xef\x0b\x0e\x49\x7d\x24\x76\xb7\xed\x25\x10\xc9\x99\x67\x3e\x38\xf3\x70\x9c\xbe\x5f\x9d\x96\x57\x66\xf7\x6c\xe5\x66\xeb\xe1\xef\xb7\x7f\xfd\xe3\x7c\x67\xd1\xa1\xf6\xf0\x9e\x35\xb8\x36\xe6\x1b\xdc\xea\xa6\x86\x77\x4a\x01\x09\x39\x08\xe7\xf6\x11\x79\x5d\xde\x6f\xa5\x03\x67\x3a\xdb\x20\x34\x86\x23\x48\x07\x4a\x36\xa8\x1d\x72\xe8\x34\x47\x0b\x7e\x8b\xf0\x6e\xc7\x9a\x2d\xc2\xdf\xf5\xdb\x7c\x0a\xc2\x74\x9a\x97\x52\xd3\xf9\xc7\xdb\xab\x9b\x4f\x77\x37\x20\xa4\x42\x48\x7b\xd6\x18\x0f\x5c\x5a\x6c\xbc\xb1\xcf\x60\x04\xf8\x89\x31\x6f\x11\xeb\xf2\x74\xb5\xdf\x97\x65\xdf\x03\x47\x21\x35\x42\xd5\xa2\x67\x15\xc4\xcd\x73\x78\x92\x7e\x0b\xf8\xc3\xa3\xe6\xb0\x80\xea\x33\x6b\xbe\xb1\x0d\x56\xb0\xa8\xd3\x27\x9c\xef\xf7\x65\xd1\xf7\xe0\xb1\xdd\x29\xe6\x11\xaa\x2d\x32\x8e\xb6\x82\x3a\xa0\xf4\x3d\x04\xdd\x64\x64\x14\x92\xed\xce\x58\x5f\xc1\x82\x8e\x1a\xa3\x9d\x87\x93\xb2\x58\xad\xe0\x23\x5b\xa3\x82\xad\x51\xdc\x51\x14\xce\x5b\xa9\x37\xa0\x68\x9b\xa3\x36\x3e\x2c\xc3\x49\xdf\x83\x32\x4f\x68\x61\x51\x7f\x62\x2d\xc2\x7e\x0f\xfe\x79\x37\x84\xcf\x99\x67\x6b\xe6\xb0\x2e\x8b\x88\x79\x09\x55\xdf\xc3\xa2\x8e\xab\xfd\xbe\x22\x7b\xb4\x75\x7b\x5d\x5f\x05\x1f\x98\xf6\x01\xe6\x95\xf5\x99\x5d\xc9\x41\x48\x54\xfc\x80\xa1\x43\x60\xd9\xec\xed\x75\x7d\xe7\x8d\x65\x1b\xfc\x17\x3e\x47\xf3\x21\xc5\x96\xe9\x0d\xc2\x42\xc0\xc5\x25\x2c\xea\xf7\x01\xd8\x85\xa4\x14\x74\xba\x88\x96\xc2\x99\x98\xa2\x96\x45\xf6\x3d\x0a\xfc\x5f\xa7\xc7\x64\x89\x21\x5b\xc7\xa2\x28\x66\xb8\xc9\x7f\x71\xd0\xfb\x7c\xb9\x41\x25\x45\x82\x31\x92\x1b\xbe\xc1\x69\x20\xc8\x37\xf1\x04\x0f\xc7\x41\xe7\xbf\x11\x06\x0e\x61\x90\xa6\x0e\x0b\xa9\xa1\xed\x3c\xf3\xd2\x68\x97\xe3\xc8\xb8\x29\x8c\x41\xed\x40\x00\x0b\xdf\xee\x54\xf0\x71\x67\xa5\xf6\x02\x2a\x2e\x99\xc2\xc6\xaf\xde\xb8\x55\xe8\x8b\x55\x93\x1c\x77\xa1\x03\x52\x3a\x20\x35\xc0\x8f\xa1\xb8\x23\x0c\x55\xf6\x92\xca\x3e\x6e\x1c\x87\x7d\x64\x56\xb2\xb5\xc2\x97\xb0\x7d\x0f\x52\xc0\x96\xb9\xfb\x39\xf4\xcf\x2c\xce\x1b\x4e\x0a\x30\xa1\x3f\x3e\x30\x77\x8d\x82\x75\xca\xc7\xc5\x17\xa6\x24\x67\xde\x58\x17\x9a\xa7\x6b\x3f\x18\xf3\xcd\xc5\xa3\xcf\x46\xc9\x26\xdc\x70\x09\x00\x40\x57\xa7\xb3\x00\x5d\xec\x20\x3e\x11\x91\xe2\x90\xf2\x6b\x80\x4b\x60\x9c\x4f\xd6\x7f\x4d\x41\x92\xdf\x45\x06\xd4\x13\x43\x54\x26\x9f\x8c\x47\xf0\x5b\xe6\xa9\x14\x86\xac\xc1\x1a\x95\x79\x02\x66\x43\x01\x48\x2f\x99\x92\xff\x45\x0e\xeb\xe7\xc8\x82\x9d\xf6\xb2\xc5\x88\xb0\x4b\xac\x65\x62\xcd\x0f\xe2\x54\x32\x91\x21\x11\xd8\x6e\xa7\x64\x43\x5b\x35\xdc\x6f\xd1\xa2\x30\x16\xcf\x22\x82\xf4\xe0\xb6\xa6\x53\x1c\xd6\x08\x91\xc5\x70\xe8\xa1\x96\x49\x0d\xcc\x81\x30\x4a\x99\x27\x77\x41\x2a\xf4\xa7\x88\xa2\xf0\x35\x91\xc1\x95\xd1\x42\x6e\x06\x16\xdd\xef\x57\xc9\xcf\x2a\xe9\x4c\x13\xf2\xc8\x6c\x20\xc7\x23\x89\x29\xe2\xf7\xbf\x03\xee\xe4\xe4\x3f\xa8\x7d\x1d\x16\x49\x31\x83\x15\x87\xef\xab\x28\x8a\xb4\x08\x7a\xf1\xf3\x90\x66\xe4\x05\xf7\x82\xad\x62\xa9\x11\xc7\x3d\x38\xb4\xd7\xf4\x98\xf0\x78\x90\x35\x2e\x43\x62\xe9\x21\x49\x1b\x41\x3c\x8a\xcc\x2c\xcc\x08\x51\x4c\xf8\x30\x7b\xce\x08\xa3\xce\x05\x7d\xa2\x8d\x0f\xeb\x5b\x77\xa3\xbb\x76\x99\x64\xa3\xb3\x3c\xc9\x44\xfe\x4c\x1a\x89\x00\x48\x2a\x91\x4f\x96\x9b\xf1\x4f\xde\x7c\x64\xaa\xa3\x92\x69\x2c\xc6\x42\x11\xc6\x66\x36\x7a\x49\xa7\x75\x32\x3e\xc3\x1c\x3b\x31\xb8\x79\x2f\x5b\x8c\x5f\x0f\x0f\x94\x01\xd1\xe9\xe6\x64\x09\x43\x22\x22\xec\x7d\x78\xcb\xc6\xc0\x87\x1c\x0d\x17\x28\xea\x87\x1d\x67\x1e\xaf\x07\x43\xc7\x02\x9f\xc9\xfd\x71\xf8\x1d\xa1\xfc\x61\xf0\x63\xe4\x7f\x14\x2f\x0d\x22\x0b\x51\x4f\x88\x6b\x1a\x2e\xb1\x7f\x8c\x75\x90\x98\x09\xd0\x60\x70\x71\x09\x03\x07\x07\x1f\xe0\xe4\x8d\x5b\x02\x5a\x6b\x6c\x95\x3d\x98\xba\x91\xd3\xa3\x53\x8c\xd2\x01\x0b\xe9\x48\xf8\x39\x11\xd5\x2c\x13\x55\x4a\x05\xdc\xfa\xa0\xd0\x30\xa5\x46\x32\x5a\x77\x52\x71\xb4\x81\xb2\x02\xa7\x80\x63\x8f\x38\x26\x2d\xdb\xa1\x27\xe3\x48\x36\xa6\x8b\xe5\x9c\xed\x57\xa7\x79\x8a\x6b\x3a\xe7\x4d\x1b\xa7\xa1\xe0\x25\xea\xae\x85\xd4\x4a\x34\xf1\x8d\xaf\xf5\x7c\xee\xc8\xd3\x5c\xbe\xb0\xd0\x51\xd9\xee\xea\x14\x4c\x2b\x23\xf7\x66\x1e\x25\x8f\x85\x0d\xb6\xb6\x48\xf6\xea\x68\x20\xbd\xbd\x41\xfd\xe2\x12\xbc\x95\x6d\xa6\xba\x9c\xe7\xbb\xf8\xba\x2f\x26\x1c\x38\x19\x06\xa2\xdd\x14\x8f\x1b\xd0\x8f\x14\xdf\x18\x5f\x48\x26\x09\x4e\x51\xe2\x20\x51\x96\xd3\xd6\x99\x37\x4d\xd8\x5f\x9d\x02\x08\xa9\x39\xe1\x93\x2a\x3d\x35\x47\x1a\x22\xc4\x19\xd3\x35\x63\xad\xaf\x67\x79\x00\x12\x75\x48\xde\xac\x4c\xa5\x00\xfc\x1e\xce\x47\xfb\x5f\xa8\xb9\x92\xcc\xab\x5a\x0e\x08\x14\xe3\x62\x94\x79\x5d\x93\x53\xdf\x26\x61\xc7\xba\x2a\xe2\x6c\x1d\xf3\x35\x67\x00\xb8\x9c\x22\x0d\x5e\xce\x1b\xef\x50\xe1\xbd\xbe\x27\x4a\x09\x8d\x5c\xc3\x28\xff\xab\x69\x79\x1d\xe7\x0c\x39\x8f\x6d\x71\x62\x8b\xa0\xa3\x53\xcb\x32\x55\x9a\xc5\x06\xe5\x23\xda\x60\x63\xf8\x5e\x88\xfa\x9f\xb1\xe1\xa8\xbc\xd3\x75\xc5\xce\x9f\x29\xcd\x6d\x2e\x21\xd6\xe6\xc9\x32\x8f\xa0\x7d\xb0\x6c\xd1\x77\x56\xa7\xad\x97\xfa\xcb\xb2\x28\xf6\xd9\x99\x83\x6c\x74\x3e\xad\xef\x5f\x61\x94\x09\x7a\xe2\x94\x58\x95\x29\xd7\xbf\xc5\x2f\x14\xf3\xc4\xf0\xcf\xc3\x27\x46\x8c\x41\xbb\x27\xe9\x9b\x2d\xbc\x12\xa7\xcb\x6b\x98\xa3\x46\x4b\x97\x2c\x0f\x5c\x72\xe4\x12\x1d\x4e\xe1\x2d\xec\xf7\x67\x2f\x48\xff\xce\xdb\xae\xf1\xef\xd3\x6f\x8d\xbe\x87\x1d\x73\x0d\x53\xf1\xc2\x07\xd9\x8b\x58\xca\xe9\x06\xb4\x54\xb4\x4e\x35\x3f\x3f\x14\xad\xaf\x6f\x82\xff\xe2\x24\x4e\x5a\x23\xbd\x5c\x80\xd4\x94\xeb\x49\x1e\x29\xe5\x07\x5e\xb2\x0b\x78\xf3\xbd\x3a\x7b\x19\x77\xb8\xe5\x62\x4f\x57\x5d\x8c\xd4\x7b\xec\x37\x2e\xcd\xf6\x8c\x73\x19\x66\x06\xa6\xf2\x8f\xdd\x97\x9c\xfd\x6e\x54\x21\xc2\x69\x98\x0e\xb3\xa5\x79\x44\x6b\x25\x8f\xc3\xa5\xb1\xf4\x8f\x00\x43\xe3\xf3\x08\x19\xff\x63\x90\xab\x86\x78\x2f\x31\x73\x3d\xf0\xfc\xf4\x87\xfd\xcc\x9b\xe9\xe4\xf5\xbf\x00\x00\x00\xff\xff\xea\x92\x17\xc5\xc5\x10\x00\x00") func templateMetaTmplBytes() ([]byte, error) { return bindataRead( @@ -981,7 +981,7 @@ func templateMetaTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/meta.tmpl", size: 4301, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/meta.tmpl", size: 4293, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/meta.tmpl b/entc/gen/template/meta.tmpl index 663451fe0..cb65318ee 100644 --- a/entc/gen/template/meta.tmpl +++ b/entc/gen/template/meta.tmpl @@ -115,7 +115,7 @@ const ( // {{ $name }} is a validator for the "{{ $receiver }}" field enum values. It is called by the builders before save. func {{ $name }}({{ $receiver }} {{ $enum }}) error { switch {{ $receiver }} { - case {{ range $i, $e := $f.Enums }}{{ if ne $i 0 }},{{ end }}{{ $f.StructField }}{{ lower $e | pascal }}{{ end }}: + case {{ range $i, $e := $f.Enums }}{{ if ne $i 0 }},{{ end }}{{ $f.StructField }}{{ pascal $e }}{{ end }}: return nil default: return fmt.Errorf("{{ $.Package }}: invalid enum value for {{ $f.Name }} field: %q", {{ $receiver }}) diff --git a/entc/gen/type.go b/entc/gen/type.go index 1ca6be80f..0c008a912 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -615,7 +615,7 @@ func (f Field) Enums() []string { // EnumName returns the constant name of the enum value. func (f Field) EnumName(enum string) string { - return pascal(f.Name) + pascal(strings.ToLower(enum)) + return pascal(f.Name) + pascal(enum) } // Validator returns the validator name. diff --git a/entc/gen/type_test.go b/entc/gen/type_test.go index 3fcb336d3..652c0ed6b 100644 --- a/entc/gen/type_test.go +++ b/entc/gen/type_test.go @@ -136,6 +136,23 @@ func TestType_Receiver(t *testing.T) { } } +func TestField_EnumName(t *testing.T) { + tests := []struct { + name string + enum string + }{ + {"GIF", "TypeGIF"}, + {"SVG", "TypeSVG"}, + {"PNG", "TypePNG"}, + {"MP4", "TypeMP4"}, + {"unknown", "TypeUnknown"}, + {"user_data", "TypeUserData"}, + } + for _, tt := range tests { + require.Equal(t, tt.enum, Field{Name: "Type"}.EnumName(tt.name)) + } +} + func TestType_WithRuntimeMixin(t *testing.T) { position := &load.Position{MixedIn: true} typ := &Type{