diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 1e1b0de6c..1d35b2faf 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -1150,7 +1150,7 @@ func templatePrivacyPrivacyTmpl() (*asset, error) { return a, nil } -var _templateRuntimeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x58\xcb\x8e\xdb\x3a\xd2\x5e\x5b\x4f\x51\xbf\xe0\x1f\x90\x1a\x6e\x3a\xc9\x6e\x32\xf0\x22\x93\xcb\xc4\xc0\x24\x08\x26\x97\x4d\x10\x1c\xb0\xa5\x92\xc5\xd3\x32\xa9\x43\x52\x1d\x1b\x86\xde\x7d\xc0\x9b\x44\xc9\x97\x93\x39\xab\xd9\x74\x4b\x62\xb1\x58\xf5\xd5\x57\x17\xfa\x74\x5a\xdf\x25\xaf\x45\x7b\x94\x6c\x57\x6b\x78\xf1\xec\xf9\xdf\xee\x5b\x89\x0a\xb9\x86\x77\xb4\xc0\x07\x21\x1e\x61\xcb\x0b\x02\xaf\x9a\x06\xac\x90\x02\xb3\x2e\x9f\xb0\x24\xc9\x97\x9a\x29\x50\xa2\x93\x05\x42\x21\x4a\x04\xa6\xa0\x61\x05\x72\x85\x25\x74\xbc\x44\x09\xba\x46\x78\xd5\xd2\xa2\x46\x78\x41\x9e\x85\x55\xa8\x44\xc7\xcb\x84\x71\xbb\xfe\xaf\xed\xeb\xb7\x1f\x3f\xbf\x85\x8a\x35\x08\xfe\x9b\x14\x42\x43\xc9\x24\x16\x5a\xc8\x23\x88\x0a\x74\x74\x98\x96\x88\x24\xb9\x5b\xf7\x7d\x92\x58\x1f\xbe\x98\x2d\x1d\xd7\x6c\x8f\xa0\x71\xdf\x36\x54\x23\xec\x90\xa3\xa4\x1a\x95\xd5\xa8\x8a\x1a\xf7\xf4\x5e\x69\xa6\x8b\x9a\xf1\x1d\x34\x62\xc7\x0a\xa0\xbc\x84\x5a\x34\xa5\x15\x4a\xf6\xa2\xec\x1a\x84\x27\x94\x8a\x09\x63\x09\xd5\xf0\x93\x2a\xe8\x8c\x47\x5a\x0c\x2a\xad\x46\xaa\x14\x6a\x45\x92\x64\xab\xa1\xa6\x0a\x5e\x40\x25\xe4\x9e\x6a\x45\xe0\x15\xa4\xde\x9c\x14\x5a\x5a\x3c\xd2\x1d\x3a\x65\xaa\x16\x5d\x53\xc2\x03\x02\xee\x5b\x7d\xbc\x67\xfb\x56\x48\x8d\xa5\xf7\x3b\xd9\x53\xc6\x87\x1d\x95\x90\xde\x6c\x05\x3f\x99\xae\xa1\x16\xe2\x51\x81\x90\xd0\x8a\x86\x15\x0c\x15\x64\xad\xd0\xc8\x35\xa3\x0d\x14\xc7\xa2\x61\x85\xd7\x98\x13\x8b\x89\xc2\x42\xf0\xd2\xdb\x65\xc2\x13\x1c\x88\xe3\x93\x22\xd7\x83\x99\x2b\x8b\x48\x6c\x1c\x30\x95\x70\xa1\x81\x63\x81\x4a\x51\x79\x84\x8c\x0b\x10\xad\x36\x08\x19\x13\x67\x07\xc3\xf9\xc1\x01\xbe\x47\xc4\x36\x79\xa0\xc5\xe3\x4f\x2a\x4b\x75\x5f\x88\x7d\x4b\x35\x7b\x60\x0d\xd3\x47\xe7\x61\x2b\xf1\x89\x89\x4e\x85\x10\x28\x13\x7a\xe4\x7a\x8c\x36\x94\x58\x31\x8e\x03\xc0\x6b\x6b\x7d\xdf\x27\x00\x00\xa7\xd3\x18\xfe\x31\x02\x4b\xb3\x7c\x3a\x01\xf2\x12\xae\x28\x69\x1f\x77\xb1\x12\x6b\x0b\x1e\xb4\xd9\xb1\x84\xf4\x93\xc3\x26\x8d\x74\x7a\xd9\xeb\x87\x92\x48\x9d\x3f\x78\x71\x3a\xc1\xd2\x53\xec\xe5\x06\x96\xe4\x83\x7d\xde\xf2\x4a\x84\x65\x56\x99\xf0\x7a\x21\xf2\xcd\xf3\x30\xbc\x7f\xee\xf6\x56\xb0\x10\x5c\x69\xc8\x92\xc5\xe2\x74\xba\x77\xc6\xce\xb7\x18\xb1\xc5\x22\xbc\x6d\x20\x3d\x9d\xac\x49\x29\xac\xd7\x10\x3e\x3b\x6c\x6d\xee\xee\x90\x13\xaf\x2f\x58\x7b\xae\x3c\x9c\xbf\x58\x98\xa7\x99\x52\xf3\xe9\xb6\xc2\xdc\xba\xe8\xdf\x6e\xc6\x23\x0d\xdf\x47\x60\x6b\xa4\x25\x4a\x8f\xab\x59\x5a\xba\x6c\x78\xb9\x81\x67\x5e\x9f\xa4\x7c\x87\xb0\xe4\x0e\xdc\x8f\xa2\x44\x35\xc0\xce\xbb\xfd\xfb\x20\xbf\xe4\xe4\x63\x78\xed\x7b\x87\xba\xfb\xf6\xc9\xe4\xd5\xd1\x7d\x1c\xb7\x6c\x80\x96\x65\xf4\xfe\xdc\x09\xc4\x51\xad\x63\x41\xf7\x32\xca\x4f\xbc\x35\xd2\x52\xb7\x8f\x3b\x63\x49\x45\x1b\x85\x83\x0d\x35\x55\xef\x18\x36\x96\x72\x9f\x0b\xd1\x5a\x18\x46\xf9\x0d\xe0\x1f\xb0\x24\x76\x85\x78\x4a\x4e\x10\x9b\x42\x6a\x9c\x72\x1b\xfb\x1e\x4c\x95\x84\xe7\x4a\x87\x8c\xbc\x0f\xe5\x72\xed\xff\x93\x9d\x00\x9b\x62\x9e\x85\xde\x89\x40\xe2\xc5\x25\x92\xaf\x25\xee\x98\xd2\x26\x2a\xcb\x80\x04\x3a\x87\x92\xc5\x62\xbd\x76\x95\xe0\x72\xdd\x9d\xd4\x22\xc6\x4d\x96\x2c\xc9\x6b\xc1\x2b\xb6\x1b\x7c\xeb\xfb\xc8\xba\x39\x77\x02\x70\xeb\x3b\x78\x31\x56\x1a\x43\x36\x7d\xcd\x27\x53\xc5\xfe\xb7\xfc\xba\xe1\xdf\x59\x96\xd8\x4e\x07\xc1\x34\x7f\x3e\xd4\x94\x97\x0d\x4a\x65\xca\xab\x3e\xb6\x18\xea\xb8\x72\x9e\x5f\x28\x75\xa3\x73\x7d\x9f\xf8\x12\x9f\x25\x51\xb2\x07\x73\x3f\xbb\x13\xac\xd3\x43\xa6\x27\x93\x8c\x36\xcf\xd7\xb2\xce\xee\xb9\xe4\xbb\xcd\xad\xe8\x43\xea\xcb\xc4\xfa\x0e\xb6\xce\x1c\x53\x79\x25\xa7\xcd\xcc\x19\x27\x36\x86\xcb\x19\xbf\x36\x6e\xab\xd4\x58\x10\x4c\x0a\x90\x2d\xd2\x1d\xd3\x75\xf7\x40\x0a\xb1\x5f\x57\x7e\xa0\xb1\x0d\xe3\xfa\xd2\xba\x95\xec\x89\x16\xc7\x34\xc9\x93\x24\xf1\xc1\x66\x9c\x69\xa8\x3a\x5e\xd8\xa6\x27\x91\x96\x0a\x68\xd3\x84\x20\x94\xa8\x0a\xc9\x5a\x2d\xa4\x6f\xd4\x61\x16\x31\x85\xd0\xe8\xc8\x4a\xac\x68\xd7\x68\x78\xa2\x4d\x87\x6a\x65\xfe\xb3\x92\x9a\x0d\x2b\xdf\xd5\x4d\xdb\x0d\x6d\x3d\xb7\x6f\x8e\x5a\xa8\x80\x69\xa3\xc3\x04\xb8\x46\x26\x87\xf1\xe0\x89\x4a\x46\x1f\x1a\x54\x24\x31\xa6\x59\x23\xb3\x1c\x4e\xc9\xad\xa8\x98\xb5\xa5\xaf\x3e\x93\x28\xf8\x25\xef\xd1\xcb\x0d\x3c\x50\x85\x17\xc9\x30\x32\x85\x93\x7f\x3b\x47\x3f\xb0\x03\xe3\xa1\x69\x38\xfd\x7d\xef\x3e\xbe\xdc\xd8\x1c\x50\x61\x3f\x71\xe1\xff\x48\xf7\x36\x7f\x7b\x62\xc5\xb2\xfc\x9c\x58\xee\x8c\x61\xd4\xf1\x06\xdb\x0a\xfd\x49\x28\xa6\xed\x78\x30\xd0\x62\x7d\x37\x4e\x45\x8e\xf2\x36\xff\xfc\xb9\x06\xcf\xbd\x39\x48\x91\x91\x4b\xc1\x50\xaf\x14\x36\xe0\x63\x4f\x3e\xe2\xcf\x4f\x5e\x59\x36\x36\x16\x56\x1e\xbc\x15\x1f\xd8\x01\xcb\x2d\x0f\x32\xbe\x4c\x47\x6e\x7f\x37\xef\x46\xbe\xef\x7f\xac\x86\x24\xbe\x09\x44\x3e\xb5\xc9\xb6\x8e\xef\xcf\x7e\xc0\xc6\x12\x2f\xe3\x78\xd0\x76\x12\xfa\xd0\x69\x43\x9c\x3c\x7e\x81\x93\x69\xca\x12\x75\x27\xf9\xf8\x1d\xdf\x99\x8d\x76\x77\xa1\x0f\x50\x08\xae\xf1\xa0\x4d\x44\xcd\xff\x15\xec\x47\x51\x26\x78\x0e\x99\x79\xfd\x66\x18\xba\x02\x94\xd2\x9c\x61\xf5\x2e\x58\x65\xde\x43\x28\x27\xa0\x91\xb7\x4f\xb4\x09\x2a\xcc\x31\x2b\xd8\xe7\x7f\xb7\xe2\xff\xb7\x01\xce\x1a\xaf\x22\x18\xc7\x59\x63\x95\xdb\x8f\x76\x94\x18\x56\x8c\x6d\xce\xee\xa0\xc7\x2c\x5b\x5c\xfa\x6b\xec\xa8\xa3\x9e\x6e\x10\x9b\x10\x63\x1c\xd0\x2c\x3d\x5c\x33\x3e\xe7\xc6\x19\x2f\x82\xf2\xb3\x78\x0f\xed\x7c\xb1\x88\x4b\x1f\xb3\x52\x2e\xda\xd6\xa3\xd3\xc9\x30\x89\x6b\x87\x55\x6a\x19\x61\xf7\xa6\x46\xb8\xef\xa7\x48\x46\x84\x31\x74\x71\x91\xcf\xf2\x70\xc8\x64\x1c\xf3\x2f\x33\xcf\xb6\xe6\x7a\x84\x12\x81\x4a\xf4\xe5\x24\x72\x73\xbc\xfd\x78\x1f\xe3\xdd\x9e\x8f\xc3\x6c\x14\x4d\x24\xde\xbb\xd6\x7a\x57\x4f\xa6\x25\xdb\x49\xdb\x00\xcb\x84\xd9\x61\x64\xd2\xb2\xc3\x78\x26\x89\x06\x26\xeb\x89\x99\x31\xe2\x1d\x01\xd5\x09\x72\x1e\xb4\x11\xb1\xeb\x65\x64\x44\xed\x0c\xb4\x10\xa6\xd5\xdc\x99\x00\xf1\xf9\xfc\x17\xc2\xb8\x64\x61\xa8\x63\x76\xec\x3b\x0b\xca\xb0\x3f\x46\x63\x40\x38\xba\x22\xc4\x6e\x91\xc1\xaf\x31\xec\xb0\x39\x13\x9b\xf0\xa6\x75\x85\x72\xcb\x4b\x3c\x84\x8d\x2d\x09\xaf\x3f\x06\xc3\xfc\x9c\xf2\xd7\x2c\xb8\x06\xff\xd5\xd3\x2e\x70\xf3\xec\xd9\xdf\x69\x38\x79\x4f\xd5\x1b\xdf\x07\xdd\xdb\xb7\xa1\x0b\xce\x49\x7d\x25\x01\xed\x78\xac\xe6\xfe\x5d\x4b\xc5\x3f\xc1\xc0\xe2\xe9\x34\xfe\x52\x5e\x3a\xd1\x2c\x3f\xd3\xfb\x1b\x9c\x6d\x73\xb2\x61\xef\x99\xb5\x17\x71\x73\x0d\xb8\x72\x2e\x3a\xb7\x07\x7f\x87\x4b\xca\xf6\x0d\xf9\xaa\x50\xbe\xf1\xe9\xed\x32\xcf\xef\xd9\x00\x6d\x5b\x7b\x65\xf5\x1f\xac\xfc\x85\xdc\x73\xe8\x56\x03\x98\x8b\xb8\xf3\xbc\x1b\x0c\xb8\x9d\x70\x03\x1c\x8b\xc5\x62\x8a\x80\x5b\xf9\x93\x4c\xac\xac\x8b\x33\x1b\xee\x61\x69\x66\x29\xb3\x14\x47\xea\x0d\xaa\x22\x85\x65\x45\x3e\x6b\xd9\x15\xda\x5d\x92\xc6\x3d\xeb\x3b\x40\xde\xed\x61\x3a\x64\xf9\xd1\xb8\x04\x8e\x54\xfa\xd1\xa9\xc4\xa2\xa1\x92\xba\x0e\x91\x99\xda\x18\x8d\xcc\xf9\xd0\x02\x22\xda\x66\xd4\xe2\x49\x02\x71\x33\x5b\xfa\x2a\xb2\x55\x6f\x79\xb7\xcf\x73\xf3\xfc\xb5\x2d\xa9\xc6\x81\xda\x15\x99\xf2\xda\x94\x92\xf5\xda\xe2\x63\x9d\xeb\x7b\x73\x4b\x18\xab\x72\x34\x3e\xda\xdf\x53\x6c\x44\x03\xd0\x60\x11\x22\xbe\x1e\xb9\x52\x53\x91\xd0\xe6\xe2\x9a\xb3\x08\x25\x2b\x1c\xf2\xf2\x2c\x9f\xa7\x8c\x9f\xaa\x99\x95\x96\x68\x71\xc8\x7a\xf2\x66\x30\xd4\x85\x7d\x52\x71\xae\x9c\x3f\xe1\xc4\x7f\xab\x7a\x52\x65\xe7\xed\xe3\x76\x64\xa6\x9c\x72\x22\x33\x5a\x91\x34\xda\xef\xf1\x4e\xe2\x60\xb9\x5d\x7d\x3f\xfe\x42\x38\xe5\x18\x08\x0e\x85\x44\x3a\xfc\x14\x66\x24\xae\x85\x2f\xb6\xe4\x8b\xa1\xdd\x68\x4d\x45\xcc\x07\xfb\x67\xc8\x75\x53\x32\x8d\x33\x5f\xcc\x3d\xc2\x3e\x7d\xfd\x1a\x92\x79\xa2\x26\x68\x49\xed\xa0\x97\x43\x1a\xf4\xcd\x12\x7f\x06\xdb\x7b\xaa\xfe\x29\xac\x98\x05\x2e\xab\xa9\xfa\x24\xb1\x62\x87\xa9\x76\xab\x35\xcd\xf3\xb8\x27\x46\xc0\x6c\xbc\xbb\xfe\xbc\x2c\x8a\x7f\x00\x96\x64\x73\x8b\xfb\x3e\xcf\xe7\xfd\xea\xaa\xee\x5f\xd1\x76\xb3\x1d\x45\x69\x33\x4d\xd4\x5f\x25\xc8\x64\xd7\x5f\xa5\x49\x67\x95\xfc\x02\x49\x6e\x40\x30\x31\xc4\x02\xe1\xdc\xf2\x24\xe9\x7b\xcf\x80\xc9\x7d\x63\x88\xcd\xc5\xd1\xc8\x77\x82\xf3\x8a\x65\x61\xe1\xc6\xbe\x8b\x98\x0c\xf2\xb1\xb8\xf6\xac\x76\xf2\x95\xe3\x0e\x64\xff\xaf\x72\x77\x9d\x48\xe7\x4c\x8f\x50\xe4\x1e\x0a\xa6\x80\x8e\xb7\xe3\x01\xaf\x74\x02\x58\xea\x11\x83\xad\xfd\x51\xbb\xa0\x8d\xa9\xf3\x0f\x47\x2b\xfa\xd0\xb1\xa6\x44\xa9\xe0\x01\x2b\x21\x11\x14\x7d\x42\x12\xf1\x1f\xff\x98\x39\xfc\x3c\xe6\x5f\xb0\x63\x8a\xfc\x28\xfd\xfd\xd9\x0f\x47\x41\x3d\xe7\xde\x8c\xc8\xa3\xa2\x31\x2a\x61\x53\xb8\x13\x8d\xbf\x02\x84\x62\x79\x7e\xa0\x93\xac\xb8\x15\xf9\x4e\x08\xf9\x61\xf5\x4d\x43\xeb\xf0\x0d\x6a\xe3\x56\xfb\xfb\xca\xff\x08\x70\xf0\x1f\x2e\x75\xa7\x89\x29\xb6\x46\xff\x6e\x8b\x72\x36\x3b\x6a\x76\x5e\xbe\x8a\xce\x1b\xeb\x4c\xb8\xd7\x85\x8b\x5d\xa4\xe4\x1f\x2e\x36\xa1\x81\xc3\x4d\x2f\x4c\xec\x7f\x5b\x41\x65\xcd\x77\xd6\x1b\x18\xc2\x72\x74\x2b\xad\xf8\x65\xfd\x17\x2f\xa2\xd1\x45\xd9\x5f\x43\x47\x8b\x87\xff\xe3\x6d\x35\xf6\xa8\xbf\x7d\x2b\x8b\x9f\x2f\x3f\xc6\x3f\xe8\xfd\x27\x00\x00\xff\xff\xfc\x49\xbb\x65\x7d\x1b\x00\x00") +var _templateRuntimeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x58\x5d\x8f\xdb\x3a\xce\xbe\x8e\x7f\x05\x5f\x23\x2f\x10\x0f\x32\x4e\xdb\xbb\xed\x22\x17\xdd\x7e\x6c\x03\x6c\x8b\x62\xfb\x71\x53\x14\x07\x1a\x9b\x4e\x74\xc6\x91\x7c\x24\x79\x3a\x83\xc0\xff\x7d\x21\x4a\xb2\x65\x3b\xc9\xe9\x9e\xab\xbd\x99\xb1\x24\x8a\x22\x1f\x3e\xa4\xa8\x9c\x4e\x9b\x9b\xe4\xb5\x6c\x9e\x14\xdf\x1f\x0c\xbc\x78\xf6\xfc\x6f\xb7\x8d\x42\x8d\xc2\xc0\x3b\x56\xe0\x9d\x94\xf7\xb0\x13\x45\x0e\xaf\xea\x1a\x48\x48\x83\x5d\x57\x0f\x58\xe6\xc9\x97\x03\xd7\xa0\x65\xab\x0a\x84\x42\x96\x08\x5c\x43\xcd\x0b\x14\x1a\x4b\x68\x45\x89\x0a\xcc\x01\xe1\x55\xc3\x8a\x03\xc2\x8b\xfc\x59\x58\x85\x4a\xb6\xa2\x4c\xb8\xa0\xf5\x7f\xed\x5e\xbf\xfd\xf8\xf9\x2d\x54\xbc\x46\xf0\x73\x4a\x4a\x03\x25\x57\x58\x18\xa9\x9e\x40\x56\x60\xa2\xc3\x8c\x42\xcc\x93\x9b\x4d\xd7\x25\x09\xf9\xf0\xc5\x6e\x69\x85\xe1\x47\x04\x83\xc7\xa6\x66\x06\x61\x8f\x02\x15\x33\xa8\x49\xa3\x2e\x0e\x78\x64\xb7\xda\x70\x53\x1c\xb8\xd8\x43\x2d\xf7\xbc\x00\x26\x4a\x38\xc8\xba\x24\xa1\xe4\x28\xcb\xb6\x46\x78\x40\xa5\xb9\xb4\x96\x30\x03\x3f\x99\x86\xd6\x7a\x64\x64\xaf\x92\x34\x32\xad\xd1\xe8\x3c\x49\x76\x06\x0e\x4c\xc3\x0b\xa8\xa4\x3a\x32\xa3\x73\x78\x05\xa9\x37\x27\x85\x86\x15\xf7\x6c\x8f\x4e\x99\x3e\xc8\xb6\x2e\xe1\x0e\x01\x8f\x8d\x79\xba\xe5\xc7\x46\x2a\x83\xa5\xf7\x3b\x39\x32\x2e\xfa\x1d\x95\x54\xde\x6c\x0d\x3f\xb9\x39\xc0\x41\xca\x7b\x0d\x52\x41\x23\x6b\x5e\x70\xd4\xb0\x6a\xa4\x41\x61\x38\xab\xa1\x78\x2a\x6a\x5e\x78\x8d\x59\x4e\x98\x68\x2c\xa4\x28\xbd\x5d\x36\x3c\xc1\x81\x38\x3e\x29\x0a\xd3\x9b\xb9\x26\x44\x62\xe3\x80\xeb\x44\x48\x03\x02\x0b\xd4\x9a\xa9\x27\x58\x09\x09\xb2\x31\x16\x21\x6b\xe2\xe4\x60\x98\x1f\x1c\xe0\xbb\x47\x6c\x92\x3b\x56\xdc\xff\x64\xaa\xd4\xb7\x85\x3c\x36\xcc\xf0\x3b\x5e\x73\xf3\xe4\x3c\x6c\x14\x3e\x70\xd9\xea\x10\x02\x6d\x43\x8f\xc2\x0c\xd1\x86\x12\x2b\x2e\xb0\x07\x78\x43\xd6\x77\x5d\x02\x00\x70\x3a\x0d\xe1\x1f\x22\xb0\xb4\xcb\xa7\x13\xa0\x28\xe1\x82\x92\xe6\x7e\x1f\x2b\x21\x5b\xf0\xd1\xd8\x1d\x4b\x48\x3f\x39\x6c\xd2\x48\xa7\x97\xbd\x7c\x68\x1e\xa9\xf3\x07\x2f\x4e\x27\x58\x7a\x8a\xbd\xdc\xc2\x32\xff\x40\xdf\x3b\x51\xc9\xb0\xcc\x2b\x1b\x5e\x2f\x94\x7f\xf3\x3c\x0c\xe3\xcf\xed\x91\x04\x0b\x29\xb4\x81\x55\xb2\x58\x9c\x4e\xb7\xce\xd8\xe9\x16\x2b\xb6\x58\x84\xd1\x16\xd2\xd3\x89\x4c\x4a\x61\xb3\x81\x30\xed\xb0\xa5\xdc\xdd\xa3\xc8\xbd\xbe\x60\xed\x5c\x79\x38\x7f\xb1\xb0\x5f\x13\xa5\x76\xea\xba\xc2\x8c\x5c\xf4\xa3\xab\xf1\x48\xc3\xfc\x00\xec\x01\x59\x89\xca\xe3\x6a\x97\x96\x2e\x1b\x5e\x6e\xe1\x99\xd7\xa7\x98\xd8\x23\x2c\x85\x03\xf7\xa3\x2c\x51\xf7\xb0\x8b\xf6\xf8\x3e\xc8\x2f\x45\xfe\x31\x0c\xbb\xce\xa1\xee\xe6\x3e\xd9\xbc\x7a\x72\x93\xc3\x96\x2d\xb0\xb2\x8c\xc6\xcf\x9d\x40\x1c\xd5\x43\x2c\xe8\x06\x83\xfc\xc8\x5b\x2b\xad\x4c\x73\xbf\xb7\x96\x54\xac\xd6\xd8\xdb\x70\x60\xfa\x1d\xc7\x9a\x28\xf7\xb9\x90\x0d\xc1\x30\xc8\x6f\x01\xff\x80\x65\x4e\x2b\xb9\xa7\xe4\x08\xb1\x31\xa4\xd6\x29\xb7\xb1\xeb\xc0\x56\x49\x78\xae\x4d\xc8\xc8\xdb\x50\x2e\x37\xfe\x7f\xbe\x97\x40\x29\xe6\x59\xe8\x9d\x08\x24\x5e\x9c\x23\xf9\x46\xe1\x9e\x6b\x63\xa3\xb2\x0c\x48\xa0\x73\x28\x59\x2c\x36\x1b\x57\x09\xce\xd7\xdd\x51\x2d\xe2\xc2\x66\xc9\x32\x7f\x2d\x45\xc5\xf7\xbd\x6f\x5d\x17\x59\x37\xe5\x4e\x00\x6e\x73\x03\x2f\x86\x4a\x63\xc9\x66\x2e\xf9\x64\xab\xd8\xff\x96\x5f\x57\xfc\x9b\x65\x09\xdd\x74\x10\x4c\xf3\xe7\xc3\x81\x89\xb2\x46\xa5\x6d\x79\x35\x4f\x0d\x86\x3a\xae\x9d\xe7\x67\x4a\xdd\xe0\x5c\xd7\x25\xbe\xc4\xaf\x92\x28\xd9\x83\xb9\x9f\xdd\x09\xe4\x74\x9f\xe9\xc9\x28\xa3\xed\xf7\xa5\xac\xa3\x3d\xe7\x7c\xa7\xdc\x8a\x26\x52\x5f\x26\x36\x37\xb0\x73\xe6\xd8\xca\xab\x04\xab\x27\xce\x38\xb1\x21\x5c\xce\xf8\x8d\x75\x5b\xa7\xd6\x82\x60\x52\x80\x6c\x91\xee\xb9\x39\xb4\x77\x79\x21\x8f\x9b\xca\x37\x34\x74\x61\x5c\x5e\xda\x34\x8a\x3f\xb0\xe2\x29\x4d\xb2\x24\x49\x7c\xb0\xb9\xe0\x06\xaa\x56\x14\x74\xe9\x29\x64\xa5\x06\x56\xd7\x21\x08\x25\xea\x42\xf1\xc6\x48\xe5\x2f\xea\xd0\x8b\xd8\x42\x68\x75\xac\x4a\xac\x58\x5b\x1b\x78\x60\x75\x8b\x7a\x6d\xff\xf3\x92\xd9\x0d\x6b\x7f\xab\xdb\x6b\x37\x5c\xeb\x19\x8d\x1c\xb5\x50\x03\x37\x56\x87\x0d\xf0\x01\xb9\xea\xdb\x83\x07\xa6\x38\xbb\xab\x51\xe7\x89\x35\x8d\x8c\x5c\x65\x70\x4a\xae\x45\xc5\xae\x2d\x7d\xf5\x19\x45\xc1\x2f\x79\x8f\x5e\x6e\xe1\x8e\x69\x3c\x4b\x86\x81\x29\x22\xff\xb7\x73\xf4\x03\x7f\xe4\x22\x5c\x1a\x4e\x7f\xd7\xb9\xc9\x97\x5b\xca\x01\x1d\xf6\xe7\x2e\xfc\x1f\xd9\x91\xf2\xb7\xcb\x49\x6c\x95\xcd\x89\xe5\xce\xe8\x5b\x1d\x6f\x30\x55\xe8\x4f\x52\x73\x43\xed\x41\x4f\x8b\xcd\xcd\xd0\x15\x39\xca\x53\xfe\xf9\x73\x2d\x9e\x47\x7b\x90\xce\x07\x2e\x05\x43\xbd\x52\xd8\x82\x8f\x7d\xfe\x11\x7f\x7e\xf2\xca\x56\xc3\xc5\xc2\xcb\x47\x6f\xc5\x07\xfe\x88\xe5\x4e\x04\x19\x5f\xa6\x23\xb7\xbf\xdb\xb1\x95\xef\xba\x1f\xeb\x3e\x89\xaf\x02\x91\x8d\x6d\xa2\xab\xe3\xfb\xb3\x1f\xb0\x25\xe2\xad\x04\x3e\x1a\xea\x84\x3e\xb4\xc6\x12\x27\x8b\x07\x70\xb2\x97\xb2\x42\xd3\x2a\x31\xcc\xe3\x3b\xbb\x91\x76\x17\xe6\x11\x0a\x29\x0c\x3e\x1a\x1b\x51\xfb\x7f\x0d\xc7\x41\x94\x4b\x91\xc1\xca\x0e\xbf\x59\x86\xae\x01\x95\xb2\x67\x90\xde\x05\xaf\xec\x38\x84\x72\x04\x5a\xfe\xf6\x81\xd5\x41\x85\x3d\x66\x0d\xc7\xec\xef\x24\xfe\x7f\x5b\x10\xbc\xf6\x2a\x82\x71\x82\xd7\xa4\x9c\x26\xa9\x95\xe8\x57\xac\x6d\xce\xee\xa0\xc7\x2e\x13\x2e\xdd\x25\x76\x1c\xa2\x3b\xdd\x22\x36\x22\xc6\xd0\xa0\x11\x3d\xdc\x65\x3c\xe7\xc6\x8c\x17\x41\xf9\x2c\xde\xfd\x75\xbe\x58\xc4\xa5\x8f\x93\x94\x8b\x36\x79\x74\x3a\x59\x26\x09\xe3\xb0\x4a\x89\x11\xb4\x37\xb5\xc2\x5d\x37\x46\x32\x22\x8c\xa5\x8b\x8b\xfc\x2a\x0b\x87\x8c\xda\x31\x3f\x98\x78\xb6\xb3\xcf\x23\x54\x08\x4c\xa1\x2f\x27\x91\x9b\xc3\xeb\xc7\xfb\x18\xef\xf6\x7c\xec\x7b\xa3\xa8\x23\xf1\xde\x35\xe4\xdd\x61\xd4\x2d\xd1\x4d\xda\x04\x58\x46\xcc\x0e\x2d\x93\x51\x2d\xc6\x3d\x49\xd4\x30\x91\x27\xb6\xc7\x88\x77\x04\x54\x47\xc8\x79\xd0\x06\xc4\x2e\x97\x91\x01\xb5\x19\x68\x21\x4c\xeb\xa9\x33\x01\xe2\x79\xff\x17\xc2\xb8\xe4\xa1\xa9\xe3\xd4\xf6\xcd\x82\xd2\xef\x8f\xd1\xe8\x11\x8e\x9e\x08\xb1\x5b\x79\xef\xd7\x10\x76\xd8\xce\xc4\x46\xbc\x69\x5c\xa1\xdc\x89\x12\x1f\xc3\xc6\x26\x0f\xc3\x1f\xbd\x61\xbe\x4f\xf9\x6b\x16\x5c\x82\xff\xe2\x69\x67\xb8\x39\xfb\xf6\x6f\x1a\x91\xbf\x67\xfa\x8d\xbf\x07\xdd\xe8\x5b\x7f\x0b\x4e\x49\x7d\x21\x01\xa9\x3d\xd6\x53\xff\x2e\xa5\xe2\x9f\x60\x40\x78\x3a\x8d\xbf\x94\x97\x4e\x74\x95\xcd\xf4\xfe\x06\xb3\x6d\x4e\x36\xec\x9d\x59\x7b\x16\x37\x77\x01\x57\xce\x45\xe7\x76\xef\x6f\xff\x48\xd9\xbd\xc9\xbf\x6a\x54\x6f\x7c\x7a\xbb\xcc\xf3\x7b\xb6\xc0\x9a\x86\x9e\xac\x7e\x82\xe4\xcf\xe4\x9e\x43\xb7\xea\xc1\x5c\xc4\x37\xcf\xbb\xde\x80\xeb\x09\xd7\xc3\xb1\x58\x2c\xc6\x08\xb8\x95\x3f\xc9\xc4\x8a\x5c\x9c\xd8\x70\x0b\x4b\xdb\x4b\xd9\xa5\x38\x52\x6f\x50\x17\x29\x2c\xab\xfc\xb3\x51\x6d\x61\xdc\x23\x69\xd8\xb3\xb9\x01\x14\xed\x11\xc6\x4d\x96\x6f\x8d\x4b\x10\xc8\x94\x6f\x9d\x4a\x2c\x6a\xa6\x98\xbb\x21\x56\xb6\x36\x46\x2d\x73\xd6\x5f\x01\x11\x6d\x57\x8c\xf0\xcc\x03\x71\x57\x54\xfa\xaa\x7c\xa7\xdf\x8a\xf6\x98\x65\xf6\xfb\x6b\x53\x32\x83\x3d\xb5\xab\x7c\xcc\x6b\x5b\x4a\x36\x1b\xc2\x87\x9c\xeb\x3a\xfb\x4a\x18\xaa\x72\xd4\x3e\xd2\xef\x29\x14\xd1\x00\x34\x10\x42\xb9\xaf\x47\xae\xd4\x54\x79\xb8\xe6\xe2\x9a\xb3\x08\x25\x2b\x1c\xf2\x72\x96\xcf\x63\xc6\x8f\xd5\x4c\x4a\x4b\xb4\xd8\x67\x7d\xfe\xa6\x37\xd4\x85\x7d\x54\x71\x2e\x9c\x3f\xe2\xc4\x7f\xab\x7a\x54\x65\x67\x35\xf7\x7a\x68\x86\x2a\x4e\xac\x72\x32\x13\x62\xe5\x69\xa4\xc0\x23\x3e\x8e\x97\xdb\xd6\x75\xc3\x8f\x84\x63\x9a\x81\x14\x50\x28\x64\xfd\xaf\x61\x56\xe2\x6a\x04\x83\xd2\x2f\x96\x7a\x83\x3d\x55\x6e\x27\xe8\x4f\x9f\xef\xb6\x6c\x5a\x7f\xbe\xd8\xb7\x04\x7d\x7d\xfd\x1a\x12\x7a\xa4\x26\x68\x49\xa9\xd9\xcb\x20\x0d\xfa\x26\xc9\x3f\x85\xee\x3d\xd3\xff\x94\x24\x47\xe0\xad\x0e\x4c\x7f\x52\x58\xf1\xc7\xb1\x7a\x52\x9b\x66\xd9\x24\xcc\x3d\x36\x5b\xef\xb1\x3f\x71\x15\xb1\x20\x80\x9b\xaf\xa6\x36\x77\x5d\x76\x95\x44\x13\xed\xbf\xa2\xef\x57\x89\x33\xcb\xd9\x5f\xa6\xca\x68\xdb\x5f\x26\x4c\x4b\x5a\x7e\x85\x2e\x57\x80\x18\x99\x42\x70\x38\xcf\x3c\x5d\xba\xce\x73\x61\xf4\xfa\xe8\x63\x34\x6f\x2f\xe3\x9b\xe1\x4c\x05\x23\x6c\x84\xb5\xf1\x2c\x30\xfd\x86\x91\xbc\xf1\x1c\x77\x1b\x2a\x47\x24\x58\xfd\xbf\xce\xdc\x03\x23\x9d\xf2\x3e\xc6\x52\x78\x40\xb8\x06\x36\x3c\x98\x7b\xd4\xd2\x11\x6c\xa9\xc7\x0d\x76\xf4\x3b\x77\xc1\x6a\x5b\xfa\xef\x9e\x48\xf4\xae\xe5\x75\x89\x4a\xc3\x1d\x56\x52\x21\x68\xf6\x80\xa3\x92\x8a\x7f\x4c\x9c\x7e\x3e\x22\x63\xb0\x64\x1c\x80\x41\xfc\xfb\xb3\x1f\x8e\x8f\x66\x46\xc4\x29\xaf\x07\x55\x43\x78\xc2\xb6\xf0\x54\x5a\x0c\xbf\x0e\x84\x22\x3a\x3f\xd3\x8b\x56\x82\x64\xbe\xe7\x79\xfe\x83\x34\x8e\xa3\xec\x60\xee\x15\xc7\x97\xf0\xef\x6b\xff\xf3\xc0\xa3\x9f\x38\x17\xf5\xb1\x35\x54\xbe\x7f\xa7\x7a\xbd\x9a\x1c\x36\x39\x31\x5b\xc7\x27\x46\xf5\x27\x3c\xfa\xfa\x67\x5f\xa4\xe7\x1f\x2e\x4c\xe1\x7a\x87\xeb\xae\x58\x1e\xfc\xb6\x86\x8a\x7c\x70\x2e\x58\x30\xfa\xf5\xe8\xd5\x5a\x89\xf3\x27\x9c\x7d\xa8\x46\xb6\x85\x77\x6a\x6c\xf6\xf0\x31\xbc\x68\xc7\x9e\x75\xe7\x6e\xb0\x0b\x0d\xf2\xf9\xcf\xf8\x77\xbf\xff\x04\x00\x00\xff\xff\xda\xd3\x5a\x17\xa4\x1b\x00\x00") func templateRuntimeTmplBytes() ([]byte, error) { return bindataRead( @@ -1165,7 +1165,7 @@ func templateRuntimeTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/runtime.tmpl", size: 7037, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/runtime.tmpl", size: 7076, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/runtime.tmpl b/entc/gen/template/runtime.tmpl index 4c8be1b5c..1d1eab9c9 100644 --- a/entc/gen/template/runtime.tmpl +++ b/entc/gen/template/runtime.tmpl @@ -148,45 +148,45 @@ func init() { {{ $desc }} := {{ $pkg }}Fields[{{ $f.Position.Index }}].Descriptor() {{- end }} {{- end }} - {{- if and $f.Default (not $f.IsEnum) }} - {{- $default := print $pkg "." $f.DefaultName }} - // {{ $default }} holds the default value on creation for the {{ $f.Name }} field. - {{- $defaultType := print $f.Type.Type }}{{ if or $f.IsTime $f.IsUUID }}{{ $defaultType = print "func() " $f.Type }}{{ end }} - {{- if and $f.HasGoType (not (hasPrefix $defaultType "func")) }} - {{ $default }} = {{ $f.Type }}({{ $desc }}.Default.({{ $defaultType }})) - {{- else }} - {{ $default }} = {{ $desc }}.Default.({{ $defaultType }}) + {{- if and $f.Default (not $f.IsEnum) }} + {{- $default := print $pkg "." $f.DefaultName }} + // {{ $default }} holds the default value on creation for the {{ $f.Name }} field. + {{- $defaultType := print $f.Type.Type }}{{ if or $f.IsTime $f.IsUUID }}{{ $defaultType = print "func() " $f.Type }}{{ end }} + {{- if and $f.HasGoType (not (hasPrefix $defaultType "func")) }} + {{ $default }} = {{ $f.Type }}({{ $desc }}.Default.({{ $defaultType }})) + {{- else }} + {{ $default }} = {{ $desc }}.Default.({{ $defaultType }}) + {{- end }} {{- end }} - {{- end }} - {{- if $f.UpdateDefault }} - {{- $default := print $pkg "." $f.UpdateDefaultName }} - // {{ $default }} holds the default value on update for the {{ $f.Name }} field. - {{ $default }} = {{ $desc }}.UpdateDefault.({{ if $f.IsTime }}func() {{ end }}{{ $f.Type }}) - {{- end }} - {{- with $f.Validators }} - {{- $name := print $pkg "." $f.Validator }} - {{- $type := printf "func (%s) error" $f.Type.Type }} - // {{ $name }} is a validator for the "{{ $f.Name }}" field. It is called by the builders before save. - {{- if eq $f.Validators 1 }} - {{ $name }} = {{ $desc }}.Validators[0].({{ $type }}) - {{- else }} - {{ $name }} = func() {{ $type }} { - validators := {{ $desc }}.Validators - fns := [...]func({{ $f.Type }}) error { - {{- range $j, $n := xrange $f.Validators }} - validators[{{ $j }}].(func({{ $f.Type.Type }}) error), - {{- end }} - } - return func({{ $f.BuilderField }} {{ $f.Type }}) error { - for _, fn := range fns { - if err := fn({{ $f.BuilderField }}); err != nil { - return err - } + {{- if $f.UpdateDefault }} + {{- $default := print $pkg "." $f.UpdateDefaultName }} + // {{ $default }} holds the default value on update for the {{ $f.Name }} field. + {{ $default }} = {{ $desc }}.UpdateDefault.({{ if $f.IsTime }}func() {{ end }}{{ $f.Type }}) + {{- end }} + {{- with $f.Validators }} + {{- $name := print $pkg "." $f.Validator }} + {{- $type := printf "func (%s) error" $f.Type.Type }} + // {{ $name }} is a validator for the "{{ $f.Name }}" field. It is called by the builders before save. + {{- if eq $f.Validators 1 }} + {{ $name }} = {{ $desc }}.Validators[0].({{ $type }}) + {{- else }} + {{ $name }} = func() {{ $type }} { + validators := {{ $desc }}.Validators + fns := [...]func({{ $f.Type }}) error { + {{- range $j, $n := xrange $f.Validators }} + validators[{{ $j }}].(func({{ $f.Type.Type }}) error), + {{- end }} } - return nil - } - }() - {{- end }} + return func({{ $f.BuilderField }} {{ $f.Type }}) error { + for _, fn := range fns { + if err := fn({{ $f.BuilderField }}); err != nil { + return err + } + } + return nil + } + }() + {{- end }} {{- end }} {{- end }} {{- end }}