diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 2297fc6cd..58528f2e6 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -600,7 +600,7 @@ func templateDialectSqlCreateTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlDecodeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x5b\x6f\x1b\x37\x13\x7d\x96\x7e\xc5\x64\x21\x1b\x92\x20\xad\x9c\xe0\xc3\x07\xd4\xa9\x0b\x04\x71\x02\xa8\x2d\xdc\xc0\x8e\xf3\x12\x04\x05\xb3\x1c\x4a\xac\xb8\xa4\x42\x52\xbe\x60\xb1\xff\xbd\xe0\x65\x25\xae\x6e\xb1\x1b\xe4\x6d\xc9\x21\x67\x86\x67\xce\x19\x72\xab\x6a\x32\xec\xbe\x55\xcb\x47\xcd\x67\x73\x0b\xaf\xce\x5e\xfe\x32\x5e\x6a\x34\x28\x2d\xbc\x27\x05\x7e\x55\x6a\x01\x53\x59\xe4\xf0\x46\x08\xf0\x8b\x0c\x38\xbb\xbe\x43\x9a\x77\x3f\xce\xb9\x01\xa3\x56\xba\x40\x28\x14\x45\xe0\x06\x04\x2f\x50\x1a\xa4\xb0\x92\x14\x35\xd8\x39\xc2\x9b\x25\x29\xe6\x08\xaf\xf2\xb3\xc6\x0a\x4c\xad\x24\xed\x72\xe9\xed\x7f\x4e\xdf\xbe\xbb\xba\x79\x07\x8c\x0b\x84\x38\xa7\x95\xb2\x40\xb9\xc6\xc2\x2a\xfd\x08\x8a\x81\x4d\x82\x59\x8d\x98\x77\x87\x93\xba\xee\x76\xab\x0a\x28\x32\x2e\x11\x32\xca\x89\xc0\xc2\x4e\xcc\x37\x31\xa1\xe8\x32\x9a\x28\x89\x19\xd4\xb5\x5b\xd5\xd3\x58\x20\xbf\x43\x0d\xe7\x17\xd0\xcb\xaf\x9b\x91\x73\x32\x99\x80\x29\x88\xfc\x44\xc4\x0a\xdd\x09\xed\x4a\x4b\xe3\x13\xb1\x8f\x4b\x34\xc0\x94\xf6\x0b\x24\x97\x33\xb8\x0b\xab\x98\x56\x25\x98\x6f\x22\xbf\x56\xf7\x26\xef\xb2\x95\x2c\xa0\x3f\x74\x81\xf2\x2b\x52\x22\xd4\xf5\x20\x71\xda\x1f\xc0\xe7\x2f\x5c\x5a\xd4\x8c\x14\x58\xd5\x50\x75\x3b\x21\xce\xee\x7c\xe7\xb4\xaa\x80\x33\x90\xca\x42\x2f\x9f\x5e\xe6\xb7\x06\xf5\xa5\x3f\x24\x85\xba\x76\x31\xaf\x56\x42\x4c\xa5\xfd\xff\xff\xaa\x0a\x50\x18\x17\xcd\x47\x9e\x5e\x7a\xd3\xc7\xc7\x65\x9c\x42\xe9\xb6\x54\xf5\x08\x26\x13\x58\x2f\x09\xf9\x75\x3b\x9d\xaa\x1a\x83\x26\x72\x86\xd0\xfb\x7b\x04\x3d\x16\xb0\x79\xcf\x51\x50\x13\x56\xf8\x64\x7a\xac\xe5\x76\xe3\x8d\x6d\xf9\x0a\xe1\xba\x9d\xba\xeb\x4b\x33\x86\x7b\x6e\xe7\xce\xa3\xd2\xc8\x67\xf2\x0f\x7c\x0c\x6e\x27\x13\x60\x8b\xa7\xc1\xcd\xc2\xd6\xf1\xc2\xed\xdd\x8f\x7d\x67\x2f\xf8\x4d\x80\x7d\xd0\x1f\xc6\x3e\x85\x84\x2d\x1c\x1e\x79\x04\xc2\x5b\x22\x44\x6c\x11\x40\x6a\x4c\x69\xc5\xd8\xd3\xeb\xc5\xbe\x57\xad\x14\xdf\x16\xc0\x1d\x0f\x72\x32\xe3\x38\x4c\x8c\xe1\xb3\x86\xc5\x61\x10\x60\x8d\xb0\xd9\x39\xb1\x70\x8f\x1a\x23\xe6\x48\xdb\x48\x42\x9f\x30\x8b\x1b\xec\x07\xce\xa9\x55\xde\x45\x8a\x2d\x30\x4f\x90\x86\xf4\x2d\x71\xd5\x35\x6c\xd5\x21\xcd\xaa\x1f\x33\xc9\xf3\x3c\x01\x7e\x00\xa8\xb5\xd2\x1e\x7f\xce\xa0\x1c\x81\x74\x28\x0b\x94\x71\xfd\x60\xe4\x07\xde\xef\x07\x52\x2c\xc8\xcc\xb9\xce\xdf\x2a\xb1\x2a\xa5\x19\xbc\x86\x12\x7e\x05\x19\xea\x17\x2b\xcb\x4a\x9b\xbf\x73\x5e\x59\x3f\x2b\xb9\x29\x89\x2d\xe6\x20\x57\xe5\x57\xd4\xae\x9d\xb8\x23\x46\x58\xce\xe1\x84\xc2\x8b\x0b\x38\xa1\xd9\xc8\xc7\x1e\x04\x78\x3d\xde\x9c\x01\x91\x74\x57\x86\x7d\xa5\xc3\xe4\xd4\xdc\x58\xed\x78\x1a\x47\xb7\xb7\xd3\xcb\x41\x52\x30\x2f\x00\x7c\xb0\xae\x4c\x3d\xc8\xa6\xf4\x21\x83\x33\xc8\x3c\x7b\x32\xbf\x09\xb2\x6b\x2c\xb2\x16\x84\x91\x6e\x60\xb1\x5c\x0a\x62\xf7\xf7\x36\x16\x5c\xe4\xfb\xd8\xe1\x07\x81\x67\xce\xe6\x0f\x3a\x02\xe5\xf9\x1c\x4e\xfd\xf9\xec\x4b\xde\x1f\xb6\xb8\xe9\xce\xed\xf0\x7f\xa1\x16\x01\xca\x7d\x58\xae\x24\x3e\x2c\xb1\xb0\x48\xbd\x58\xe1\xe4\xa3\x97\xab\x4f\x06\xb8\x83\xd0\xfb\xf7\xbe\x62\x5e\xad\xa3\xb9\x03\x5f\x40\x90\x4b\x1b\xc0\xba\x36\x56\x17\x4a\xde\xb9\x6e\x51\x12\x3b\x95\x36\x94\x3f\xf7\xd9\x8d\xe0\xe5\xd9\x60\xb7\xdd\x45\xf1\xa4\x2b\x07\x6b\x25\x6d\x75\xa5\x4e\x64\xdf\x1a\x83\x97\xe7\x5f\xda\x4d\x90\x1f\x68\x82\x87\x2a\xd9\xe3\x9b\x52\xb2\x9f\x56\xc8\x74\x70\xa0\xa1\xee\x9e\xad\xaa\x9c\x66\xd2\x83\xf8\xc3\xba\x02\x27\xc2\x82\x8b\x8b\xbd\xd2\x4a\xfc\x0f\x22\x19\xb6\x61\x6a\x37\xc7\x63\xdd\xb1\xa5\x24\xb6\xab\x23\x96\xa8\x88\x6d\x69\xe8\x69\x32\xda\xc5\x3e\xbb\xb1\x7a\x55\xd8\xf5\x82\xb4\x91\xfe\x87\xa2\x6c\xd7\xa5\xb3\xa3\xb1\x00\xed\x3e\xa5\x39\x6c\x39\xd4\xf5\xae\xe0\x5e\x27\x5a\x7b\x96\xdc\x90\xce\x70\x1c\x34\xb7\xb9\x26\xea\xba\xa5\x3e\x27\xc0\x90\x60\x93\x57\xfe\x89\x08\x4e\x37\xf1\xb6\xa5\xd9\xba\x71\xe0\x02\x24\xde\xf7\xc3\x5c\x54\x59\xe3\xb7\x33\xfc\xde\xd6\x28\x70\xf6\x23\xf2\x66\xdf\x15\x77\xa7\x69\x32\x3b\xd5\x69\x0f\x77\x94\x14\x91\x96\x5c\x74\xfd\xe3\xb0\xb9\x44\x8f\xbf\x26\x23\x27\x9c\x07\xcf\x76\x1e\x3a\xc5\x4d\xa1\x96\x98\x4f\xe9\x03\x8c\xd7\x26\x96\x9a\x82\x18\x36\x46\x8d\x36\x35\x5f\x63\x91\xee\xf4\x8b\xbd\x8c\xf2\x84\xc3\x01\x93\xa8\xfe\xb0\x6f\xc7\x1a\xf7\x06\x55\x26\x38\x45\xf9\xf9\x6a\xfc\x7e\xf3\xd7\x55\xc0\xe0\x09\x6c\xdd\x79\xa3\xa4\x8c\x7d\xee\xe5\xd0\xa2\x48\xc3\xd4\x24\x9e\xbf\x76\xdb\x84\x75\xd7\xb2\xe4\x02\x4e\x4f\x7d\x93\x1a\x06\x72\xc3\x6f\x70\x16\x52\xe0\xcc\xbd\x1c\x5c\xf2\xff\x18\x25\xf3\x5b\x59\x12\x6d\xe6\x44\xc4\x95\x23\x38\x0d\x3c\xb5\x6b\x8a\x46\xb0\x06\xaf\xfd\xc6\xe8\xfe\xc8\x65\x17\x1d\xee\x3b\xc2\x39\x9c\xdc\x65\x23\xe7\x67\x7d\xd9\x45\xac\x37\x5d\xc1\x57\x54\xae\x84\xf0\x70\x84\xa2\xae\xe1\x1c\x3f\xa7\x0c\x6b\x27\x3f\xbf\x08\x91\x2e\x73\x62\x3e\x68\x64\xfc\x21\x09\x9e\x99\x6f\x22\x6b\x44\x75\xa4\xb9\x6c\x18\x77\xc5\x85\x20\x5f\x05\x26\x6d\x73\x6f\x45\x8e\xb4\x9b\xe1\xe1\x2d\x6d\x82\x06\x29\x64\x3e\x9d\xac\xd5\x09\xd2\x36\xfd\xe3\xde\x0e\xbc\xb2\x0e\x90\xb7\x41\xe4\x50\xd4\xc0\xd5\xed\x0e\xd5\x50\x29\x8c\xd3\x87\xfe\xf1\x1e\x55\x12\xf9\xd8\xfc\xf2\x6e\x76\x4c\x86\xf0\x86\x52\x6e\xb9\x92\x0d\x99\xc3\x6f\x96\x7b\xda\xcf\x50\xa2\x26\x8e\x2f\xa5\xa2\x28\xfc\xfc\x5c\x09\xea\xba\xb6\xb3\xb7\xfe\xc0\xfc\x5f\xf7\x81\x14\xfc\xf6\xd0\x25\xcd\xa6\x4d\xb6\x7e\xa6\xf6\xbc\x5c\x0e\x3e\x1c\xda\x77\xca\xfa\x46\x49\x18\x35\xdc\xfc\x33\xa5\xbc\xd9\x82\x2e\x7e\xfd\x1b\x00\x00\xff\xff\xf9\x90\x6c\x5a\xee\x10\x00\x00") +var _templateDialectSqlDecodeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x5b\x6f\x1b\x37\x13\x7d\x96\x7e\xc5\x64\x21\x1b\x92\x20\xad\x9c\xe0\xc3\x07\xd4\xa9\x0b\x04\x71\x02\xa8\x2d\xdc\xc0\x8e\xf3\x12\x04\x05\xb3\x1c\x4a\xac\xb8\xa4\x42\x52\xbe\x60\xb1\xff\xbd\xe0\x65\x25\xae\x6e\xb1\x1b\xe4\x6d\xb9\x43\xce\x0c\xcf\x9c\x33\x24\xab\x6a\x32\xec\xbe\x55\xcb\x47\xcd\x67\x73\x0b\xaf\xce\x5e\xfe\x32\x5e\x6a\x34\x28\x2d\xbc\x27\x05\x7e\x55\x6a\x01\x53\x59\xe4\xf0\x46\x08\xf0\x93\x0c\x38\xbb\xbe\x43\x9a\x77\x3f\xce\xb9\x01\xa3\x56\xba\x40\x28\x14\x45\xe0\x06\x04\x2f\x50\x1a\xa4\xb0\x92\x14\x35\xd8\x39\xc2\x9b\x25\x29\xe6\x08\xaf\xf2\xb3\xc6\x0a\x4c\xad\x24\xed\x72\xe9\xed\x7f\x4e\xdf\xbe\xbb\xba\x79\x07\x8c\x0b\x84\xf8\x4f\x2b\x65\x81\x72\x8d\x85\x55\xfa\x11\x14\x03\x9b\x04\xb3\x1a\x31\xef\x0e\x27\x75\xdd\xed\x56\x15\x50\x64\x5c\x22\x64\x94\x13\x81\x85\x9d\x98\x6f\x62\x42\xd1\x65\x34\x51\x12\x33\xa8\x6b\x37\xab\xa7\xb1\x40\x7e\x87\x1a\xce\x2f\xa0\x97\x5f\x37\x23\xe7\x64\x32\x01\x53\x10\xf9\x89\x88\x15\xba\x1d\xda\x95\x96\xc6\x27\x62\x1f\x97\x68\x80\x29\xed\x27\x48\x2e\x67\x70\x17\x66\x31\xad\x4a\x30\xdf\x44\x7e\xad\xee\x4d\xde\x65\x2b\x59\x40\x7f\xe8\x02\xe5\x57\xa4\x44\xa8\xeb\x41\xe2\xb4\x3f\x80\xcf\x5f\xb8\xb4\xa8\x19\x29\xb0\xaa\xa1\xea\x76\x42\x9c\xdd\xff\x9d\xd3\xaa\x02\xce\x40\x2a\x0b\xbd\x7c\x7a\x99\xdf\x1a\xd4\x97\x7e\x93\x14\xea\xda\xc5\xbc\x5a\x09\x31\x95\xf6\xff\xff\xab\x2a\x40\x61\x5c\x34\x1f\x79\x7a\xe9\x4d\x1f\x1f\x97\xf1\x17\x4a\xb7\xa4\xaa\x47\x30\x99\xc0\x7a\x4a\xc8\xaf\xdb\xe9\x54\xd5\x18\x34\x91\x33\x84\xde\xdf\x23\xe8\xb1\x80\xcd\x7b\x8e\x82\x9a\x30\xc3\x27\xd3\x63\x2d\xb7\x1b\x6f\x6c\xcb\x57\x08\xd7\xed\xd4\x5d\x5f\x9a\x31\xdc\x73\x3b\x77\x1e\x95\x46\x3e\x93\x7f\xe0\x63\x70\x3b\x99\x00\x5b\x3c\x0d\x6e\x16\x96\x8e\x17\x6e\xed\x7e\xec\x3b\x7b\xc1\x6f\x02\xec\x83\xfe\x30\xf6\x29\x24\x6c\xe1\xf0\xc8\x23\x10\xde\x12\x21\x62\x8b\x00\x52\x63\x4a\x2b\xc6\x9e\x5e\x2f\xf6\xbd\x6a\xa5\xf8\xb6\x00\xee\x78\x90\x93\x3f\x8e\xc3\xc4\x18\x3e\x6b\x58\x1c\x06\x01\xd6\x08\x9b\x9d\x13\x0b\xf7\xa8\x31\x62\x8e\xb4\x8d\x24\xf4\x09\xb3\xb8\xc1\x7e\xe0\x9c\x5a\xe5\x5d\xa4\xd8\x02\xf3\x04\x69\x48\xdf\x12\x57\x5d\xc3\x56\x1d\xd2\xac\xfa\x31\x93\x3c\xcf\x13\xe0\x07\x80\x5a\x2b\xed\xf1\xe7\x0c\xca\x11\x48\x87\xb2\x40\x19\xe7\x0f\x46\x7e\xe0\xfd\x7e\x20\xc5\x82\xcc\x9c\xeb\xfc\xad\x12\xab\x52\x9a\xc1\x6b\x28\xe1\x57\x90\xa1\x7e\xb1\xb2\xac\xb4\xf9\x3b\xe7\x95\xf5\xb3\x92\x9b\x92\xd8\x62\x0e\x72\x55\x7e\x45\xed\xda\x89\xdb\x62\x84\xe5\x1c\x4e\x28\xbc\xb8\x80\x13\x9a\x8d\x7c\xec\x41\x80\xd7\xe3\xcd\x19\x10\x49\x77\x65\xd8\x57\x3a\xfc\x9c\x9a\x1b\xab\x1d\x4f\xe3\xe8\xf6\x76\x7a\x39\x48\x0a\xe6\x05\x80\x0f\xd6\x95\xa9\x07\xd9\x94\x3e\x64\x70\x06\x99\x67\x4f\xe6\x17\x41\x76\x8d\x45\xd6\x82\x30\xd2\x0d\x2c\x96\x4b\x41\xec\xfe\xde\xc6\x82\x8b\x7c\x1f\x3b\xfc\x20\xf0\xcc\xd9\xfc\x46\x47\xa0\x3c\x9f\xc3\xae\x3f\x9f\x7d\xc9\xfb\xc3\x16\x37\xdd\xbe\x1d\xfe\x2f\xd4\x22\x40\xb9\x0f\xcb\x95\xc4\x87\x25\x16\x16\xa9\x17\x2b\x9c\x7c\xf4\x72\xf5\xc9\x00\x77\x10\x7a\xff\xde\x57\xcc\xab\xb5\x35\xb7\xe1\x0b\x08\x72\x69\x03\x58\xd7\xc6\xea\x42\xc9\x3b\xd7\x2d\x4a\x62\xa7\xd2\x86\xf2\xe7\x3e\xbb\x11\xbc\x3c\x1b\xec\xb6\xbb\x28\x9e\x74\xe6\x60\xad\xa4\xad\xae\xd4\x89\xec\x5b\x63\xf0\xf2\xfc\x4b\xbb\x09\xf2\x03\x4d\xf0\x50\x25\x7b\x7c\x53\x4a\xf6\xd3\x0a\x99\x0e\x0e\x34\xd4\xdd\xbd\x55\x95\xd3\x4c\xba\x11\xbf\x59\x57\xe0\x44\x58\x70\x71\xb1\x57\x5a\x89\xff\x41\x24\xc3\x36\x4c\xed\xe6\x78\xac\x3b\xb6\x94\xc4\x76\x75\xc4\x12\x15\xb1\x2d\x0d\x3d\x4d\x46\xbb\xd8\x67\x37\x56\xaf\x0a\xbb\x9e\x90\x36\xd2\xff\x50\x94\xed\xba\x74\x76\x34\x16\xa0\xdd\xa7\x34\x87\x2d\x87\xba\xde\x15\xdc\xeb\x44\x6b\xcf\x92\x1b\xd2\x19\x8e\x83\xe6\x36\xc7\x44\x5d\xb7\xd4\xe7\x04\x18\x12\x6c\xf2\xca\x3f\x11\xc1\xe9\x26\xde\xb6\x34\x5b\x27\x0e\x5c\x80\xc4\xfb\x7e\xf8\x17\x55\xd6\xf8\xed\x0c\xbf\xb7\x34\x0a\x9c\xfd\x88\xbc\xd9\x77\xc5\xdd\x69\x9a\xcc\x4e\x75\xda\xc3\x1d\x25\x45\xa4\x25\x17\x5d\x7f\x39\x6c\x0e\xd1\xe3\xb7\xc9\xc8\x09\xe7\xc1\xb3\x9d\x87\x4e\x71\x53\xa8\x25\xe6\x53\xfa\x00\xe3\xb5\x89\xa5\xa6\x20\x86\x8d\x51\xa3\x4d\xcd\xd7\x58\xa4\x2b\xfd\x64\x2f\xa3\x3c\xe1\x70\xc0\x24\xaa\x3f\xac\xdb\xb1\xc6\xb5\x41\x95\x09\x4e\x51\x7e\xbe\x1a\xbf\xdf\xfc\x75\x15\x30\x78\x02\x5b\x77\xee\x28\x29\x63\x9f\x7b\x38\xb4\x28\xd2\x30\x35\x89\xe7\x8f\xdd\x36\x61\xdd\xb1\x2c\xb9\x80\xd3\x53\xdf\xa4\x86\x81\xdc\xf0\x1b\x9c\x85\x14\x38\x73\x37\x07\x97\xfc\x3f\x46\xc9\xfc\x56\x96\x44\x9b\x39\x11\x71\xe6\x08\x4e\x03\x4f\xed\x9a\xa2\x11\xac\xc1\x6b\xbf\x30\xba\x3f\x72\xd8\x45\x87\xfb\xb6\x70\x0e\x27\x77\xd9\xc8\xf9\x59\x1f\x76\x11\xeb\x4d\x57\xf0\x15\x95\x2b\x21\x3c\x1c\xa1\xa8\x6b\x38\xc7\xcf\x29\xc3\xda\xc9\xcf\x2f\x42\xa4\xcb\x9c\x98\x0f\x1a\x19\x7f\x48\x82\x67\xe6\x9b\xc8\x1a\x51\x1d\x69\x2e\x1b\xc6\x5d\x71\x21\xc8\x57\x81\x49\xdb\xdc\x5b\x91\x23\xed\x66\x78\x78\x49\x9b\xa0\x41\x0a\x99\x4f\x27\x6b\x75\x82\xb4\x4d\xff\xb8\xb7\x03\xb7\xac\x03\xe4\x6d\x10\x39\x12\x75\xf3\x74\x48\xe0\x1a\xae\x15\xec\xdd\x6d\xb7\xb0\x86\x6b\x61\x9c\xbe\x04\x8e\x37\xb1\x92\xc8\xc7\xe6\x4d\xbc\x59\x31\x19\xc2\x1b\x4a\xb9\xe5\x4a\x36\x6c\x0f\xef\x30\x77\xf7\x9f\xa1\x44\x4d\x1c\xa1\x4a\x45\x51\xf8\xff\x73\x25\xa8\x6b\xeb\xce\xde\x7a\xa2\xf9\x67\xf9\x81\x14\xfc\xf2\xd0\x46\xcd\xa6\x8f\xb6\x5e\x5b\x7b\xae\x36\x07\x6f\x16\xed\x43\x67\x7d\xe4\xec\xc5\xb0\x45\xac\x2d\xe8\xe2\xd7\xbf\x01\x00\x00\xff\xff\x48\xe4\x16\xe4\x0f\x11\x00\x00") func templateDialectSqlDecodeTmplBytes() ([]byte, error) { return bindataRead( @@ -615,7 +615,7 @@ func templateDialectSqlDecodeTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 4334, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 4367, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -760,7 +760,7 @@ func templateDialectSqlPredicateTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3a\x6b\x6f\xdb\x48\x92\x9f\xa9\x5f\x51\x23\xf8\x06\xa2\x21\xd3\x76\xee\x70\xc0\x29\xf0\x01\xde\x38\x06\x84\xcc\x64\xb2\xe3\xcc\xcc\x07\x43\x98\xa1\xc9\xa2\xdc\x10\xd5\x54\xc8\x96\xe3\x40\xe1\x7f\x5f\x54\xf5\x83\xcd\x87\x64\x27\xf3\xd8\x5d\x60\x3f\x24\x96\xba\xab\xab\xaa\xeb\x5d\xd5\xda\xed\x4e\x8f\x47\xaf\x8a\xcd\xa7\x52\x2c\xef\x15\xbc\x38\x3b\xff\xbf\x93\x4d\x89\x15\x4a\x05\xd7\x71\x82\x77\x45\xb1\x82\xb9\x4c\x22\xb8\xcc\x73\x60\xa0\x0a\x68\xbf\x7c\xc0\x34\x1a\xbd\xbf\x17\x15\x54\xc5\xb6\x4c\x10\x92\x22\x45\x10\x15\xe4\x22\x41\x59\x61\x0a\x5b\x99\x62\x09\xea\x1e\xe1\x72\x13\x27\xf7\x08\x2f\xa2\x33\xbb\x0b\x59\xb1\x95\xe9\x48\x48\xde\xff\x6e\xfe\xea\xf5\xdb\x9b\xd7\x90\x89\x1c\xc1\xac\x95\x45\xa1\x20\x15\x25\x26\xaa\x28\x3f\x41\x91\x81\xf2\x88\xa9\x12\x31\x1a\x1d\x9f\xd6\xf5\x68\x44\x77\x80\xcb\x34\x15\x4a\x14\x32\xce\x21\x13\x98\xa7\x15\x64\x85\x26\x7e\xb7\x15\x79\x8a\x65\x04\x0c\xbd\xdb\x41\x8a\x99\x90\x08\xe3\x54\xc4\x39\x26\xea\xb4\xfa\x90\x9f\x7e\xd8\x62\xf9\xe9\x54\x9f\x1c\x43\x5d\x8f\x82\xdd\xee\x04\x3e\x0a\x75\x0f\x47\xd1\x75\x51\xa2\x58\xca\x37\xf8\xa9\xe2\xad\x80\xd6\xaf\xdf\x54\x70\x57\x14\xb9\x86\x44\x99\x02\x63\x77\x1f\x0f\x52\x1a\x6b\x60\x38\xda\xac\x96\x30\xbb\x80\xa3\xe8\x26\x29\x36\x18\xbd\x8b\x93\x55\xbc\x44\xbb\x6b\x58\x27\x88\x4d\x5c\x25\x71\xee\x00\xff\x66\x76\x0c\x60\x89\x09\x8a\x07\x0d\xe9\x3e\xbb\xe3\xc4\x4d\xb6\x95\x09\x4c\x5a\xb0\x75\x0d\xc7\x3e\x95\xba\x0e\xa1\xfa\x90\x5f\xe6\xf9\x24\x51\x8f\x90\x14\x52\xe1\xa3\x8a\x5e\xe9\xbf\x21\x4c\x6e\x17\x0c\x1f\xbd\x8d\xd7\xc4\xe2\x14\xb0\x2c\x8b\x32\x84\xdd\x28\x78\x88\x4b\x98\x8c\x82\x40\x16\x29\x56\x70\x01\x1d\xd0\x1d\x49\xed\x90\x44\x9d\x48\x2f\xa0\xc3\x63\x64\x76\x0c\x02\x23\xdd\x20\xf8\xb5\xda\x60\x32\x00\xce\xf2\xbd\xd9\x60\x32\x09\xdb\x34\x5f\xa7\x4b\xb4\xd4\xf2\x22\x4e\x31\x7d\xff\x69\xa3\x99\xdd\xed\x20\x47\x09\x11\xd4\xf5\x82\x74\xba\x23\x18\x3e\x5b\xc6\x72\x89\x70\x84\x24\xd8\xc8\x1c\xa6\x9d\x3e\x8b\xbb\x9d\xd3\x11\xda\x6b\xc3\x37\x17\x20\x45\x3e\x75\xe8\x1c\xf7\x41\xdd\xb9\x4f\x78\xd8\xe2\x5a\x9b\x6f\xfc\xab\x04\x22\x23\x19\x18\x46\xc5\xd4\x63\x76\xb7\x03\x91\xc1\x52\xc1\x91\x80\x33\x62\xe7\xf3\x67\x02\xd5\x24\xbf\xf0\x0e\xee\x1c\x68\xe1\x78\x0a\x53\xe5\x16\x79\xcd\x31\xda\x5c\x53\x64\x60\x01\xf5\x39\x56\x5b\xf4\xb6\x48\x31\x7a\x55\xe4\xdb\xb5\x24\x0c\xf1\x66\x83\x32\x9d\xf4\xf7\xa6\xac\x5e\xcf\x2d\x7c\xc9\x44\x51\x14\x1a\x51\xfa\x44\x35\x96\x9b\x24\x96\x3f\xc7\xf9\x96\x15\x4c\xc6\x3f\x09\xe1\x76\x21\xa4\xc2\x32\x8b\x13\xdc\xe9\x7b\x90\xb9\x92\xb4\xbe\x6d\x19\x6b\x52\xc8\x4c\x2c\x67\x3d\xd3\xd2\xeb\xb5\x67\xe6\x86\x71\xfe\x3a\x05\xfa\x43\x1c\x3d\x68\xba\xb3\x0b\x5e\x89\x2a\xc7\x4a\xd7\x24\xfb\x6a\xee\xc9\xeb\xc1\xde\xc1\x90\xd2\xdf\x35\xad\x28\x5b\x59\xbc\x9e\x2c\xda\x1a\x28\x51\x6d\x4b\x09\xfa\xd8\x28\x70\xf2\xb9\xac\x2a\xb1\x94\x56\x36\x86\x4a\x14\x45\x9e\x84\x42\xed\xdf\xcc\x88\xc8\xc8\x43\xf4\x45\x43\xb8\xb8\x80\x33\xcd\x9f\x41\x9f\xad\x55\xf4\x9a\x80\xb3\xc9\xd8\x86\xb5\xba\x9e\x81\xa1\x92\xc4\x79\x8e\x29\xdf\xac\xd8\x2a\xfe\x2a\xe4\x12\x1a\x1d\x8d\x89\xf9\xda\x53\x08\x13\xba\x6d\x48\x9e\x9c\x2f\xf6\x7b\x33\xcb\x82\x17\xa2\xb6\x63\x7b\xdf\xf6\xc8\x85\x8f\xc6\xcc\xa5\x11\xa5\x16\x85\x96\x67\x3d\xa2\x8b\x63\xc9\x71\xb5\xfa\x90\x2f\xcb\x78\x73\x1f\xfd\x9d\x22\x0c\x59\x69\x45\x71\x72\xda\x33\x93\xb4\xa4\x4f\x53\x60\x41\x87\x2f\xf9\xbc\x76\x22\x96\x99\xa5\x2c\x72\x0e\xa0\x96\xca\x90\x78\x3d\x26\x49\xe5\x22\x1f\x59\x63\xf7\xe3\x52\x4b\x18\x4e\x44\xf8\xa8\xe8\xb2\x47\x30\xfe\x11\x93\xb1\xc7\xe1\x98\xa0\xc7\x74\xd6\x46\x16\x50\xb8\xde\xe4\xb1\x1a\xcc\x89\x18\x2f\xb1\x24\x41\x0a\xb9\x1c\xdb\x18\xe8\x8b\xd2\xff\xdc\x67\xf8\x8b\x52\xcf\xab\x62\x2b\xd5\x9e\xe4\x23\xa4\xf2\x13\x8e\x0e\xff\xb3\x27\xe2\xbf\xe1\xc7\xa9\x8e\x09\x3c\x5b\x75\x5f\xc6\xfc\xeb\x47\x51\xed\x63\x9e\x92\x8a\xcf\xbd\x9c\x5a\xab\xea\x72\xe0\x4b\x21\x74\xe6\xd7\x37\x9f\x2c\xce\x2b\x9c\xee\x75\xbc\xe4\x1e\x93\x15\x20\xb1\x84\x32\xc1\x19\xfc\xd7\xc3\x98\x69\x6a\xab\xb6\x7a\x82\xff\x87\xb3\x2f\xd5\x93\x27\x60\x38\x6e\x3b\x05\xad\xb6\x94\xf3\x6d\x7f\x9f\xee\x40\x1a\x98\x79\x9b\xf4\xdd\xee\x05\xef\xe3\xbb\x1c\x67\xbd\xc0\xcf\xcb\x9c\x49\x4d\x6e\xe8\x83\xd8\xa4\x41\x40\xf3\x2b\x9f\xc0\x35\x15\x76\x8e\x42\x40\x11\x61\xa6\xeb\xc4\x88\x91\xcc\xaf\x22\x5a\x23\x8d\x55\xca\x96\x37\x0c\xaa\x71\xf6\x69\xd9\x63\x7c\x22\x96\xca\x1e\xe0\xff\xf9\xbf\xeb\xb2\x58\xf7\x73\x48\xf5\x81\xcb\x81\x9f\xa4\xf8\xb0\xc5\x19\xe7\xce\xa9\x0d\x01\x9b\x6a\xc8\x22\x36\x25\xa6\x22\x89\x15\x56\x2f\x39\x48\x6c\xaa\x90\xd4\xc6\xc6\xa0\x63\xf9\x3b\x0b\x61\xc3\x79\x85\x39\x97\xcd\xac\x9f\xe8\xc6\x7c\x0b\x75\xc8\xa6\xba\x58\x70\xa1\xc8\x31\x64\x63\x33\xcd\xa6\xba\x15\x0b\x77\xd4\x65\x93\xda\x05\x28\xb1\x16\x6a\x88\x41\xde\x78\x69\xf6\x3d\x4b\xd5\xcc\x7d\xc7\xcb\x17\x70\xcc\xfb\x16\x59\x91\x65\x15\x0e\x62\xd3\x3b\x2f\x2d\x44\x0f\xdf\x0f\x7a\xfd\x02\x8e\x35\xc4\x61\xe1\x15\x65\x8a\xe5\x3e\xb9\xfd\x40\x9b\x7f\x9e\xcc\x8c\x93\x31\xad\x2f\x0b\x25\xec\x2c\xc6\xbd\x1c\x2b\x44\xd2\x6b\x08\x68\xeb\x4a\x47\xeb\x2e\x4e\x13\xc6\xdc\x76\x18\x8e\x02\x75\x4e\x87\x6c\x2f\xc4\xce\x34\x19\x74\xb1\x70\x14\x38\x51\x78\x27\x34\x17\x13\x75\x6e\xbd\xac\x77\xda\xac\x53\xe6\xe4\x7f\x64\xff\x13\x75\xae\x83\xd8\x80\x1b\xf8\xaa\x75\x14\x07\x03\xa2\x07\x60\xf9\x70\xdf\x9f\xc9\x0d\x2b\x84\xb4\xf8\xeb\x14\x36\x8d\x22\xf7\xfb\x1a\xb3\xb5\xf1\x55\xfb\x2c\x04\x6c\x6f\x83\x67\xbf\xd2\xe8\x4f\x4f\x8d\x63\x89\x0a\xd6\xb1\x4c\x63\xee\x86\x89\x11\x03\x9b\xe4\xf1\xb6\xc2\x08\x7e\x41\xa8\x54\x5c\x2a\x7d\x86\x4b\x80\x14\xb3\x78\x9b\x2b\x5d\xfc\x4d\x21\x96\x29\x14\x0f\x58\x96\x82\x1a\x75\x05\x77\x98\x17\x1f\xa9\x43\x90\x88\x29\x75\xf3\x9e\x98\xb5\x97\x4d\x8c\x8f\x85\xda\x8b\x27\xeb\x58\xdd\x47\xdf\xc7\x8f\x73\xa9\xfe\xfb\x45\xf8\xd5\x81\xc1\x51\xd1\x58\x75\x64\x68\x25\x26\x0b\x31\xe2\xf6\xb6\xe9\xa8\x4f\x8f\x75\xfa\x39\xdd\xc4\xfa\x7e\x42\x62\xc5\x5d\x3e\x2f\xc3\x12\x25\x96\xb1\x12\x85\x64\x11\x31\x54\x91\x41\x0c\x4b\xf1\x80\x12\x30\x5d\xe2\x73\xe6\x00\x74\xae\x99\x02\x1c\x49\xae\xb2\xb8\xf7\x21\x0e\x88\x1c\xd7\xa9\x1f\x8d\xc8\x3d\x06\xb2\xb2\x58\x1b\x0a\xfa\x2c\xfa\xed\x3d\x55\x5e\x2d\x34\xc4\x10\xa1\x21\x0d\x80\x2a\x98\xff\x65\x49\x91\x9c\x76\x99\x7d\x55\xb4\xf0\xf9\x9d\xbe\x45\xfb\x63\x23\xf3\x51\x50\x29\xdc\xb4\xca\xd5\xb7\xf8\xf1\x46\xe1\x86\xba\xf3\x26\x1f\x92\x6f\x92\xba\x64\x3f\xc5\x42\x6f\x5d\x2f\x74\x92\xdd\x90\xa3\x9a\xb8\x15\x4e\x7d\x5a\xef\x0b\xa6\x84\x3a\xc3\x0e\x93\xeb\x6f\x7a\xab\x6d\xc2\x6d\xe4\x24\xd1\x89\xfb\xa6\x0f\xfd\x88\x39\x1f\x74\x5c\x62\x34\xaf\xe6\xf2\x01\xcb\xaa\x59\xeb\x5d\x10\x35\x3f\xdd\x7c\x4e\x42\x17\x19\x6d\x7f\xff\xe2\x7b\x38\x31\x3d\xf7\x1e\x0c\xef\xde\x78\xc7\xa3\x28\x72\xfd\x70\x5e\xe1\x53\x67\x75\xc0\xf2\xce\xfb\xcd\xb4\x3e\x4b\x57\x0f\x47\x01\x5b\x1a\x47\x50\x4f\xcb\x37\xa8\xde\xa2\x58\xde\xdf\x15\x65\xf5\x64\x3e\x98\x02\x59\x49\xb8\xc7\xb7\xc8\x86\x9f\xf6\xad\x58\xbb\x93\x67\xf7\xce\xcd\xb8\xa9\x7a\xce\xb8\xad\x2c\xd6\xff\x8e\x6e\xc6\xda\x10\xe9\x50\xc8\xd3\x23\x17\x8a\xb4\x5c\x1d\xce\xab\x1b\x55\x52\xab\x3b\x91\x85\xd2\x4b\x3f\x55\x58\x5e\xb1\x48\xd2\x10\xea\x5a\xa4\x93\x90\xd4\x90\xb3\x6d\xce\xaf\x1a\x95\xfc\x75\x9e\x2c\xd2\xff\x78\xec\x5f\xef\xb1\xbf\xd3\x5d\x0f\xf8\x55\xbb\x65\x3f\xe8\x23\x87\xcd\x9d\x01\x44\x66\x9c\x6e\xc0\xdc\xf7\x0d\x0d\x5f\x9a\x23\x5e\xd2\x6f\xab\x45\x0b\x2b\x5b\x71\xd1\xbe\x8e\x57\x38\xb9\x5d\x98\x6b\xff\xac\xab\x95\xb3\xa9\x37\x12\xe1\xca\x5a\xa4\x0d\xf4\x3a\xde\xdc\xfa\x9d\x1b\xd4\x75\x77\x38\xdd\x39\x6d\x6a\x37\x3b\x60\xd2\xe5\x9b\x9e\xe3\xe9\x5a\x5e\xa4\xd5\x2d\x47\xae\xf9\xd5\x02\xf4\x04\x8a\xd7\x89\x49\x37\x7e\xcb\x56\x76\xf6\x36\xbf\x72\xe5\xbe\x9b\x7e\x07\x01\x45\x1a\xe2\xf3\x76\xd1\x76\x07\xc3\xa3\x83\x21\x94\xad\x8b\xf4\x40\x17\x9d\x11\x3a\x53\xe3\xff\x06\xba\x6b\xd2\x66\xab\xc3\x0e\x02\x5a\x9a\x75\x40\x9a\xdd\xc0\x78\xd7\x6c\xc8\xdd\x34\xc4\x9e\x3e\xfc\x80\xe7\x1d\x68\xcd\x07\xbc\x4d\x1f\x31\x7f\x5c\x0b\x3b\x33\xdd\xd8\x60\x1b\x16\x04\x55\xf4\xcb\x3d\x96\x1c\x40\xa2\xb9\x1d\xd9\x3d\x83\xd8\xad\x0e\xcc\x9d\x9b\x9e\x37\x91\xf7\xcc\x39\xd7\x62\x0a\xd9\x8a\x1b\x87\xd0\xe7\x90\x90\x16\x5b\xae\x73\xc7\x44\xfd\xed\x36\xcf\xe7\x52\xfd\xef\xff\x8c\xdd\xa4\xbd\x1b\xdf\xcd\x94\x9d\x4e\x5d\xe8\x4d\x3a\x64\xf4\xeb\x05\x7a\x83\x5d\xc8\x83\xc8\x1b\x0b\xe9\x93\x10\x92\x28\x34\x10\x7b\xe9\x34\x23\xd7\x99\x9b\x8a\xbf\xf0\xc7\xe2\x46\xce\xa6\x0e\xef\xec\x7d\x6b\xaf\x53\xd7\xbb\x7a\xaa\xa7\xe6\x42\xf2\xb7\xda\x97\x95\x1e\xfb\x1a\x0a\xc5\x56\x4d\x41\x48\xd8\x33\x59\x26\x87\x60\x90\x62\x45\xd7\x2f\xb6\x2a\x9a\x1c\x37\x74\xb4\x0e\x28\x08\x7d\x53\xac\xe0\xf3\x67\x40\x16\x67\x13\x57\x82\xe1\x29\xf4\x56\xe2\xe3\x06\x13\x85\x29\x88\x54\x77\x40\x5c\xb6\x90\xf3\x9d\x14\x5b\x35\x36\x88\xcd\x8b\x0e\x0a\x69\x39\x10\xd2\x30\xc0\x37\xeb\xd3\x27\x59\xff\x3e\xf2\x42\x76\xa8\x17\x5b\xc5\x4a\x31\x21\xb6\x33\xbf\xbd\x2c\x97\x63\x18\xd3\xbd\xc7\x30\xe6\x49\xd6\x98\xad\x09\xc6\x56\xcd\x63\xa7\x95\xe7\xcf\x72\x4f\xd7\x2f\xd6\x7a\xf0\x3d\xb6\x8f\x45\x9e\x9d\x04\x42\x3e\xcd\x91\x90\x1e\x43\xce\xf8\x5a\x6c\x69\xeb\xf8\xc3\xb8\xa2\xc8\xeb\xf4\x94\x56\xb7\x56\x70\x8b\x96\x96\x9e\xa7\x17\xce\x04\x22\x25\xd3\xe4\x88\x6c\x66\xa4\x16\x65\xc7\x3e\x4c\x5c\x77\x89\xc0\x2c\x90\x65\xfb\xe0\x8c\xe9\xd6\xac\x2d\xda\xe0\xcd\x7a\xf3\x54\x14\xf8\xef\x01\x9e\x0b\xd9\xc7\xa0\xc1\xb7\x07\x1e\xf7\x7f\xd5\xdb\x43\xfb\xf5\xc1\x13\xcc\x6f\x3a\x5f\xeb\xd4\x34\xd6\x01\xd4\x24\x9e\x31\x09\xe6\x37\x3b\x3c\x36\xac\xe9\x8a\x46\xc7\xe2\xe1\x72\x70\x7e\x35\x97\x56\x4a\x2e\x98\x4a\x5b\xf3\xb8\xf9\xb7\x46\x64\xde\x9c\x43\xef\xd6\x7b\xb9\xe6\x37\x13\xc3\x86\x4d\xea\x5e\x46\xb7\x14\xcc\x49\xf3\x14\xa1\x4d\x46\x6b\x81\x0a\xe0\xc5\xa8\x6f\x2f\xfb\x44\xe3\xd9\x4c\x47\x32\xda\x86\xf4\x39\x4c\xb5\x98\xa4\xad\x0c\x8c\xe9\x74\x46\x87\x7e\xc5\xa1\x99\xbb\x15\x0b\xf3\x78\xa5\x91\xdf\xa8\x72\x9b\x28\x76\x2b\x6a\x62\xda\x8f\x8c\x87\x81\xa7\x20\x3d\xd2\xee\xa1\x86\x32\x9c\xce\x20\x3f\x7c\x94\xd7\x6f\xec\x53\x63\xea\x17\x5f\x83\x35\xc8\x50\x15\x46\x1f\x87\x2a\xb1\xe7\x15\x30\x07\xa4\x21\x32\xc8\x56\xcd\xdb\x9f\x58\xb4\xaf\xf8\xc6\x5e\xf2\x25\x81\xb5\xac\x23\x68\x79\x26\x7b\xe5\x71\xb6\x0a\x1b\x19\x53\xa8\x38\xce\x56\x8b\xb6\x30\xed\xea\xd4\x51\xec\x08\xef\xb9\x56\xfe\x2f\x64\xe1\xf6\x5e\xbf\xc3\xc6\x33\xfd\x28\x7d\xb2\xc2\x4f\xd6\xde\xbb\x2a\x18\xff\xe9\x36\x2f\xf7\x98\xf1\xd7\xf4\x0d\xfb\x2c\x76\x6f\xef\xf0\x94\xa5\x12\x37\xa7\xc7\xf0\xaa\xa0\x42\x52\x41\xc5\x2d\xfe\x09\x91\x50\xf7\xb1\x82\xb8\x44\xa8\x54\x51\x62\x0a\x71\x45\x65\x8f\xfd\x49\x53\x1a\xab\xf8\x2e\xae\x10\x8e\x4f\xbd\xde\xf2\xc4\x4e\x0c\xf6\xcc\x08\xda\x83\x04\x97\x9f\x53\x67\x60\x95\x2a\x93\x42\x3e\x44\x97\xaa\x10\x4d\x94\xb0\x1a\x19\xb4\xb6\x41\x7b\x73\xc9\xae\xdf\xf1\x88\x34\x74\xdc\x7a\x7a\xd8\xd7\x1c\xb5\x18\x68\xff\x20\xc4\xf9\xa3\x07\x67\xdb\x2d\xfa\xda\xf1\xbd\xfe\xaf\x4c\x7c\x9f\x74\xe3\x7a\x7f\xf8\x60\x94\x38\x39\xd4\x47\x7c\x41\x1b\xd1\xeb\xf2\xdb\xed\x41\xfd\xcf\x72\x7b\x13\x2b\xf7\x04\x49\x2f\xa2\xb6\x8b\xd5\x7d\x01\xe0\x59\x5e\x2f\x2a\x46\x45\xcc\x71\xe6\x1b\x74\x7e\xbf\x46\xf3\xc3\xec\x5f\x13\x8d\x3a\xcc\x1d\x67\xab\x61\x0e\x0f\x87\x1f\xd7\x72\xe9\x77\x5a\xa8\x6b\xd9\xb4\x8a\x5e\x0a\x79\x22\x17\xb7\xaa\xd7\xee\xef\x26\x3a\x4f\x1b\x7f\x4c\x48\x79\xf6\x5c\xc8\x2f\xb4\xdd\x18\x28\x2e\x5b\xbf\x46\xbc\x2c\x97\xcd\x1e\xbf\x96\xfb\xbb\x8d\xa9\xe9\xe9\xed\x36\xcf\x15\x45\x53\x0f\xc4\x6b\x43\x47\xfd\x48\xa7\xdf\xdf\xdb\xb1\x4e\xaf\xb9\x68\xa7\xa3\xa4\x0d\x70\xd7\x45\xb9\x8e\xd5\x5c\xea\x07\xcf\x98\xb9\x8b\xb8\x4d\x9e\xc2\xf9\x99\xf9\x05\x1d\x2b\x89\x08\xdd\xc7\xd5\xbb\x12\x33\xf1\xe8\xf1\x46\xcd\xf5\xd8\x60\x25\x1c\x9a\x9c\x65\x53\xdf\x88\x11\x9f\xb8\x5f\xb6\x34\x83\xc0\x86\xe8\xbe\xdf\x7c\xfe\x23\x00\x00\xff\xff\xaa\xa5\x23\xce\x4e\x2b\x00\x00") +var _templateDialectSqlQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3a\x6d\x6f\xdb\x46\xd2\x9f\xa9\x5f\x31\x15\xfc\x14\xa2\x20\xd3\x76\x9e\xc3\x01\xa7\xc0\x07\xf8\xe2\x18\x10\xd2\xba\xb9\x3a\x6d\x3f\x18\x42\x4b\x93\x43\x79\x21\x6a\xa9\x90\x2b\xc7\x81\xc2\xff\x7e\x98\xd9\x17\x2e\x45\x4a\x76\xd2\x36\x77\x07\xdc\x87\xc4\xd2\xee\xec\xcc\xec\xbc\xcf\xac\xb6\xdb\x93\xf1\xe0\x55\xb1\xfe\x58\x8a\xc5\xbd\x82\x17\xa7\x67\x7f\x3b\x5e\x97\x58\xa1\x54\x70\x15\x27\x78\x57\x14\x4b\x98\xc9\x24\x82\x8b\x3c\x07\x06\xaa\x80\xf6\xcb\x07\x4c\xa3\xc1\xbb\x7b\x51\x41\x55\x6c\xca\x04\x21\x29\x52\x04\x51\x41\x2e\x12\x94\x15\xa6\xb0\x91\x29\x96\xa0\xee\x11\x2e\xd6\x71\x72\x8f\xf0\x22\x3a\xb5\xbb\x90\x15\x1b\x99\x0e\x84\xe4\xfd\xef\x66\xaf\x5e\x5f\xdf\xbc\x86\x4c\xe4\x08\x66\xad\x2c\x0a\x05\xa9\x28\x31\x51\x45\xf9\x11\x8a\x0c\x94\x47\x4c\x95\x88\xd1\x60\x7c\x52\xd7\x83\x01\xdd\x01\x2e\xd2\x54\x28\x51\xc8\x38\x87\x4c\x60\x9e\x56\x90\x15\x9a\xf8\xdd\x46\xe4\x29\x96\x11\x30\xf4\x76\x0b\x29\x66\x42\x22\x0c\x53\x11\xe7\x98\xa8\x93\xea\x7d\x7e\xf2\x7e\x83\xe5\xc7\x13\x7d\x72\x08\x75\x3d\x08\xb6\xdb\x63\xf8\x20\xd4\x3d\x1c\x45\x57\x45\x89\x62\x21\xdf\xe0\xc7\x8a\xb7\x02\x5a\xbf\x7a\x53\xc1\x5d\x51\xe4\x1a\x12\x65\x0a\x8c\xdd\x7d\x3c\x48\x69\xa8\x81\xe1\x68\xbd\x5c\xc0\xf4\x1c\x8e\xa2\x9b\xa4\x58\x63\xf4\x36\x4e\x96\xf1\x02\xed\xae\x61\x9d\x20\xd6\x71\x95\xc4\xb9\x03\xfc\x87\xd9\x31\x80\x25\x26\x28\x1e\x34\xa4\xfb\xec\x8e\x13\x37\xd9\x46\x26\x30\x6a\xc1\xd6\x35\x8c\x7d\x2a\x75\x1d\x42\xf5\x3e\xbf\xc8\xf3\x51\xa2\x1e\x21\x29\xa4\xc2\x47\x15\xbd\xd2\x7f\x43\x18\xdd\xce\x19\x3e\xba\x8e\x57\xc4\xe2\x04\xb0\x2c\x8b\x32\x84\xed\x20\x78\x88\x4b\x18\x0d\x82\x40\x16\x29\x56\x70\x0e\x3b\xa0\x5b\x92\xda\x21\x89\x3a\x91\x9e\xc3\x0e\x8f\x91\xd9\x31\x08\x8c\x74\x83\xe0\xd7\x6a\x8d\x49\x0f\x38\xcb\xf7\x66\x8d\xc9\x28\x6c\xd3\x7c\x9d\x2e\xd0\x52\xcb\x8b\x38\xc5\xf4\xdd\xc7\xb5\x66\x76\xbb\x85\x1c\x25\x44\x50\xd7\x73\xd2\xe9\x96\x60\xf8\x6c\x19\xcb\x05\xc2\x11\x92\x60\x23\x73\x98\x76\xba\x2c\x6e\xb7\x4e\x47\x68\xaf\x0d\xdf\x9c\x83\x14\xf9\xc4\xa1\x73\xdc\x07\xf5\xce\x7d\xc2\xc3\x16\xd7\xda\x7c\xe3\x5f\x25\x10\x19\xc9\xc0\x30\x2a\x26\x1e\xb3\xdb\x2d\x88\x0c\x16\x0a\x8e\x04\x9c\x12\x3b\x9f\x3e\x11\xa8\x26\xf9\x99\x77\x70\xe7\x40\x0b\xc7\x53\x98\x2a\x37\xc8\x6b\x8e\xd1\xe6\x9a\x22\x03\x0b\xa8\xcf\xb1\xda\xa2\xeb\x22\xc5\xe8\x55\x91\x6f\x56\x92\x30\xc4\xeb\x35\xca\x74\xd4\xdd\x9b\xb0\x7a\x3d\xb7\xf0\x25\x13\x45\x51\x68\x44\xe9\x13\xd5\x58\x6e\x92\x58\xfe\x1c\xe7\x1b\x56\x30\x19\xff\x28\x84\xdb\xb9\x90\x0a\xcb\x2c\x4e\x70\xab\xef\x41\xe6\x4a\xd2\xfa\xb6\x65\xac\x49\x21\x33\xb1\x98\x76\x4c\x4b\xaf\xd7\x9e\x99\x1b\xc6\xf9\xeb\x04\xe8\x0f\x71\xf4\xa0\xe9\x4e\xcf\x79\x25\xaa\x1c\x2b\xbb\x26\xd9\x55\x73\x47\x5e\x0f\xf6\x0e\x86\x94\xfe\xae\x69\x45\xd9\xd2\xe2\xf5\x64\xd1\xd6\x40\x89\x6a\x53\x4a\xd0\xc7\x06\x81\x93\xcf\x45\x55\x89\x85\xb4\xb2\x31\x54\xa2\x28\xf2\x24\x14\x6a\xff\x66\x46\x44\x46\x1e\xa2\x2f\x1a\xc2\xf9\x39\x9c\x6a\xfe\x0c\xfa\x6c\xa5\xa2\xd7\x04\x9c\x8d\x86\x36\xac\xd5\xf5\x14\x0c\x95\x24\xce\x73\x4c\xf9\x66\xc5\x46\xf1\x57\x21\x17\xd0\xe8\x68\x48\xcc\xd7\x9e\x42\x98\xd0\x6d\x43\xf2\xf8\x6c\xbe\xdf\x9b\x59\x16\xbc\x10\xb5\x1d\xdb\xfb\xb6\x47\x2e\x7c\x34\x66\x2e\x8d\x28\xb5\x28\xb4\x3c\xeb\x01\x5d\x1c\x4b\x8e\xab\xd5\xfb\x7c\x51\xc6\xeb\xfb\xe8\x9f\x14\x61\xc8\x4a\x2b\x8a\x93\x93\x8e\x99\xa4\x25\x7d\x9a\x00\x0b\x3a\x7c\xc9\xe7\xb5\x13\xb1\xcc\x2c\x65\x91\x73\x00\xb5\x54\xfa\xc4\xeb\x31\x49\x2a\x17\xf9\xc0\x1a\xbb\x1f\x97\x5a\xc2\x70\x22\xc2\x47\x45\x97\x3d\x82\xe1\x8f\x98\x0c\x3d\x0e\x87\x04\x3d\xa4\xb3\x36\xb2\x80\xc2\xd5\x3a\x8f\x55\x6f\x4e\xc4\x78\x81\x25\x09\x52\xc8\xc5\xd0\xc6\x40\x5f\x94\xfe\xe7\x2e\xc3\x9f\x95\x7a\x5e\x15\x1b\xa9\xf6\x24\x1f\x21\x95\x9f\x70\x74\xf8\x9f\x3e\x11\xff\x0d\x3f\x4e\x75\x4c\xe0\xd9\xaa\xfb\x3c\xe6\x5f\x3f\x8a\x6a\x1f\xf3\x94\x54\x7c\xee\xe5\xc4\x5a\xd5\x2e\x07\xbe\x14\x42\x67\x7e\x5d\xf3\xc9\xe2\xbc\xc2\xc9\x5e\xc7\x4b\xee\x31\x59\x02\x12\x4b\x28\x13\x9c\xc2\xff\x3d\x0c\x99\xa6\xb6\x6a\xab\x27\xf8\x3b\x9c\x7e\xae\x9e\x3c\x01\xc3\xb8\xed\x14\xb4\xda\x52\xce\xb7\xdd\x7d\xba\x03\x69\x60\xea\x6d\xd2\x77\xbb\x17\xbc\x8b\xef\x72\x9c\x76\x02\x3f\x2f\x73\x26\x35\xb9\xa1\x0b\x62\x93\x06\x01\xcd\x2e\x7d\x02\x57\x54\xd8\x39\x0a\x01\x45\x84\xa9\xae\x13\x23\x46\x32\xbb\x8c\x68\x8d\x34\x56\x29\x5b\xde\x30\xa8\xc6\xd9\xa5\x65\x8f\xf1\x89\x58\x2a\x7b\x80\xff\xe7\xff\xae\xca\x62\xd5\xcd\x21\xd5\x7b\x2e\x07\x7e\x92\xe2\xfd\x06\xa7\x9c\x3b\x27\x36\x04\xac\xab\x3e\x8b\x58\x97\x98\x8a\x24\x56\x58\xbd\xe4\x20\xb1\xae\x42\x52\x1b\x1b\x83\x8e\xe5\x6f\x2d\x84\x0d\xe7\x15\xe6\x5c\x36\xb3\x7e\xa2\x1b\xf3\x2d\xd4\x21\x9b\xea\x62\xc1\x85\x22\xc7\x90\xb5\xcd\x34\xeb\xea\x56\xcc\xdd\x51\x97\x4d\x6a\x17\xa0\xc4\x4a\xa8\x3e\x06\x79\xe3\xa5\xd9\xf7\x2c\x55\x33\xf7\x1d\x2f\x9f\xc3\x98\xf7\x2d\xb2\x22\xcb\x2a\xec\xc5\xa6\x77\x5e\x5a\x88\x0e\xbe\x1f\xf4\xfa\x39\x8c\x35\xc4\x61\xe1\x15\x65\x8a\xe5\x3e\xb9\xfd\x40\x9b\x7f\x9e\xcc\x8c\x93\x31\xad\xcf\x0b\x25\xec\x2c\xc6\xbd\x1c\x2b\x44\xd2\x6b\x08\x68\xeb\x52\x47\xeb\x5d\x9c\x26\x8c\xb9\xed\x30\x1c\x04\xea\x8c\x0e\xd9\x5e\x88\x9d\x69\xd4\xeb\x62\xe1\x20\x70\xa2\xf0\x4e\x68\x2e\x46\xea\xcc\x7a\x59\xe7\xb4\x59\xa7\xcc\xc9\xff\xc8\xfe\x47\xea\x4c\x07\xb1\x1e\x37\xf0\x55\xeb\x28\xf6\x06\x44\x0f\xc0\xf2\xe1\xbe\x3f\x93\x1b\x56\x08\x69\xf1\xd7\x09\xac\x1b\x45\xee\xf7\x35\x66\x6b\xed\xab\xf6\x59\x08\xd8\xde\x7a\xcf\x7e\xa1\xd1\x9f\x9c\x18\xc7\x12\x15\xac\x62\x99\xc6\xdc\x0d\x13\x23\x06\x36\xc9\xe3\x4d\x85\x11\xfc\x82\x50\xa9\xb8\x54\xfa\x0c\x97\x00\x29\x66\xf1\x26\x57\xba\xf8\x9b\x40\x2c\x53\x28\x1e\xb0\x2c\x05\x35\xea\x0a\xee\x30\x2f\x3e\x50\x87\x20\x11\x53\xea\xe6\x3d\x31\x6b\x2f\x1b\x19\x1f\x0b\xb5\x17\x8f\x56\xb1\xba\x8f\xbe\x8f\x1f\x67\x52\xfd\xff\x8b\xf0\x8b\x03\x83\xa3\xa2\xb1\xea\xc8\xd0\x4a\x4c\x16\x62\xc0\xed\x6d\xd3\x51\x9f\x8c\x75\xfa\x39\x59\xc7\xfa\x7e\x42\x62\xc5\x5d\x3e\x2f\xc3\x02\x25\x96\xb1\x12\x85\x64\x11\x31\x54\x91\x41\x0c\x0b\xf1\x80\x12\x30\x5d\xe0\x73\xe6\x00\x74\xae\x99\x02\x1c\x49\xae\xb2\xb8\xf7\x21\x0e\x88\x1c\xd7\xa9\x1f\x8c\xc8\x3d\x06\xb2\xb2\x58\x19\x0a\xfa\x2c\xfa\xed\x3d\x55\x5e\x2d\x34\xc4\x10\xa1\x21\x0d\x80\x2a\x98\xff\x45\x49\x91\x9c\x76\x99\x7d\x55\xb4\xf0\xf9\x9d\xbe\x45\xfb\x63\x23\xf3\x41\x50\x29\x5c\xb7\xca\xd5\x6b\xfc\x70\xa3\x70\x4d\xdd\x79\x93\x0f\xc9\x37\x49\x5d\xb2\x9b\x62\xa1\xb3\xae\x17\x76\x92\x5d\x9f\xa3\x9a\xb8\x15\x4e\x7c\x5a\xef\x0a\xa6\x84\x3a\xc3\xf6\x93\xeb\x6e\x7a\xab\x6d\xc2\x6d\xe4\x24\xd1\x91\xfb\xa6\x0f\xfd\x88\x39\x1f\x74\x5c\x62\x34\xab\x66\xf2\x01\xcb\xaa\x59\xeb\x5c\x10\x35\x3f\xbb\xf9\x9c\x84\x2e\x32\xda\xfe\xfe\xc5\xf7\x70\x6c\x7a\xee\x3d\x18\xde\xbe\xf1\x8e\x47\x51\xe4\xfa\xe1\xbc\xc2\xa7\xce\xea\x80\xe5\x9d\xf7\x9b\x69\x7d\x96\xae\x1e\x0e\x02\xb6\x34\x8e\xa0\x9e\x96\x6f\x50\x5d\xa3\x58\xdc\xdf\x15\x65\xf5\x64\x3e\x98\x00\x59\x49\xb8\xc7\xb7\xc8\x86\x9f\xf6\xad\x58\xbb\x93\x67\xf7\xce\xcd\xb8\xa9\x7a\xce\xb8\xad\x2c\x56\xff\x8d\x6e\xc6\xda\x10\x69\x5f\xc8\xd3\x23\x17\x8a\xb4\x5c\x1d\xce\xaa\x1b\x55\x52\xab\x3b\x92\x85\xd2\x4b\x3f\x55\x58\x5e\xb2\x48\xd2\x10\xea\x5a\xa4\xa3\x90\xd4\x90\xb3\x6d\xce\x2e\x1b\x95\x7c\x3d\x4f\x16\xe9\xff\x3c\xf6\xeb\x7b\xec\xef\x74\xd7\x03\x7e\xd5\x6e\xd9\x0f\xfa\xc8\x61\x73\x67\x00\x91\x19\xa7\xeb\x31\xf7\x7d\x43\xc3\x97\xe6\x88\x97\xf4\xdb\x6a\xd1\xc2\xca\x96\x5c\xb4\xaf\xe2\x25\x8e\x6e\xe7\xe6\xda\x3f\xeb\x6a\xe5\x74\xe2\x8d\x44\xb8\xb2\x16\x69\x03\xbd\x8a\xd7\xb7\x7e\xe7\x06\x75\xbd\x3b\x9c\xde\x39\x6d\x6a\x37\x3b\x60\xd2\xe5\x9b\x9e\xe3\xe9\x5a\x5e\xa4\xd5\x2d\x47\xae\xd9\xe5\x1c\xf4\x04\x8a\xd7\x89\x49\x37\x7e\xcb\x96\x76\xf6\x36\xbb\x74\xe5\xbe\x9b\x7e\x07\x01\x45\x1a\xe2\xf3\x76\xde\x76\x07\xc3\xa3\x83\x21\x94\xad\x8b\x74\x40\xe7\x3b\x23\x74\xa6\xc6\xff\xf5\x74\xd7\xa4\xcd\x56\x87\x1d\x04\xb4\x34\xdd\x01\x69\x76\x03\xe3\x5d\xd3\x3e\x77\xd3\x10\x7b\xfa\xf0\x03\x9e\x77\xa0\x35\xef\xf1\x36\x7d\xc4\xfc\x71\x2d\xec\xd4\x74\x63\xbd\x6d\x58\x10\x54\xd1\x2f\xf7\x58\x72\x00\x89\x66\x76\x64\xf7\x0c\x62\xb7\x3a\x30\xef\xdc\xf4\xac\x89\xbc\xa7\xce\xb9\xe6\x13\xc8\x96\xdc\x38\x84\x3e\x87\x84\xb4\xd8\x70\x9d\x3b\x24\xea\xd7\x9b\x3c\x9f\x49\xf5\xd7\xbf\x0c\xdd\xa4\x7d\x37\xbe\x9b\x29\x3b\x9d\x3a\xd7\x9b\x74\xc8\xe8\xd7\x0b\xf4\x06\xbb\x90\x07\x91\x37\x16\xd2\x25\x21\x24\x51\x68\x20\xf6\xd2\x69\x46\xae\x53\x37\x15\x7f\xe1\x8f\xc5\x8d\x9c\x4d\x1d\xbe\xb3\xf7\xad\xbd\x4e\x5d\x6f\xeb\x89\x9e\x9a\x0b\xc9\xdf\x6a\x5f\x56\x7a\xec\x6b\x28\x14\x1b\x35\x01\x21\x61\xcf\x64\x99\x1c\x82\x41\x8a\x25\x5d\xbf\xd8\xa8\x68\x34\x6e\xe8\x68\x1d\x50\x10\xfa\xa6\x58\xc2\xa7\x4f\x80\x2c\xce\x26\xae\x04\xfd\x53\xe8\x8d\xc4\xc7\x35\x26\x0a\x53\x10\xa9\xee\x80\xb8\x6c\x21\xe7\x3b\x2e\x36\x6a\x68\x10\x9b\x17\x1d\x14\xd2\x72\x20\xa4\x61\x80\x6f\xd6\xa5\x4f\xb2\xfe\x7d\xe4\x85\xdc\xa1\x5e\x6c\x14\x2b\xc5\x84\xd8\x9d\xf9\xed\x45\xb9\x18\xc2\x90\xee\x3d\x84\x21\x4f\xb2\x86\x6c\x4d\x30\xb4\x6a\x1e\x3a\xad\x3c\x7f\x96\x7b\xb2\x7a\xb1\xd2\x83\xef\xa1\x7d\x2c\xf2\xec\x24\x10\xf2\x69\x8e\x84\xf4\x18\x72\xc6\xd7\x62\x4b\x5b\xc7\x1f\xc6\x15\x45\x5e\xa7\xa7\xb4\xba\xb5\x82\x9b\xb7\xb4\xf4\x3c\xbd\x70\x26\x10\x29\x99\x26\x47\x64\x33\x23\xb5\x28\x77\xec\xc3\xc4\x75\x97\x08\xcc\x02\x59\xb6\x0f\xce\x98\x6e\xcd\xda\xbc\x0d\xde\xac\x37\x4f\x45\x81\xff\x1e\xe0\xb9\x90\x7d\x0c\xea\x7d\x7b\xe0\x71\xff\x17\xbd\x3d\xb4\x5f\x1f\x3c\xc1\xfc\xa6\xf3\xb5\x4e\x4d\x43\x1d\x40\x4d\xe2\x19\x92\x60\x7e\xb3\xc3\x63\xc3\x9a\xae\x68\x74\x2c\xee\x2f\x07\x67\x97\x33\x69\xa5\xe4\x82\xa9\xb4\x35\x8f\x9b\x7f\x6b\x44\xe6\xcd\x39\xf4\x6e\xbd\x97\x6b\x7e\x33\x31\x6c\xd8\xa4\xee\x65\x74\x4b\xc1\x9c\x34\x4f\x11\xda\x64\xb4\x16\xa8\x00\x9e\x0f\xba\xf6\xb2\x4f\x34\x9e\xcd\xec\x48\x46\xdb\x90\x3e\x87\xa9\x16\x93\xb4\x95\x81\x31\x9d\x9d\xd1\xa1\x5f\x71\x68\xe6\x6e\xc5\xdc\x3c\x5e\x69\xe4\x37\xaa\xdc\x24\x8a\xdd\x8a\x9a\x98\xf6\x23\xe3\x61\xe0\x09\x48\x8f\xb4\x7b\xa8\xa1\x0c\xa7\x33\xc8\x0f\x1f\xe4\xd5\x1b\xfb\xd4\x98\xfa\xc5\x57\x6f\x0d\xd2\x57\x85\xd1\xc7\xbe\x4a\xec\x79\x05\xcc\x01\x69\x88\x0c\xb2\x65\xf3\xf6\x27\xe6\xed\x2b\xbe\xb1\x97\x7c\x49\x60\x2d\xeb\x08\x5a\x9e\xc9\x5e\x39\xce\x96\x61\x23\x63\x0a\x15\xe3\x6c\x39\x6f\x0b\xd3\xae\x4e\x1c\xc5\x1d\xe1\x3d\xd7\xca\xff\x83\x2c\xdc\xde\xeb\x77\xd8\x78\xa6\x1f\xa5\x8f\x97\xf8\xd1\xda\xfb\xae\x0a\x86\x7f\xba\xcd\xcb\x3d\x66\xfc\x25\x7d\xc3\x3e\x8b\xdd\xdb\x3b\x3c\x65\xa9\xc4\xcd\xc9\x18\x5e\x15\x54\x48\x2a\xa8\xb8\xc5\x3f\x26\x12\xea\x3e\x56\x10\x97\x08\x95\x2a\x4a\x4c\x21\xae\xa8\xec\xb1\x3f\x69\x4a\x63\x15\xdf\xc5\x15\xc2\xf8\xc4\xeb\x2d\x8f\xed\xc4\x60\xcf\x8c\xa0\x3d\x48\x70\xf9\x39\x75\x06\x56\xa9\x32\x29\xe4\x43\x74\xa1\x0a\xd1\x44\x09\xab\x91\x5e\x6b\xeb\xb5\x37\x97\xec\xba\x1d\x8f\x48\x43\xc7\xad\xa7\x87\x7d\xcd\x51\x8b\x81\xf6\x0f\x42\x9c\x3f\x7a\x70\xb6\xdd\xa2\xaf\x3b\xbe\xd7\xfd\x95\x89\xef\x93\x6e\x5c\xef\x0f\x1f\x8c\x12\x47\x87\xfa\x88\xcf\x68\x23\x3a\x5d\x7e\xbb\x3d\xa8\xff\x5d\x6e\x6f\x62\xe5\x9e\x20\xe9\x45\xd4\x76\xb1\xba\x2f\x00\x3c\xcb\xeb\x45\xc5\xa8\x88\x39\xce\x7c\xbd\xce\xef\xd7\x68\x7e\x98\xfd\x3a\xd1\x68\x87\xb9\x71\xb6\xec\xe7\xf0\x70\xf8\x71\x2d\x97\x7e\xa7\x85\xba\x96\x4d\xab\xe8\xa5\x90\x27\x72\x71\xab\x7a\xdd\xfd\xdd\xc4\xce\xd3\xc6\x1f\x13\x52\x9e\x3d\x17\xf2\x0b\x6d\x37\x06\x8a\xcb\xd6\xaf\x11\x2f\xca\x45\xb3\xc7\xaf\xe5\xfe\x6e\x63\x6a\x7a\x7a\xbb\xc9\x73\x45\xd1\xd4\x03\xf1\xda\xd0\x41\x37\xd2\xe9\xf7\xf7\x76\xac\xd3\x6b\x2e\xda\xe9\x28\x69\x03\xdc\x55\x51\xae\x62\x35\x93\xfa\xc1\x33\x66\xee\x22\x6e\x93\x27\x70\x76\x6a\x7e\x41\xc7\x4a\x22\x42\xf7\x71\xf5\xb6\xc4\x4c\x3c\x7a\xbc\x51\x73\x3d\x34\x58\x09\x87\x26\x67\xd9\xd4\x37\x62\xc4\xc7\xee\x97\x2d\xcd\x20\x50\x1b\x85\xc7\xfa\xb5\xc8\xf3\xf8\x2e\xa7\xeb\x8d\x5b\xbf\xab\x8b\x3d\xc1\x75\x7f\x19\xfa\xaf\x00\x00\x00\xff\xff\xfe\xcf\x1b\x6a\x74\x2b\x00\x00") func templateDialectSqlQueryTmplBytes() ([]byte, error) { return bindataRead( @@ -775,7 +775,7 @@ func templateDialectSqlQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 11086, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 11124, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/dialect/sql/decode.tmpl b/entc/gen/template/dialect/sql/decode.tmpl index 213c4bf4f..2d3952add 100644 --- a/entc/gen/template/dialect/sql/decode.tmpl +++ b/entc/gen/template/dialect/sql/decode.tmpl @@ -103,7 +103,7 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(values ...interface{}) error { {{- end }} {{- else }} } else if value != nil { - {{ $ret }}.{{ $field }} = *value + {{ $ret }}.{{ $field }} = {{ if not $f.Nillable }}*{{ end }}value {{- end }} } {{- end }} diff --git a/entc/gen/template/dialect/sql/query.tmpl b/entc/gen/template/dialect/sql/query.tmpl index d34f605ce..db5a40fb4 100644 --- a/entc/gen/template/dialect/sql/query.tmpl +++ b/entc/gen/template/dialect/sql/query.tmpl @@ -328,6 +328,6 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery() *sql.Selector { {{- else if hasPrefix $nulltype "sql" -}} {{ $field.NullTypeField $arg -}} {{- else -}} - {{ $arg }} + {{ if not $field.Nillable }}*{{ end }}{{ $arg }} {{- end }} {{- end }} diff --git a/entc/integration/customid/customid_test.go b/entc/integration/customid/customid_test.go index ebb3b66aa..8aa429292 100644 --- a/entc/integration/customid/customid_test.go +++ b/entc/integration/customid/customid_test.go @@ -91,8 +91,14 @@ func CustomID(t *testing.T, client *ent.Client) { require.Equal(t, 3, hub.ID) require.Equal(t, []int{1, 5}, hub.QueryUsers().Order(ent.Asc(user.FieldID)).IDsX(ctx)) - b := client.Blob.Create().SetID(uuid.New()).SaveX(ctx) - require.NotEmpty(t, b.ID) + blb := client.Blob.Create().SetID(uuid.New()).SaveX(ctx) + require.NotEmpty(t, blb.ID) + chd := client.Blob.Create().SetID(uuid.New()).SetParent(blb).SaveX(ctx) + require.Equal(t, blb.ID, chd.QueryParent().OnlyX(ctx).ID) + lnk := client.Blob.Create().SetID(uuid.New()).AddLinks(chd, blb).SaveX(ctx) + require.Equal(t, 2, lnk.QueryLinks().CountX(ctx)) + require.Equal(t, lnk.ID, chd.QueryLinks().OnlyX(ctx).ID) + require.Equal(t, lnk.ID, blb.QueryLinks().OnlyX(ctx).ID) pedro := client.Pet.Create().SetID("pedro").SetOwner(a8m).SaveX(ctx) require.Equal(t, a8m.ID, pedro.QueryOwner().OnlyXID(ctx)) diff --git a/entc/integration/customid/ent/blob.go b/entc/integration/customid/ent/blob.go index 9cbe3f126..c59744b37 100644 --- a/entc/integration/customid/ent/blob.go +++ b/entc/integration/customid/ent/blob.go @@ -21,6 +21,44 @@ type Blob struct { ID uuid.UUID `json:"id,omitempty"` // UUID holds the value of the "uuid" field. UUID uuid.UUID `json:"uuid,omitempty"` + // Edges holds the relations/edges for other nodes in the graph. + // The values are being populated by the BlobQuery when eager-loading is set. + Edges BlobEdges `json:"edges"` + blob_parent *uuid.UUID +} + +// BlobEdges holds the relations/edges for other nodes in the graph. +type BlobEdges struct { + // Parent holds the value of the parent edge. + Parent *Blob + // Links holds the value of the links edge. + Links []*Blob + // loadedTypes holds the information for reporting if a + // type was loaded (or requested) in eager-loading or not. + loadedTypes [2]bool +} + +// ParentOrErr returns the Parent value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BlobEdges) ParentOrErr() (*Blob, error) { + if e.loadedTypes[0] { + if e.Parent == nil { + // The edge parent was loaded in eager-loading, + // but was not found. + return nil, &NotFoundError{label: blob.Label} + } + return e.Parent, nil + } + return nil, &NotLoadedError{edge: "parent"} +} + +// LinksOrErr returns the Links value or an error if the edge +// was not loaded in eager-loading. +func (e BlobEdges) LinksOrErr() ([]*Blob, error) { + if e.loadedTypes[1] { + return e.Links, nil + } + return nil, &NotLoadedError{edge: "links"} } // scanValues returns the types for scanning values from sql.Rows. @@ -31,6 +69,13 @@ func (*Blob) scanValues() []interface{} { } } +// fkValues returns the types for scanning foreign-keys values from sql.Rows. +func (*Blob) fkValues() []interface{} { + return []interface{}{ + &uuid.UUID{}, // blob_parent + } +} + // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Blob fields. func (b *Blob) assignValues(values ...interface{}) error { @@ -48,9 +93,27 @@ func (b *Blob) assignValues(values ...interface{}) error { } else if value != nil { b.UUID = *value } + values = values[1:] + if len(values) == len(blob.ForeignKeys) { + if value, ok := values[0].(*uuid.UUID); !ok { + return fmt.Errorf("unexpected type %T for field blob_parent", values[0]) + } else if value != nil { + b.blob_parent = value + } + } return nil } +// QueryParent queries the parent edge of the Blob. +func (b *Blob) QueryParent() *BlobQuery { + return (&BlobClient{config: b.config}).QueryParent(b) +} + +// QueryLinks queries the links edge of the Blob. +func (b *Blob) QueryLinks() *BlobQuery { + return (&BlobClient{config: b.config}).QueryLinks(b) +} + // Update returns a builder for updating this Blob. // Note that, you need to call Blob.Unwrap() before calling this method, if this Blob // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/entc/integration/customid/ent/blob/blob.go b/entc/integration/customid/ent/blob/blob.go index 639582361..342534123 100644 --- a/entc/integration/customid/ent/blob/blob.go +++ b/entc/integration/customid/ent/blob/blob.go @@ -21,6 +21,12 @@ const ( // Table holds the table name of the blob in the database. Table = "blobs" + // ParentTable is the table the holds the parent relation/edge. + ParentTable = "blobs" + // ParentColumn is the table column denoting the parent relation/edge. + ParentColumn = "blob_parent" + // LinksTable is the table the holds the links relation/edge. The primary key declared below. + LinksTable = "blob_links" ) // Columns holds all SQL columns for blob fields. @@ -29,6 +35,17 @@ var Columns = []string{ FieldUUID, } +// ForeignKeys holds the SQL foreign-keys that are owned by the Blob type. +var ForeignKeys = []string{ + "blob_parent", +} + +var ( + // LinksPrimaryKey and LinksColumn2 are the table columns denoting the + // primary key for the links relation (M2M). + LinksPrimaryKey = []string{"blob_id", "link_id"} +) + var ( fields = schema.Blob{}.Fields() diff --git a/entc/integration/customid/ent/blob/where.go b/entc/integration/customid/ent/blob/where.go index 31f74ec9f..764686199 100644 --- a/entc/integration/customid/ent/blob/where.go +++ b/entc/integration/customid/ent/blob/where.go @@ -8,6 +8,7 @@ package blob import ( "github.com/facebookincubator/ent/dialect/sql" + "github.com/facebookincubator/ent/dialect/sql/sqlgraph" "github.com/facebookincubator/ent/entc/integration/customid/ent/predicate" "github.com/google/uuid" ) @@ -178,6 +179,62 @@ func UUIDLTE(v uuid.UUID) predicate.Blob { }) } +// HasParent applies the HasEdge predicate on the "parent" edge. +func HasParent() predicate.Blob { + return predicate.Blob(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ParentTable, FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, ParentTable, ParentColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasParentWith applies the HasEdge predicate on the "parent" edge with a given conditions (other predicates). +func HasParentWith(preds ...predicate.Blob) predicate.Blob { + return predicate.Blob(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, ParentTable, ParentColumn), + ) + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasLinks applies the HasEdge predicate on the "links" edge. +func HasLinks() predicate.Blob { + return predicate.Blob(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(LinksTable, FieldID), + sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasLinksWith applies the HasEdge predicate on the "links" edge with a given conditions (other predicates). +func HasLinksWith(preds ...predicate.Blob) predicate.Blob { + return predicate.Blob(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2M, false, LinksTable, LinksPrimaryKey...), + ) + 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.Blob) predicate.Blob { return predicate.Blob(func(s *sql.Selector) { diff --git a/entc/integration/customid/ent/blob_create.go b/entc/integration/customid/ent/blob_create.go index ee31e8b02..a411b4c61 100644 --- a/entc/integration/customid/ent/blob_create.go +++ b/entc/integration/customid/ent/blob_create.go @@ -8,6 +8,7 @@ package ent import ( "context" + "errors" "github.com/facebookincubator/ent/dialect/sql/sqlgraph" "github.com/facebookincubator/ent/entc/integration/customid/ent/blob" @@ -18,8 +19,10 @@ import ( // BlobCreate is the builder for creating a Blob entity. type BlobCreate struct { config - id *uuid.UUID - uuid *uuid.UUID + id *uuid.UUID + uuid *uuid.UUID + parent map[uuid.UUID]struct{} + links map[uuid.UUID]struct{} } // SetUUID sets the uuid field. @@ -34,12 +37,57 @@ func (bc *BlobCreate) SetID(u uuid.UUID) *BlobCreate { return bc } +// SetParentID sets the parent edge to Blob by id. +func (bc *BlobCreate) SetParentID(id uuid.UUID) *BlobCreate { + if bc.parent == nil { + bc.parent = make(map[uuid.UUID]struct{}) + } + bc.parent[id] = struct{}{} + return bc +} + +// SetNillableParentID sets the parent edge to Blob by id if the given value is not nil. +func (bc *BlobCreate) SetNillableParentID(id *uuid.UUID) *BlobCreate { + if id != nil { + bc = bc.SetParentID(*id) + } + return bc +} + +// SetParent sets the parent edge to Blob. +func (bc *BlobCreate) SetParent(b *Blob) *BlobCreate { + return bc.SetParentID(b.ID) +} + +// AddLinkIDs adds the links edge to Blob by ids. +func (bc *BlobCreate) AddLinkIDs(ids ...uuid.UUID) *BlobCreate { + if bc.links == nil { + bc.links = make(map[uuid.UUID]struct{}) + } + for i := range ids { + bc.links[ids[i]] = struct{}{} + } + return bc +} + +// AddLinks adds the links edges to Blob. +func (bc *BlobCreate) AddLinks(b ...*Blob) *BlobCreate { + ids := make([]uuid.UUID, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bc.AddLinkIDs(ids...) +} + // Save creates the Blob in the database. func (bc *BlobCreate) Save(ctx context.Context) (*Blob, error) { if bc.uuid == nil { v := blob.DefaultUUID() bc.uuid = &v } + if len(bc.parent) > 1 { + return nil, errors.New("ent: multiple assignments on a unique edge \"parent\"") + } return bc.sqlSave(ctx) } @@ -75,6 +123,44 @@ func (bc *BlobCreate) sqlSave(ctx context.Context) (*Blob, error) { }) b.UUID = *value } + if nodes := bc.parent; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: blob.ParentTable, + Columns: []string{blob.ParentColumn}, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := bc.links; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } if err := sqlgraph.CreateNode(ctx, bc.driver, _spec); err != nil { if cerr, ok := isSQLConstraintError(err); ok { err = cerr diff --git a/entc/integration/customid/ent/blob_query.go b/entc/integration/customid/ent/blob_query.go index 0e97cacbc..7c54a3ea0 100644 --- a/entc/integration/customid/ent/blob_query.go +++ b/entc/integration/customid/ent/blob_query.go @@ -8,6 +8,7 @@ package ent import ( "context" + "database/sql/driver" "errors" "fmt" "math" @@ -28,6 +29,10 @@ type BlobQuery struct { order []Order unique []string predicates []predicate.Blob + // eager-loading edges. + withParent *BlobQuery + withLinks *BlobQuery + withFKs bool // intermediate query. sql *sql.Selector } @@ -56,6 +61,30 @@ func (bq *BlobQuery) Order(o ...Order) *BlobQuery { return bq } +// QueryParent chains the current query on the parent edge. +func (bq *BlobQuery) QueryParent() *BlobQuery { + query := &BlobQuery{config: bq.config} + step := sqlgraph.NewStep( + sqlgraph.From(blob.Table, blob.FieldID, bq.sqlQuery()), + sqlgraph.To(blob.Table, blob.FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, blob.ParentTable, blob.ParentColumn), + ) + query.sql = sqlgraph.SetNeighbors(bq.driver.Dialect(), step) + return query +} + +// QueryLinks chains the current query on the links edge. +func (bq *BlobQuery) QueryLinks() *BlobQuery { + query := &BlobQuery{config: bq.config} + step := sqlgraph.NewStep( + sqlgraph.From(blob.Table, blob.FieldID, bq.sqlQuery()), + sqlgraph.To(blob.Table, blob.FieldID), + sqlgraph.Edge(sqlgraph.M2M, false, blob.LinksTable, blob.LinksPrimaryKey...), + ) + query.sql = sqlgraph.SetNeighbors(bq.driver.Dialect(), step) + return query +} + // First returns the first Blob entity in the query. Returns *NotFoundError when no blob was found. func (bq *BlobQuery) First(ctx context.Context) (*Blob, error) { bs, err := bq.Limit(1).All(ctx) @@ -225,6 +254,28 @@ func (bq *BlobQuery) Clone() *BlobQuery { } } +// WithParent tells the query-builder to eager-loads the nodes that are connected to +// the "parent" edge. The optional arguments used to configure the query builder of the edge. +func (bq *BlobQuery) WithParent(opts ...func(*BlobQuery)) *BlobQuery { + query := &BlobQuery{config: bq.config} + for _, opt := range opts { + opt(query) + } + bq.withParent = query + return bq +} + +// WithLinks tells the query-builder to eager-loads the nodes that are connected to +// the "links" edge. The optional arguments used to configure the query builder of the edge. +func (bq *BlobQuery) WithLinks(opts ...func(*BlobQuery)) *BlobQuery { + query := &BlobQuery{config: bq.config} + for _, opt := range opts { + opt(query) + } + bq.withLinks = query + return bq +} + // GroupBy used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -268,13 +319,27 @@ func (bq *BlobQuery) Select(field string, fields ...string) *BlobSelect { func (bq *BlobQuery) sqlAll(ctx context.Context) ([]*Blob, error) { var ( - nodes = []*Blob{} - _spec = bq.querySpec() + nodes = []*Blob{} + withFKs = bq.withFKs + _spec = bq.querySpec() + loadedTypes = [2]bool{ + bq.withParent != nil, + bq.withLinks != nil, + } ) + if bq.withParent != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, blob.ForeignKeys...) + } _spec.ScanValues = func() []interface{} { node := &Blob{config: bq.config} nodes = append(nodes, node) values := node.scanValues() + if withFKs { + values = append(values, node.fkValues()...) + } return values } _spec.Assign = func(values ...interface{}) error { @@ -282,6 +347,7 @@ func (bq *BlobQuery) sqlAll(ctx context.Context) ([]*Blob, error) { return fmt.Errorf("ent: Assign called without calling ScanValues") } node := nodes[len(nodes)-1] + node.Edges.loadedTypes = loadedTypes return node.assignValues(values...) } if err := sqlgraph.QueryNodes(ctx, bq.driver, _spec); err != nil { @@ -290,6 +356,95 @@ func (bq *BlobQuery) sqlAll(ctx context.Context) ([]*Blob, error) { if len(nodes) == 0 { return nodes, nil } + + if query := bq.withParent; query != nil { + ids := make([]uuid.UUID, 0, len(nodes)) + nodeids := make(map[uuid.UUID][]*Blob) + for i := range nodes { + if fk := nodes[i].blob_parent; fk != nil { + ids = append(ids, *fk) + nodeids[*fk] = append(nodeids[*fk], nodes[i]) + } + } + query.Where(blob.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return nil, fmt.Errorf(`unexpected foreign-key "blob_parent" returned %v`, n.ID) + } + for i := range nodes { + nodes[i].Edges.Parent = n + } + } + } + + if query := bq.withLinks; query != nil { + fks := make([]driver.Value, 0, len(nodes)) + ids := make(map[uuid.UUID]*Blob, len(nodes)) + for _, node := range nodes { + ids[node.ID] = node + fks = append(fks, node.ID) + } + var ( + edgeids []uuid.UUID + edges = make(map[uuid.UUID][]*Blob) + ) + _spec := &sqlgraph.EdgeQuerySpec{ + Edge: &sqlgraph.EdgeSpec{ + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + }, + Predicate: func(s *sql.Selector) { + s.Where(sql.InValues(blob.LinksPrimaryKey[0], fks...)) + }, + + ScanValues: func() [2]interface{} { + return [2]interface{}{&uuid.UUID{}, &uuid.UUID{}} + }, + Assign: func(out, in interface{}) error { + eout, ok := out.(*uuid.UUID) + if !ok || eout == nil { + return fmt.Errorf("unexpected id value for edge-out") + } + ein, ok := in.(*uuid.UUID) + if !ok || ein == nil { + return fmt.Errorf("unexpected id value for edge-in") + } + outValue := *eout + inValue := *ein + node, ok := ids[outValue] + if !ok { + return fmt.Errorf("unexpected node id in edges: %v", outValue) + } + edgeids = append(edgeids, inValue) + edges[inValue] = append(edges[inValue], node) + return nil + }, + } + if err := sqlgraph.QueryEdges(ctx, bq.driver, _spec); err != nil { + return nil, fmt.Errorf(`query edges "links": %v`, err) + } + query.Where(blob.IDIn(edgeids...)) + neighbors, err := query.All(ctx) + if err != nil { + return nil, err + } + for _, n := range neighbors { + nodes, ok := edges[n.ID] + if !ok { + return nil, fmt.Errorf(`unexpected "links" node returned %v`, n.ID) + } + for i := range nodes { + nodes[i].Edges.Links = append(nodes[i].Edges.Links, n) + } + } + } + return nodes, nil } diff --git a/entc/integration/customid/ent/blob_update.go b/entc/integration/customid/ent/blob_update.go index 9eb78bc26..b6a6f7cf2 100644 --- a/entc/integration/customid/ent/blob_update.go +++ b/entc/integration/customid/ent/blob_update.go @@ -8,6 +8,7 @@ package ent import ( "context" + "errors" "github.com/facebookincubator/ent/dialect/sql" "github.com/facebookincubator/ent/dialect/sql/sqlgraph" @@ -20,8 +21,12 @@ import ( // BlobUpdate is the builder for updating Blob entities. type BlobUpdate struct { config - uuid *uuid.UUID - predicates []predicate.Blob + uuid *uuid.UUID + parent map[uuid.UUID]struct{} + links map[uuid.UUID]struct{} + clearedParent bool + removedLinks map[uuid.UUID]struct{} + predicates []predicate.Blob } // Where adds a new predicate for the builder. @@ -36,8 +41,79 @@ func (bu *BlobUpdate) SetUUID(u uuid.UUID) *BlobUpdate { return bu } +// SetParentID sets the parent edge to Blob by id. +func (bu *BlobUpdate) SetParentID(id uuid.UUID) *BlobUpdate { + if bu.parent == nil { + bu.parent = make(map[uuid.UUID]struct{}) + } + bu.parent[id] = struct{}{} + return bu +} + +// SetNillableParentID sets the parent edge to Blob by id if the given value is not nil. +func (bu *BlobUpdate) SetNillableParentID(id *uuid.UUID) *BlobUpdate { + if id != nil { + bu = bu.SetParentID(*id) + } + return bu +} + +// SetParent sets the parent edge to Blob. +func (bu *BlobUpdate) SetParent(b *Blob) *BlobUpdate { + return bu.SetParentID(b.ID) +} + +// AddLinkIDs adds the links edge to Blob by ids. +func (bu *BlobUpdate) AddLinkIDs(ids ...uuid.UUID) *BlobUpdate { + if bu.links == nil { + bu.links = make(map[uuid.UUID]struct{}) + } + for i := range ids { + bu.links[ids[i]] = struct{}{} + } + return bu +} + +// AddLinks adds the links edges to Blob. +func (bu *BlobUpdate) AddLinks(b ...*Blob) *BlobUpdate { + ids := make([]uuid.UUID, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bu.AddLinkIDs(ids...) +} + +// ClearParent clears the parent edge to Blob. +func (bu *BlobUpdate) ClearParent() *BlobUpdate { + bu.clearedParent = true + return bu +} + +// RemoveLinkIDs removes the links edge to Blob by ids. +func (bu *BlobUpdate) RemoveLinkIDs(ids ...uuid.UUID) *BlobUpdate { + if bu.removedLinks == nil { + bu.removedLinks = make(map[uuid.UUID]struct{}) + } + for i := range ids { + bu.removedLinks[ids[i]] = struct{}{} + } + return bu +} + +// RemoveLinks removes links edges to Blob. +func (bu *BlobUpdate) RemoveLinks(b ...*Blob) *BlobUpdate { + ids := make([]uuid.UUID, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return bu.RemoveLinkIDs(ids...) +} + // Save executes the query and returns the number of rows/vertices matched by this operation. func (bu *BlobUpdate) Save(ctx context.Context) (int, error) { + if len(bu.parent) > 1 { + return 0, errors.New("ent: multiple assignments on a unique edge \"parent\"") + } return bu.sqlSave(ctx) } @@ -88,6 +164,79 @@ func (bu *BlobUpdate) sqlSave(ctx context.Context) (n int, err error) { Column: blob.FieldUUID, }) } + if bu.clearedParent { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: blob.ParentTable, + Columns: []string{blob.ParentColumn}, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bu.parent; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: blob.ParentTable, + Columns: []string{blob.ParentColumn}, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if nodes := bu.removedLinks; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bu.links; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.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, bu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{blob.Label} @@ -102,8 +251,12 @@ func (bu *BlobUpdate) sqlSave(ctx context.Context) (n int, err error) { // BlobUpdateOne is the builder for updating a single Blob entity. type BlobUpdateOne struct { config - id uuid.UUID - uuid *uuid.UUID + id uuid.UUID + uuid *uuid.UUID + parent map[uuid.UUID]struct{} + links map[uuid.UUID]struct{} + clearedParent bool + removedLinks map[uuid.UUID]struct{} } // SetUUID sets the uuid field. @@ -112,8 +265,79 @@ func (buo *BlobUpdateOne) SetUUID(u uuid.UUID) *BlobUpdateOne { return buo } +// SetParentID sets the parent edge to Blob by id. +func (buo *BlobUpdateOne) SetParentID(id uuid.UUID) *BlobUpdateOne { + if buo.parent == nil { + buo.parent = make(map[uuid.UUID]struct{}) + } + buo.parent[id] = struct{}{} + return buo +} + +// SetNillableParentID sets the parent edge to Blob by id if the given value is not nil. +func (buo *BlobUpdateOne) SetNillableParentID(id *uuid.UUID) *BlobUpdateOne { + if id != nil { + buo = buo.SetParentID(*id) + } + return buo +} + +// SetParent sets the parent edge to Blob. +func (buo *BlobUpdateOne) SetParent(b *Blob) *BlobUpdateOne { + return buo.SetParentID(b.ID) +} + +// AddLinkIDs adds the links edge to Blob by ids. +func (buo *BlobUpdateOne) AddLinkIDs(ids ...uuid.UUID) *BlobUpdateOne { + if buo.links == nil { + buo.links = make(map[uuid.UUID]struct{}) + } + for i := range ids { + buo.links[ids[i]] = struct{}{} + } + return buo +} + +// AddLinks adds the links edges to Blob. +func (buo *BlobUpdateOne) AddLinks(b ...*Blob) *BlobUpdateOne { + ids := make([]uuid.UUID, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return buo.AddLinkIDs(ids...) +} + +// ClearParent clears the parent edge to Blob. +func (buo *BlobUpdateOne) ClearParent() *BlobUpdateOne { + buo.clearedParent = true + return buo +} + +// RemoveLinkIDs removes the links edge to Blob by ids. +func (buo *BlobUpdateOne) RemoveLinkIDs(ids ...uuid.UUID) *BlobUpdateOne { + if buo.removedLinks == nil { + buo.removedLinks = make(map[uuid.UUID]struct{}) + } + for i := range ids { + buo.removedLinks[ids[i]] = struct{}{} + } + return buo +} + +// RemoveLinks removes links edges to Blob. +func (buo *BlobUpdateOne) RemoveLinks(b ...*Blob) *BlobUpdateOne { + ids := make([]uuid.UUID, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return buo.RemoveLinkIDs(ids...) +} + // Save executes the query and returns the updated entity. func (buo *BlobUpdateOne) Save(ctx context.Context) (*Blob, error) { + if len(buo.parent) > 1 { + return nil, errors.New("ent: multiple assignments on a unique edge \"parent\"") + } return buo.sqlSave(ctx) } @@ -158,6 +382,79 @@ func (buo *BlobUpdateOne) sqlSave(ctx context.Context) (b *Blob, err error) { Column: blob.FieldUUID, }) } + if buo.clearedParent { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: blob.ParentTable, + Columns: []string{blob.ParentColumn}, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := buo.parent; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: false, + Table: blob.ParentTable, + Columns: []string{blob.ParentColumn}, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if nodes := buo.removedLinks; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := buo.links; len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2M, + Inverse: false, + Table: blob.LinksTable, + Columns: blob.LinksPrimaryKey, + Bidi: true, + Target: &sqlgraph.EdgeTarget{ + IDSpec: &sqlgraph.FieldSpec{ + Type: field.TypeUUID, + Column: blob.FieldID, + }, + }, + } + for k, _ := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } b = &Blob{config: buo.config} _spec.Assign = b.assignValues _spec.ScanValues = b.scanValues() diff --git a/entc/integration/customid/ent/client.go b/entc/integration/customid/ent/client.go index 3391c9601..57f36a530 100644 --- a/entc/integration/customid/ent/client.go +++ b/entc/integration/customid/ent/client.go @@ -185,6 +185,34 @@ func (c *BlobClient) GetX(ctx context.Context, id uuid.UUID) *Blob { return b } +// QueryParent queries the parent edge of a Blob. +func (c *BlobClient) QueryParent(b *Blob) *BlobQuery { + query := &BlobQuery{config: c.config} + id := b.ID + step := sqlgraph.NewStep( + sqlgraph.From(blob.Table, blob.FieldID, id), + sqlgraph.To(blob.Table, blob.FieldID), + sqlgraph.Edge(sqlgraph.O2O, false, blob.ParentTable, blob.ParentColumn), + ) + query.sql = sqlgraph.Neighbors(b.driver.Dialect(), step) + + return query +} + +// QueryLinks queries the links edge of a Blob. +func (c *BlobClient) QueryLinks(b *Blob) *BlobQuery { + query := &BlobQuery{config: c.config} + id := b.ID + step := sqlgraph.NewStep( + sqlgraph.From(blob.Table, blob.FieldID, id), + sqlgraph.To(blob.Table, blob.FieldID), + sqlgraph.Edge(sqlgraph.M2M, false, blob.LinksTable, blob.LinksPrimaryKey...), + ) + query.sql = sqlgraph.Neighbors(b.driver.Dialect(), step) + + return query +} + // CarClient is a client for the Car schema. type CarClient struct { config diff --git a/entc/integration/customid/ent/migrate/schema.go b/entc/integration/customid/ent/migrate/schema.go index 580f5ab3e..49c822d6e 100644 --- a/entc/integration/customid/ent/migrate/schema.go +++ b/entc/integration/customid/ent/migrate/schema.go @@ -18,13 +18,22 @@ var ( BlobsColumns = []*schema.Column{ {Name: "id", Type: field.TypeUUID}, {Name: "uuid", Type: field.TypeUUID, Default: blob.DefaultUUID}, + {Name: "blob_parent", Type: field.TypeUUID, Unique: true, Nullable: true}, } // BlobsTable holds the schema information for the "blobs" table. BlobsTable = &schema.Table{ - Name: "blobs", - Columns: BlobsColumns, - PrimaryKey: []*schema.Column{BlobsColumns[0]}, - ForeignKeys: []*schema.ForeignKey{}, + Name: "blobs", + Columns: BlobsColumns, + PrimaryKey: []*schema.Column{BlobsColumns[0]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "blobs_blobs_parent", + Columns: []*schema.Column{BlobsColumns[2]}, + + RefColumns: []*schema.Column{BlobsColumns[0]}, + OnDelete: schema.SetNull, + }, + }, } // CarsColumns holds the columns for the "cars" table. CarsColumns = []*schema.Column{ @@ -98,6 +107,33 @@ var ( }, }, } + // BlobLinksColumns holds the columns for the "blob_links" table. + BlobLinksColumns = []*schema.Column{ + {Name: "blob_id", Type: field.TypeUUID}, + {Name: "link_id", Type: field.TypeUUID}, + } + // BlobLinksTable holds the schema information for the "blob_links" table. + BlobLinksTable = &schema.Table{ + Name: "blob_links", + Columns: BlobLinksColumns, + PrimaryKey: []*schema.Column{BlobLinksColumns[0], BlobLinksColumns[1]}, + ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "blob_links_blob_id", + Columns: []*schema.Column{BlobLinksColumns[0]}, + + RefColumns: []*schema.Column{BlobsColumns[0]}, + OnDelete: schema.Cascade, + }, + { + Symbol: "blob_links_link_id", + Columns: []*schema.Column{BlobLinksColumns[1]}, + + RefColumns: []*schema.Column{BlobsColumns[0]}, + OnDelete: schema.Cascade, + }, + }, + } // GroupUsersColumns holds the columns for the "group_users" table. GroupUsersColumns = []*schema.Column{ {Name: "group_id", Type: field.TypeInt}, @@ -132,14 +168,18 @@ var ( GroupsTable, PetsTable, UsersTable, + BlobLinksTable, GroupUsersTable, } ) func init() { + BlobsTable.ForeignKeys[0].RefTable = BlobsTable CarsTable.ForeignKeys[0].RefTable = PetsTable PetsTable.ForeignKeys[0].RefTable = UsersTable UsersTable.ForeignKeys[0].RefTable = UsersTable + BlobLinksTable.ForeignKeys[0].RefTable = BlobsTable + BlobLinksTable.ForeignKeys[1].RefTable = BlobsTable GroupUsersTable.ForeignKeys[0].RefTable = GroupsTable GroupUsersTable.ForeignKeys[1].RefTable = UsersTable } diff --git a/entc/integration/customid/ent/schema/blob.go b/entc/integration/customid/ent/schema/blob.go index c09ef4d51..022970e56 100644 --- a/entc/integration/customid/ent/schema/blob.go +++ b/entc/integration/customid/ent/schema/blob.go @@ -6,6 +6,7 @@ package schema import ( "github.com/facebookincubator/ent" + "github.com/facebookincubator/ent/schema/edge" "github.com/facebookincubator/ent/schema/field" "github.com/google/uuid" @@ -24,3 +25,12 @@ func (Blob) Fields() []ent.Field { Default(uuid.New), } } + +// Edges of the Blob. +func (Blob) Edges() []ent.Edge { + return []ent.Edge{ + edge.To("parent", Blob.Type). + Unique(), + edge.To("links", Blob.Type), + } +}