diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 0f6f7ced2..ff7cf5390 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -779,7 +779,7 @@ func templateDialectSqlUpdateTmpl() (*asset, error) { return a, nil } -var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\x5f\x6f\xe3\xb8\x11\x7f\xb6\x3e\xc5\x9c\xe0\x2b\xec\xc0\xa1\xb6\xf7\xd6\x6d\x53\x60\xbb\xd9\x03\x0c\x14\xdb\x3f\xc9\xa2\x0f\x8b\x45\x42\x8b\x23\x89\x0d\x45\xfa\x48\xca\x89\x21\xe8\xbb\x17\x43\x4a\x8a\x64\xfb\xae\xb9\x7d\xb2\xcc\x19\xce\x0c\x7f\x33\x9c\xf9\xb1\x6d\xb3\xab\xe4\xa3\xd9\x1f\xad\x2c\x2b\x0f\x3f\xbd\xfb\xe3\x9f\xae\xf7\x16\x1d\x6a\x0f\x3f\xf3\x1c\x77\xc6\x3c\xc1\x56\xe7\x0c\x3e\x28\x05\x41\xc9\x01\xc9\xed\x01\x05\x4b\xee\x2b\xe9\xc0\x99\xc6\xe6\x08\xb9\x11\x08\xd2\x81\x92\x39\x6a\x87\x02\x1a\x2d\xd0\x82\xaf\x10\x3e\xec\x79\x5e\x21\xfc\xc4\xde\x0d\x52\x28\x4c\xa3\x45\x22\x75\x90\xff\x7d\xfb\xf1\xd3\xe7\xbb\x4f\x50\x48\x85\xd0\xaf\x59\x63\x3c\x08\x69\x31\xf7\xc6\x1e\xc1\x14\xe0\x27\xce\xbc\x45\x64\xc9\x55\xd6\x75\x49\xd2\xb6\x20\xb0\x90\x1a\x21\xad\x8d\x40\x95\x42\xbf\xba\xdc\x3f\x95\xf0\xfe\x06\x76\xdc\x21\x2c\xd9\x47\xa3\x0b\x59\xb2\x7f\xf2\xfc\x89\x97\x48\x4a\x6d\x0b\x1e\xeb\xbd\xe2\x1e\x21\xad\x90\x0b\xb4\x29\x2c\x87\xed\xaf\x22\x59\xef\x8d\xf5\x83\x28\xcb\x80\x8c\xb3\xcf\xbc\x26\x2b\x74\x66\x0a\x38\xf8\x06\xd4\x5e\xfa\x23\x14\x26\x9e\x7c\xa6\xe8\xf2\x0a\x6b\xce\x12\x7f\xdc\x9f\x4a\xbc\x6d\x72\x0f\x6d\xb2\xc8\x43\x90\x30\x73\x1f\x2c\x67\xa6\x96\xde\xf3\xd2\xf5\x61\x2c\xb2\x0c\xb6\xb7\x11\x17\x24\xb7\x2c\x59\x6c\x6f\xa3\xd9\xed\x2d\xbb\x27\x1f\x5d\x07\x8f\xff\x75\x46\xbf\x4f\xa5\xd8\xd0\x7e\xac\xf7\xfe\x98\x3e\x26\x8b\xb6\x05\xcb\x75\x89\xb0\x7c\xd8\xc0\xb2\x20\x94\x96\xec\x67\x89\x4a\x38\xb8\x26\xeb\x8b\xfe\x94\x05\xbb\x0b\xb1\x05\x19\x19\xac\x0c\xe9\x90\xcf\x03\x57\x0d\x0e\x01\xa4\x51\xb9\x3f\x50\x0a\x05\xe9\xb3\x04\x00\x60\x71\xd1\x4e\xdb\x82\x2c\xc2\x16\xa9\x14\xdf\x29\xda\x76\xd5\xb6\x80\x9a\xc4\x71\xcb\x70\x88\xa8\xab\x8d\x0f\x76\x50\x3b\xe9\xe5\x81\x24\x8f\x53\xd3\xf7\xbc\xec\x97\x50\x39\x8c\x46\x7e\x1b\xc4\xd1\x5d\x00\x84\x3e\xaf\xfb\xef\x09\x38\x18\xc1\xf9\x24\x4a\x1c\xb0\xa1\x5b\x03\xb2\xd4\xc6\x22\x94\xa8\xd1\x72\x2f\x75\x09\x28\x4a\x8c\x07\x77\x10\x4a\x93\x34\xaf\xe1\x59\xfa\x0a\x96\x38\x89\x32\x5a\x19\x20\xc6\x37\x42\x1c\x75\x87\x92\x21\x67\x0c\xee\x47\x25\x87\x1e\xbc\x01\x2d\xd5\x06\xb8\x16\xe0\x2a\xd3\x28\x01\x3b\x84\x66\x2f\xb8\x47\x01\x35\xd7\x0d\x57\xea\xc8\xc8\xf7\x45\xc7\x13\x9c\x91\x7d\xd1\xf2\x97\x86\x5c\x7d\xfd\x36\xe2\x74\x15\xb7\x51\x5e\xc6\x40\x1e\xa7\xa6\xfa\x1c\x84\x93\xcf\x00\x9d\x7e\x9f\x26\x25\x42\x96\x71\x21\xa4\x97\x46\x73\xd5\x97\x78\xbc\x86\x93\x54\x38\x6f\x2c\x5d\xdd\x90\x90\xbb\xfe\x4f\x6f\x74\xe9\xeb\xbd\x22\xc9\xde\x4a\xed\x0b\x48\x85\xe4\x0a\x73\x9f\xfd\xe8\x32\x81\xd4\x9c\x32\xa3\x31\x7d\x35\xd2\xef\x7b\x19\xa3\x89\x16\x96\x7d\x63\xe8\x0b\x23\xf4\x11\x8b\x39\xca\x03\xda\xe8\xf8\xdf\xc3\xbf\xee\x2c\xc0\x59\xad\x0c\x81\x15\x8d\xce\xc7\xc0\x20\xfd\x57\x83\xf6\x98\x9e\xa3\x9f\x8c\x57\x8e\xf4\xbb\x0e\x7e\x69\xd0\x4a\x74\xbf\x92\xfb\x69\x55\x0c\x02\x96\x2c\xc2\xe6\xd5\x2c\xe8\xae\x83\xab\xa9\xd6\x7a\xea\x65\xb5\x86\xd3\xa4\x76\x5d\x08\x91\xba\xd1\xc2\xa2\x6f\xac\x86\xd5\x1f\xa6\x06\x3e\x2a\x89\xda\xb7\x70\xe2\x85\xc5\xde\xd5\xad\xd9\xd4\xfe\x89\xd2\x3a\x59\xcc\xe0\xcd\x32\xf8\x12\xea\x13\xa2\x2b\x07\x1c\x76\x8d\x54\x34\x3a\xa8\x89\x86\xe2\xa5\xcb\x15\xba\xff\xfc\xb0\x59\x06\x9f\x8d\x47\xf0\x15\xf7\x1b\x38\x9a\x06\x34\xa2\xa0\x5b\x90\x73\xa5\xe6\xca\x5f\xf4\xb3\xe5\xfb\xd5\x1a\x76\x58\xd0\xb5\x25\x8d\xd1\x6c\x8d\xbe\x32\x62\x43\xc5\x7f\xe6\x86\xbc\x3c\x73\xd7\x87\x87\x02\x0a\x6b\x6a\xe0\xe0\x2d\xd7\x8e\xe7\x54\xb0\xf1\xc2\x51\x32\x26\x8b\x61\x53\x6e\x6a\x6a\x38\x28\xc0\x58\xb0\x46\x29\x14\xb0\xe3\xf9\x13\x4b\xde\x94\xa7\x88\xcc\x90\xa2\x61\x3d\xae\xfe\x43\x23\x65\xe8\xfb\x12\x34\x9a\x38\x4f\x4f\x9f\x93\x00\x17\x34\xe1\xc7\x0d\x23\x86\x26\x1b\x81\xfd\xff\x00\x01\x5e\x78\xb4\x20\xa3\x62\xae\x8c\x43\xb1\x21\xb3\xce\xc4\xfd\x94\x1e\x8d\x2f\x7e\xac\xf1\x67\xa9\x14\xf5\x2a\x7c\xc1\xbc\x21\xbc\x7c\x65\x4d\x53\x56\xc1\xb3\xb0\x21\xba\xe7\x4a\xe6\x15\xe4\x16\x79\x54\x98\xc1\xfd\x56\x44\x87\x32\x98\xad\x13\x90\xfe\x65\x03\xe6\x89\xee\xe9\x65\xd4\x58\x8c\x82\xad\xae\xfc\xcb\x6d\xf8\x5c\x27\x0b\x59\xc0\x0f\xe6\x29\xdc\x94\x3d\xd7\x32\x5f\xa5\x03\xed\xe8\xba\xf7\x67\x2c\x81\x1a\xeb\x0c\x27\x3e\xf0\x85\x34\x5c\x8b\xc5\x6f\x7a\x86\x1b\xf0\x2f\x4c\xd8\xc3\x98\xf4\x13\xf5\x3e\x75\x77\xde\x52\x61\xcb\x7a\xaf\xb0\x46\xed\x63\xf6\x8a\xda\xb3\x28\x41\xfb\x46\xac\xa2\xfa\x6a\x4d\xec\x84\x2c\xb6\xc9\x62\xd7\x04\xaa\xb0\x3b\x7a\x74\xec\x33\x3e\xff\xad\x29\x0a\xb4\x2b\x2d\xd5\x3a\x08\xd9\x7f\xac\xf4\xd8\x6f\x4c\xa7\xe6\x56\xe9\x05\x8d\x10\x54\xec\xd7\xab\x54\x8a\x9b\x1f\x0f\xe9\xe6\x0c\xfe\xed\xed\x7a\x9d\x84\x41\xda\x37\x5a\x79\xc6\x58\xc6\x51\x1b\x19\xc5\x94\x21\xd0\xac\x3b\x0b\x6c\x03\x33\xb6\x72\xd3\xb6\xe3\xd4\xf8\x8b\x1b\x36\xff\x95\x78\x24\x45\x1d\x2c\xf7\x94\x22\x8e\xce\xeb\x73\xea\x42\x02\x2a\x87\xc3\xa5\x0a\xba\x44\x80\xfe\x0c\x07\xf8\xe1\x86\xe6\x75\x28\x9f\x0b\x61\xce\xd0\x39\x0d\x39\x40\x75\x75\x20\x68\x16\x8b\xc5\x18\xd7\x24\xcc\xef\xb0\xf7\x96\xb8\xa3\xc7\xe0\xab\xa7\x4e\xb3\x3f\xd3\xef\x33\xdc\xd7\x04\x67\x5f\xbc\x24\x1c\x2a\x2c\x4e\xfa\x88\x2a\x91\xd7\xad\xeb\x8b\x38\xb6\x5f\x29\xc6\xe1\x40\xa5\x4c\x53\xd4\x62\xff\x4a\xe1\xa1\xdf\xf4\xb3\x70\x7b\x3b\xf0\xce\x37\x15\xb8\x14\xab\x75\xb0\xd6\x26\x0b\x29\x36\xf0\x40\xb9\x73\xde\xe6\x46\x1f\xd8\x07\x6f\xe4\xa9\x01\xaa\xc5\xf1\x00\x52\x24\x5d\x32\x39\x6e\x60\x0a\x8e\xde\x37\x61\xd8\xab\xc6\x72\x35\x1f\x23\xaf\x0a\xb1\x1f\x70\xd8\x73\xeb\x42\x01\xc5\x65\x53\x9c\x4c\xb8\xf1\xa5\x30\x6e\xfb\xfa\x6d\x76\x88\xdf\xc3\x90\x02\x0f\xc5\x17\x4f\xf1\x2e\x21\xbd\x23\x93\xe9\xab\xe9\xc8\xd9\xde\x40\xa3\x6a\xae\x8f\x27\x3c\xea\x12\x91\x62\x53\x5e\x3d\xe7\x54\x97\xb3\x33\x3d\xe7\x1a\x62\xef\x5b\xe5\x45\xd9\x7f\xae\x29\x4d\x44\x09\x1e\x24\xc5\x17\x0f\x7d\x66\xa3\x3f\xc5\x64\xed\xeb\x83\xfc\xd6\x77\x52\xb8\x81\xbc\x28\xa9\xd5\x9e\x50\xbc\xec\x0a\x3e\xbc\xd2\x52\x72\x12\x1e\x0a\x54\x82\xf1\x69\x76\x4d\x8f\x06\x16\x59\xfd\xe9\x7b\x73\xf2\xa8\x08\x4f\x8a\xc8\xf7\xd9\x3d\x2f\x89\x52\xb9\xfe\x4d\x32\x69\x5e\x9e\xe2\x67\x51\x99\xf8\x36\x2d\xc3\xbb\x1e\x82\xd7\xf7\x8f\xa7\x21\x92\x5e\xa7\xe3\xe2\xe3\x54\xfc\x6b\xc1\x87\xf9\x9a\x73\x4d\xd3\xd4\x1c\xd0\x5a\x29\x50\xd0\xa3\xda\xd8\xf0\x1c\x37\xc0\x85\x80\x57\xae\x3d\x3c\x58\xbc\x89\x53\x9e\xe7\x15\x50\xd9\xb1\xcb\x67\xbd\xc0\xd5\x29\x1c\xd4\xa2\xeb\xfe\x17\x00\x00\xff\xff\x29\x5b\xef\x79\x4d\x10\x00\x00") +var _templateEntTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x58\x5f\x6f\xe3\x38\x0e\x7f\x8e\x3f\x05\xd7\xc8\xdc\x26\x41\x2a\xcf\xed\xdb\xcd\x5d\x0f\xe8\xb6\x33\x40\x80\xc3\xdc\x9f\x76\x70\x0f\x83\xc1\x54\xb5\x68\x5b\x57\x5b\xca\x4a\x72\xda\xc0\xf0\x77\x3f\x50\xb2\x1d\x3b\x49\xbb\x9d\x7d\xaa\x23\x51\x3f\x92\x3f\x52\x14\xd9\xa6\x49\x56\xd1\xb5\xde\xee\x8d\xcc\x0b\x07\xbf\xbc\xff\xf3\x5f\x2e\xb6\x06\x2d\x2a\x07\x9f\x78\x8a\x0f\x5a\x3f\xc2\x46\xa5\x0c\xae\xca\x12\xbc\x90\x05\xda\x37\x3b\x14\x2c\xba\x2b\xa4\x05\xab\x6b\x93\x22\xa4\x5a\x20\x48\x0b\xa5\x4c\x51\x59\x14\x50\x2b\x81\x06\x5c\x81\x70\xb5\xe5\x69\x81\xf0\x0b\x7b\xdf\xef\x42\xa6\x6b\x25\x22\xa9\xfc\xfe\x3f\x36\xd7\x1f\x3f\xdf\x7e\x84\x4c\x96\x08\xdd\x9a\xd1\xda\x81\x90\x06\x53\xa7\xcd\x1e\x74\x06\x6e\xa4\xcc\x19\x44\x16\xad\x92\xb6\x8d\xa2\xa6\x01\x81\x99\x54\x08\x71\xa5\x05\x96\x31\x74\xab\xf3\xed\x63\x0e\x1f\x2e\xe1\x81\x5b\x84\x39\xbb\xd6\x2a\x93\x39\xfb\x17\x4f\x1f\x79\x8e\x24\xd4\x34\xe0\xb0\xda\x96\xdc\x21\xc4\x05\x72\x81\x26\x86\x79\x7f\xfc\xb0\x25\xab\xad\x36\xae\xdf\x4a\x12\x20\x70\xf6\x99\x57\x84\x42\x3e\x93\xc1\x5e\x37\xa0\x72\xd2\xed\x21\xd3\xc1\xf3\x89\xa0\x4d\x0b\xac\x38\x8b\xdc\x7e\x7b\xbc\xe3\x4c\x9d\x3a\x68\xa2\x59\xea\x8d\x84\x89\x7a\x8f\x9c\xe8\x4a\x3a\xc7\x73\xdb\x99\x31\x4b\x12\xd8\xdc\x04\x5e\x90\xd4\xb2\x68\xb6\xb9\x09\xb0\x9b\x1b\x76\x47\x3a\xda\x16\xee\xff\x67\xb5\xfa\x10\x4b\xb1\xa6\xf3\x58\x6d\xdd\x3e\xbe\x8f\x66\x4d\x03\x86\xab\x1c\x61\xfe\x7d\x0d\xf3\x8c\x58\x9a\xb3\x4f\x12\x4b\x61\xe1\x82\xd0\x67\x9d\x97\x19\xbb\xf5\xb6\xf9\x3d\x02\x2c\x34\xc9\x90\xce\x1d\x2f\x6b\xec\x0d\x88\x83\x70\xe7\x50\x0c\x19\xc9\xb3\x08\x00\x60\x76\x16\xa7\x69\x40\x66\xfe\x88\x2c\x4b\xfe\x50\xd2\xb1\x55\xd3\x00\x2a\xda\x0e\x47\x7a\x27\x82\xac\xd2\xce\xe3\xa0\xb2\xd2\xc9\x1d\xed\xdc\x8f\xa1\xef\x78\xde\x2d\x61\x69\x31\x80\xbc\x4e\xe2\xa0\xce\x13\x42\x9f\x17\xdd\xf7\x88\x1c\x0c\xe4\x7c\x14\x39\xf6\xdc\xd0\xad\x01\x99\x2b\x6d\x10\x72\x54\x68\xb8\x93\x2a\x07\x14\x39\x06\xc7\x2d\xf8\xd4\x24\xc9\x0b\x78\x92\xae\x80\x39\x8e\xac\x0c\x28\x3d\xc5\xf8\x46\x8a\x83\x6c\x9f\x32\xa4\x8c\xc1\xdd\x20\x64\xd1\x81\xd3\xa0\x64\xb9\x06\xae\x04\xd8\x42\xd7\xa5\x80\x07\x84\x7a\x2b\xb8\x43\x01\x15\x57\x35\x2f\xcb\x3d\x23\xdd\x67\x15\x8f\x78\x46\xf6\x45\xc9\xdf\x6a\x52\xf5\xf5\xdb\xc0\xd3\x2a\x1c\xa3\xb8\x0c\x86\xdc\x8f\xa1\xba\x18\x78\xcf\x27\x84\x8e\xbf\x8f\x83\x12\x28\x4b\xb8\x10\xd2\x49\xad\x78\xd9\xa5\x78\xb8\x86\xa3\x50\x58\xa7\x0d\x5d\x5d\x1f\x90\xdb\xee\x47\x07\x3a\x77\xd5\xb6\xa4\x9d\xad\x91\xca\x65\x10\x0b\xc9\x4b\x4c\x5d\xf2\xce\x26\x02\xa9\x38\x25\x5a\x61\x7c\x00\xe9\xce\x3d\x0f\xd6\x04\x84\x79\x57\x18\xba\xc4\xf0\x75\xc4\x60\x8a\x72\x87\x26\x28\xfe\x4f\xff\xab\x3d\x31\x70\x92\x2b\xbd\x61\x59\xad\xd2\xc1\x30\x88\xff\x5d\xa3\xd9\xc7\xa7\xec\x47\xc3\x95\x23\xf9\xb6\x85\xdf\x6a\x34\x12\xed\x0b\xb1\x1f\x67\x45\xbf\xc1\xa2\x99\x3f\xbc\x98\x18\xdd\xb6\xb0\x1a\x4b\x2d\xc7\x5a\x16\x4b\x38\x0e\x6a\xdb\x7a\x13\xa9\x1a\xcd\x0c\xba\xda\x28\x58\xfc\x69\x0c\x70\x5d\x4a\x54\xae\x81\x23\x2d\x2c\xd4\xae\x76\xc9\xc6\xf8\x47\x42\xcb\x68\x36\xa1\x37\x49\xe0\x8b\xcf\x4f\x08\xaa\x2c\x70\x78\xa8\x65\x49\x4f\x07\x15\x51\x9f\xbc\x74\xb9\x7c\xf5\x9f\x3a\x9b\x24\xf0\x59\x3b\x04\x57\x70\xb7\x86\xbd\xae\x41\x21\x0a\xba\x05\x29\x2f\xcb\xa9\xf0\x17\xf5\x64\xf8\x76\xb1\x84\x07\xcc\xe8\xda\x92\xc4\x00\x5b\xa1\x2b\xb4\x58\x53\xf2\x9f\xa8\x21\x2d\x4f\xdc\x76\xe6\xa1\x80\xcc\xe8\x0a\x38\x38\xc3\x95\xe5\x29\x25\x6c\xb8\x70\x14\x8c\xd1\xa2\x3f\x94\xea\x8a\x0a\x0e\x0a\xd0\x06\x8c\x2e\x4b\x14\xf0\xc0\xd3\x47\x16\xbd\x29\x4e\x81\x99\x3e\x44\xfd\x7a\x58\xfd\xa7\x42\x8a\xd0\x1f\x0b\xd0\x00\x71\x1a\x9e\x2e\x26\x9e\x2e\xa8\xfd\x1f\xdb\x3f\x31\xf4\xb2\x11\xd9\xbf\x47\x08\xf0\xcc\xa1\x01\x19\x04\xd3\x52\x5b\x14\x6b\x82\xb5\x3a\x9c\xa7\xf0\x28\x7c\x76\x43\x8e\x3f\xc9\xb2\xa4\x5a\x85\xcf\x98\xd6\xc4\x97\x2b\x8c\xae\xf3\xc2\x6b\x16\xc6\x5b\xf7\x54\xc8\xb4\x80\xd4\x20\x0f\x02\x13\xba\xdf\xca\x68\x9f\x06\x93\x75\x22\xd2\x3d\xaf\x41\x3f\xd2\x3d\x3d\xcf\x1a\x0b\x56\xb0\xc5\xca\x3d\xdf\xf8\xcf\x65\x34\x93\x19\xfc\xa4\x1f\xfd\x4d\xd9\x72\x25\xd3\x45\xdc\xb7\x1d\x6d\xfb\xe1\xa4\x4b\xa0\xc2\x3a\xe1\x89\xf7\xfd\x42\xec\xaf\xc5\xec\x55\xcd\x70\x09\xee\x99\x09\xb3\x1b\x82\x7e\x24\xde\x85\xee\xd6\x19\x4a\x6c\x59\x6d\x4b\xac\x50\xb9\x10\xbd\xac\x72\x2c\xec\xa0\x79\x23\x57\x41\x7c\xb1\xa4\xee\x84\x10\x9b\x68\xb6\xe3\x66\xb8\x9d\x61\xd5\xb2\x5f\xc3\xef\x68\xd6\x6d\xb0\xff\x1a\xe9\xb0\x3b\x1c\x8f\x21\x17\xe4\xe6\x39\x29\x6f\x5c\xa8\xdb\x8b\x58\x8a\xcb\x77\xbb\x78\x7d\x12\x86\xcd\xcd\x72\x19\xf9\x07\xb5\x2b\xb8\xf2\xa4\x73\x19\x9e\xdc\xd0\x59\x8c\x3b\x05\x7a\xf3\xce\x1a\xb8\x86\x49\xe7\x72\xf9\x37\xdb\x9f\xfa\x3b\x99\xeb\xe1\xba\x7e\x22\xbc\x9b\x17\x30\xb7\xd9\xf8\xa1\x79\x67\xd9\x3b\x6a\x28\x06\x63\x4f\x9a\x9d\xfe\xe0\x49\xc3\x43\x1b\x94\x44\xbb\x3e\xef\x6c\x06\x6d\xfb\x57\xd8\xc1\x4f\x97\xf4\x94\xfb\xcc\x7a\xab\xe5\xde\xdc\x89\xa6\x8d\xbd\x93\xd5\xa0\xe7\x3c\xcc\x8e\x7d\xd2\xa6\xe2\x6e\xe1\x64\x85\xec\xea\xf3\xed\xe6\x7a\x39\x02\xf2\xae\xf7\x68\x5d\x6a\xbd\x8a\xb7\xda\x1d\x9f\x7e\x55\x7c\x12\x7a\x1f\xf7\xd5\x6e\xa2\x5f\xf5\x04\xce\x06\x1a\xc7\xa8\x3f\xc2\xcc\x8b\xc4\x9c\x03\x19\xa2\xf1\x22\x3f\xbf\x47\xcf\xab\xa8\x47\x10\xaf\x9d\x39\xa5\xe8\x80\x32\x82\x51\xe3\x4c\x1b\x7e\x8d\x7f\x8c\xbf\x27\x8a\x7e\xdd\x3b\x5c\xfc\xbc\xfc\x79\x39\x94\x96\x7e\xbb\xaf\x01\xa1\x17\x0b\xf4\xd1\x78\x31\x76\x36\x49\x40\x8a\xe1\xf9\xa6\x62\x43\x7d\x8e\xc1\x6e\x8e\xe4\xfe\x45\xe8\xba\x95\xcd\x4d\x3f\x19\xbc\xa9\x04\x49\xb1\x58\x7a\xb4\x26\x9a\x49\xb1\x86\xef\x74\x4f\xac\x33\xa9\x56\x3b\x76\xe5\xb4\x3c\x06\xa0\x2a\x31\x38\x21\x45\xd4\x46\x23\xa7\x7d\x2f\x67\x69\x02\xf5\xd7\xb7\xac\x0d\x2f\xa7\x0f\xfd\x41\x20\x54\x6c\x0e\x5b\x6e\xac\xbf\xac\x61\x59\x67\x47\x3d\xc8\x30\xcb\x0d\xc7\xbe\x7e\x9b\x38\xf1\x23\x3d\xac\x9f\x14\xf0\xd9\x91\xbd\x73\x88\x6f\x09\x32\x3e\x40\x87\xae\xfa\x0d\x8d\x6e\xc5\xd5\xfe\xa8\xd3\x3d\xd7\xea\xb2\xf1\xe4\x33\xed\x7a\xcf\x47\x67\xec\xe7\x12\xc2\xeb\xb4\x48\xb3\xbc\xfb\x5c\x52\x98\xa8\x69\xfb\x2e\xc9\xbe\xe0\xf4\x09\x46\xe7\xc5\x68\xed\xeb\x77\xf9\xad\x7b\xeb\xe0\x12\xd2\x2c\xa7\xc7\xf0\xa8\x09\x4f\x56\x70\x75\x18\x1c\x48\x89\x1f\xe5\x28\x05\xc3\xf0\x7c\x41\x63\x1d\x0b\x73\xd7\xf1\x7f\x04\x46\x63\x9f\x1f\xfa\xc2\x44\xc6\xee\x78\x4e\x4d\xaf\xed\xa6\xc6\xd1\xb3\xe2\xc8\x7e\x16\x84\x69\x22\xa2\x65\x78\xdf\x51\x70\x98\x50\x1d\x3d\xf3\xf1\x45\x3c\x2c\xde\x8f\xb7\x5f\x32\xde\x77\x40\x29\x57\xd4\xef\xe8\x1d\x1a\x23\x05\x0a\x90\x0a\xb4\xf1\xff\x30\xd1\xc0\x85\x80\xc3\x34\xd4\x8f\x94\x4e\x87\x3e\x8c\xa7\x05\x50\xda\xb1\xf3\xbe\x9e\x99\xa6\xc8\x1c\x54\xa2\x6d\xa3\xff\x07\x00\x00\xff\xff\x81\x6b\x63\x9f\xf0\x11\x00\x00") func templateEntTmplBytes() ([]byte, error) { return bindataRead( @@ -794,7 +794,7 @@ func templateEntTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/ent.tmpl", size: 4173, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/ent.tmpl", size: 4592, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/ent.tmpl b/entc/gen/template/ent.tmpl index b6a400fe7..15137d668 100644 --- a/entc/gen/template/ent.tmpl +++ b/entc/gen/template/ent.tmpl @@ -65,24 +65,39 @@ func ({{ $receiver }} *{{ $.Name }}) Unwrap() *{{ $.Name }} { // String implements the fmt.Stringer. func ({{ $receiver }} *{{ $.Name }}) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("{{ $.Name }}(") - buf.WriteString(fmt.Sprintf("id=%v", {{ $receiver }}.ID)) + var builder strings.Builder + builder.WriteString("{{ $.Name }}(") + builder.WriteString(fmt.Sprintf("id=%v", {{ $receiver }}.ID)) {{- range $i, $f := $.Fields }} {{- if $f.Sensitive }} - buf.WriteString(", {{ $f.Name }}={{ printf "" }}") + builder.WriteString(", {{ $f.Name }}=") {{- else }} + {{- $sf := printf "%s.%s" $receiver $f.StructField }} {{- if $f.Nillable }} - if v := {{ $receiver }}.{{ $f.StructField }}; v != nil { - buf.WriteString(fmt.Sprintf(", {{ $f.Name }}=%v", *v)) + if v := {{ $sf }}; v != nil { + builder.WriteString(", {{ $f.Name }}=") + {{- if $f.IsTime }} + builder.WriteString(v.Format(time.ANSIC)) + {{- else if $f.IsString }} + builder.WriteString(*v) + {{- else }} + builder.WriteString(fmt.Sprintf("%v", *v)) + {{- end }} } {{- else }} - buf.WriteString(fmt.Sprintf(", {{ $f.Name }}=%v", {{ $receiver }}.{{ $f.StructField }})) + builder.WriteString(", {{ $f.Name }}=") + {{- if $f.IsTime }} + builder.WriteString({{ $sf }}.Format(time.ANSIC)) + {{- else if $f.IsString }} + builder.WriteString({{ $sf }}) + {{- else }} + builder.WriteString(fmt.Sprintf("%v", {{ $sf }})) + {{- end }} {{- end }} {{- end }} {{- end }} - buf.WriteString(")") - return buf.String() + builder.WriteByte(')') + return builder.String() } {{- if $.ID.IsString }} @@ -115,4 +130,4 @@ func ({{ $receiver }} {{ $slice }}) config(cfg config) { {{ define "model/omittags" }}{{ with $.TagTypes }}`{{ range $i, $t := . }}{{ if ne $i 0 }} {{ end }}{{ $t }}:"-"{{ end }}`{{ end }}{{ end }} {{/* A template that can be overrided in order to add additional fields to the each type.*/}} -{{ define "model/fields/additional" }}{{end}} \ No newline at end of file +{{ define "model/fields/additional" }}{{end}} diff --git a/entc/integration/config/ent/user.go b/entc/integration/config/ent/user.go index 5bd124326..c602468ea 100644 --- a/entc/integration/config/ent/user.go +++ b/entc/integration/config/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -55,11 +55,11 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/entc/integration/ent/card.go b/entc/integration/ent/card.go index 92e7d23e8..c6cb8980d 100644 --- a/entc/integration/ent/card.go +++ b/entc/integration/ent/card.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "time" "github.com/facebookincubator/ent/dialect/gremlin" @@ -103,14 +103,17 @@ func (c *Card) Unwrap() *Card { // String implements the fmt.Stringer. func (c *Card) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Card(") - buf.WriteString(fmt.Sprintf("id=%v", c.ID)) - buf.WriteString(fmt.Sprintf(", created_at=%v", c.CreatedAt)) - buf.WriteString(fmt.Sprintf(", updated_at=%v", c.UpdatedAt)) - buf.WriteString(fmt.Sprintf(", number=%v", c.Number)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Card(") + builder.WriteString(fmt.Sprintf("id=%v", c.ID)) + builder.WriteString(", created_at=") + builder.WriteString(c.CreatedAt.Format(time.ANSIC)) + builder.WriteString(", updated_at=") + builder.WriteString(c.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(", number=") + builder.WriteString(c.Number) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/comment.go b/entc/integration/ent/comment.go index 062d7b50e..57d24ff57 100644 --- a/entc/integration/ent/comment.go +++ b/entc/integration/ent/comment.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -97,16 +97,19 @@ func (c *Comment) Unwrap() *Comment { // String implements the fmt.Stringer. func (c *Comment) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Comment(") - buf.WriteString(fmt.Sprintf("id=%v", c.ID)) - buf.WriteString(fmt.Sprintf(", unique_int=%v", c.UniqueInt)) - buf.WriteString(fmt.Sprintf(", unique_float=%v", c.UniqueFloat)) + var builder strings.Builder + builder.WriteString("Comment(") + builder.WriteString(fmt.Sprintf("id=%v", c.ID)) + builder.WriteString(", unique_int=") + builder.WriteString(fmt.Sprintf("%v", c.UniqueInt)) + builder.WriteString(", unique_float=") + builder.WriteString(fmt.Sprintf("%v", c.UniqueFloat)) if v := c.NillableInt; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int=%v", *v)) + builder.WriteString(", nillable_int=") + builder.WriteString(fmt.Sprintf("%v", *v)) } - buf.WriteString(")") - return buf.String() + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/fieldtype.go b/entc/integration/ent/fieldtype.go index 34d319e67..fbcbc1e7b 100644 --- a/entc/integration/ent/fieldtype.go +++ b/entc/integration/ent/fieldtype.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -208,38 +208,55 @@ func (ft *FieldType) Unwrap() *FieldType { // String implements the fmt.Stringer. func (ft *FieldType) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("FieldType(") - buf.WriteString(fmt.Sprintf("id=%v", ft.ID)) - buf.WriteString(fmt.Sprintf(", int=%v", ft.Int)) - buf.WriteString(fmt.Sprintf(", int8=%v", ft.Int8)) - buf.WriteString(fmt.Sprintf(", int16=%v", ft.Int16)) - buf.WriteString(fmt.Sprintf(", int32=%v", ft.Int32)) - buf.WriteString(fmt.Sprintf(", int64=%v", ft.Int64)) - buf.WriteString(fmt.Sprintf(", optional_int=%v", ft.OptionalInt)) - buf.WriteString(fmt.Sprintf(", optional_int8=%v", ft.OptionalInt8)) - buf.WriteString(fmt.Sprintf(", optional_int16=%v", ft.OptionalInt16)) - buf.WriteString(fmt.Sprintf(", optional_int32=%v", ft.OptionalInt32)) - buf.WriteString(fmt.Sprintf(", optional_int64=%v", ft.OptionalInt64)) + var builder strings.Builder + builder.WriteString("FieldType(") + builder.WriteString(fmt.Sprintf("id=%v", ft.ID)) + builder.WriteString(", int=") + builder.WriteString(fmt.Sprintf("%v", ft.Int)) + builder.WriteString(", int8=") + builder.WriteString(fmt.Sprintf("%v", ft.Int8)) + builder.WriteString(", int16=") + builder.WriteString(fmt.Sprintf("%v", ft.Int16)) + builder.WriteString(", int32=") + builder.WriteString(fmt.Sprintf("%v", ft.Int32)) + builder.WriteString(", int64=") + builder.WriteString(fmt.Sprintf("%v", ft.Int64)) + builder.WriteString(", optional_int=") + builder.WriteString(fmt.Sprintf("%v", ft.OptionalInt)) + builder.WriteString(", optional_int8=") + builder.WriteString(fmt.Sprintf("%v", ft.OptionalInt8)) + builder.WriteString(", optional_int16=") + builder.WriteString(fmt.Sprintf("%v", ft.OptionalInt16)) + builder.WriteString(", optional_int32=") + builder.WriteString(fmt.Sprintf("%v", ft.OptionalInt32)) + builder.WriteString(", optional_int64=") + builder.WriteString(fmt.Sprintf("%v", ft.OptionalInt64)) if v := ft.NillableInt; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int=%v", *v)) + builder.WriteString(", nillable_int=") + builder.WriteString(fmt.Sprintf("%v", *v)) } if v := ft.NillableInt8; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int8=%v", *v)) + builder.WriteString(", nillable_int8=") + builder.WriteString(fmt.Sprintf("%v", *v)) } if v := ft.NillableInt16; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int16=%v", *v)) + builder.WriteString(", nillable_int16=") + builder.WriteString(fmt.Sprintf("%v", *v)) } if v := ft.NillableInt32; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int32=%v", *v)) + builder.WriteString(", nillable_int32=") + builder.WriteString(fmt.Sprintf("%v", *v)) } if v := ft.NillableInt64; v != nil { - buf.WriteString(fmt.Sprintf(", nillable_int64=%v", *v)) + builder.WriteString(", nillable_int64=") + builder.WriteString(fmt.Sprintf("%v", *v)) } - buf.WriteString(fmt.Sprintf(", validate_optional_int32=%v", ft.ValidateOptionalInt32)) - buf.WriteString(fmt.Sprintf(", state=%v", ft.State)) - buf.WriteString(")") - return buf.String() + builder.WriteString(", validate_optional_int32=") + builder.WriteString(fmt.Sprintf("%v", ft.ValidateOptionalInt32)) + builder.WriteString(", state=") + builder.WriteString(fmt.Sprintf("%v", ft.State)) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/file.go b/entc/integration/ent/file.go index e736693da..019abaaec 100644 --- a/entc/integration/ent/file.go +++ b/entc/integration/ent/file.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -114,17 +114,21 @@ func (f *File) Unwrap() *File { // String implements the fmt.Stringer. func (f *File) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("File(") - buf.WriteString(fmt.Sprintf("id=%v", f.ID)) - buf.WriteString(fmt.Sprintf(", size=%v", f.Size)) - buf.WriteString(fmt.Sprintf(", name=%v", f.Name)) + var builder strings.Builder + builder.WriteString("File(") + builder.WriteString(fmt.Sprintf("id=%v", f.ID)) + builder.WriteString(", size=") + builder.WriteString(fmt.Sprintf("%v", f.Size)) + builder.WriteString(", name=") + builder.WriteString(f.Name) if v := f.User; v != nil { - buf.WriteString(fmt.Sprintf(", user=%v", *v)) + builder.WriteString(", user=") + builder.WriteString(*v) } - buf.WriteString(fmt.Sprintf(", group=%v", f.Group)) - buf.WriteString(")") - return buf.String() + builder.WriteString(", group=") + builder.WriteString(f.Group) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/filetype.go b/entc/integration/ent/filetype.go index 8f2aaba40..5a04399ae 100644 --- a/entc/integration/ent/filetype.go +++ b/entc/integration/ent/filetype.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -85,12 +85,13 @@ func (ft *FileType) Unwrap() *FileType { // String implements the fmt.Stringer. func (ft *FileType) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("FileType(") - buf.WriteString(fmt.Sprintf("id=%v", ft.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", ft.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("FileType(") + builder.WriteString(fmt.Sprintf("id=%v", ft.ID)) + builder.WriteString(", name=") + builder.WriteString(ft.Name) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/group.go b/entc/integration/ent/group.go index 49234320b..80eff1469 100644 --- a/entc/integration/ent/group.go +++ b/entc/integration/ent/group.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "time" "github.com/facebookincubator/ent/dialect/gremlin" @@ -132,18 +132,23 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(fmt.Sprintf(", active=%v", gr.Active)) - buf.WriteString(fmt.Sprintf(", expire=%v", gr.Expire)) + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteString(", active=") + builder.WriteString(fmt.Sprintf("%v", gr.Active)) + builder.WriteString(", expire=") + builder.WriteString(gr.Expire.Format(time.ANSIC)) if v := gr.Type; v != nil { - buf.WriteString(fmt.Sprintf(", type=%v", *v)) + builder.WriteString(", type=") + builder.WriteString(*v) } - buf.WriteString(fmt.Sprintf(", max_users=%v", gr.MaxUsers)) - buf.WriteString(fmt.Sprintf(", name=%v", gr.Name)) - buf.WriteString(")") - return buf.String() + builder.WriteString(", max_users=") + builder.WriteString(fmt.Sprintf("%v", gr.MaxUsers)) + builder.WriteString(", name=") + builder.WriteString(gr.Name) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/groupinfo.go b/entc/integration/ent/groupinfo.go index 130001226..48697db5a 100644 --- a/entc/integration/ent/groupinfo.go +++ b/entc/integration/ent/groupinfo.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -92,13 +92,15 @@ func (gi *GroupInfo) Unwrap() *GroupInfo { // String implements the fmt.Stringer. func (gi *GroupInfo) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("GroupInfo(") - buf.WriteString(fmt.Sprintf("id=%v", gi.ID)) - buf.WriteString(fmt.Sprintf(", desc=%v", gi.Desc)) - buf.WriteString(fmt.Sprintf(", max_users=%v", gi.MaxUsers)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("GroupInfo(") + builder.WriteString(fmt.Sprintf("id=%v", gi.ID)) + builder.WriteString(", desc=") + builder.WriteString(gi.Desc) + builder.WriteString(", max_users=") + builder.WriteString(fmt.Sprintf("%v", gi.MaxUsers)) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/item.go b/entc/integration/ent/item.go index 1469c5720..11536f942 100644 --- a/entc/integration/ent/item.go +++ b/entc/integration/ent/item.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -73,11 +73,11 @@ func (i *Item) Unwrap() *Item { // String implements the fmt.Stringer. func (i *Item) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Item(") - buf.WriteString(fmt.Sprintf("id=%v", i.ID)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Item(") + builder.WriteString(fmt.Sprintf("id=%v", i.ID)) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/node.go b/entc/integration/ent/node.go index 6997b41ec..b131ff841 100644 --- a/entc/integration/ent/node.go +++ b/entc/integration/ent/node.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -90,12 +90,13 @@ func (n *Node) Unwrap() *Node { // String implements the fmt.Stringer. func (n *Node) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Node(") - buf.WriteString(fmt.Sprintf("id=%v", n.ID)) - buf.WriteString(fmt.Sprintf(", value=%v", n.Value)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Node(") + builder.WriteString(fmt.Sprintf("id=%v", n.ID)) + builder.WriteString(", value=") + builder.WriteString(fmt.Sprintf("%v", n.Value)) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/pet.go b/entc/integration/ent/pet.go index eb9ae2551..b492da6ba 100644 --- a/entc/integration/ent/pet.go +++ b/entc/integration/ent/pet.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -90,12 +90,13 @@ func (pe *Pet) Unwrap() *Pet { // String implements the fmt.Stringer. func (pe *Pet) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Pet(") - buf.WriteString(fmt.Sprintf("id=%v", pe.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", pe.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Pet(") + builder.WriteString(fmt.Sprintf("id=%v", pe.ID)) + builder.WriteString(", name=") + builder.WriteString(pe.Name) + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/ent/user.go b/entc/integration/ent/user.go index d68641684..1d8994470 100644 --- a/entc/integration/ent/user.go +++ b/entc/integration/ent/user.go @@ -7,9 +7,9 @@ package ent import ( - "bytes" "fmt" "strconv" + "strings" "github.com/facebookincubator/ent/dialect/gremlin" "github.com/facebookincubator/ent/dialect/sql" @@ -170,17 +170,22 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(fmt.Sprintf(", last=%v", u.Last)) - buf.WriteString(fmt.Sprintf(", nickname=%v", u.Nickname)) - buf.WriteString(fmt.Sprintf(", phone=%v", u.Phone)) - buf.WriteString(", password=") - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteString(", last=") + builder.WriteString(u.Last) + builder.WriteString(", nickname=") + builder.WriteString(u.Nickname) + builder.WriteString(", phone=") + builder.WriteString(u.Phone) + builder.WriteString(", password=") + builder.WriteByte(')') + return builder.String() } // id returns the int representation of the ID field. diff --git a/entc/integration/idtype/ent/user.go b/entc/integration/idtype/ent/user.go index 486794d54..740d4a3eb 100644 --- a/entc/integration/idtype/ent/user.go +++ b/entc/integration/idtype/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -75,12 +75,13 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/entc/integration/json/ent/user.go b/entc/integration/json/ent/user.go index 25618af6e..8ee524822 100644 --- a/entc/integration/json/ent/user.go +++ b/entc/integration/json/ent/user.go @@ -7,11 +7,11 @@ package ent import ( - "bytes" "encoding/json" "fmt" "net/http" "net/url" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -112,17 +112,23 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", url=%v", u.URL)) - buf.WriteString(fmt.Sprintf(", raw=%v", u.Raw)) - buf.WriteString(fmt.Sprintf(", dirs=%v", u.Dirs)) - buf.WriteString(fmt.Sprintf(", ints=%v", u.Ints)) - buf.WriteString(fmt.Sprintf(", floats=%v", u.Floats)) - buf.WriteString(fmt.Sprintf(", strings=%v", u.Strings)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", url=") + builder.WriteString(fmt.Sprintf("%v", u.URL)) + builder.WriteString(", raw=") + builder.WriteString(fmt.Sprintf("%v", u.Raw)) + builder.WriteString(", dirs=") + builder.WriteString(fmt.Sprintf("%v", u.Dirs)) + builder.WriteString(", ints=") + builder.WriteString(fmt.Sprintf("%v", u.Ints)) + builder.WriteString(", floats=") + builder.WriteString(fmt.Sprintf("%v", u.Floats)) + builder.WriteString(", strings=") + builder.WriteString(fmt.Sprintf("%v", u.Strings)) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/entc/integration/migrate/entv1/user.go b/entc/integration/migrate/entv1/user.go index 870653f56..712b7f172 100644 --- a/entc/integration/migrate/entv1/user.go +++ b/entc/integration/migrate/entv1/user.go @@ -7,8 +7,8 @@ package entv1 import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" "github.com/facebookincubator/ent/entc/integration/migrate/entv1/user" @@ -86,17 +86,23 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(fmt.Sprintf(", address=%v", u.Address)) - buf.WriteString(fmt.Sprintf(", renamed=%v", u.Renamed)) - buf.WriteString(fmt.Sprintf(", blob=%v", u.Blob)) - buf.WriteString(fmt.Sprintf(", state=%v", u.State)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteString(", address=") + builder.WriteString(u.Address) + builder.WriteString(", renamed=") + builder.WriteString(u.Renamed) + builder.WriteString(", blob=") + builder.WriteString(fmt.Sprintf("%v", u.Blob)) + builder.WriteString(", state=") + builder.WriteString(fmt.Sprintf("%v", u.State)) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/entc/integration/migrate/entv2/group.go b/entc/integration/migrate/entv2/group.go index f793c481e..f2e010c69 100644 --- a/entc/integration/migrate/entv2/group.go +++ b/entc/integration/migrate/entv2/group.go @@ -7,8 +7,8 @@ package entv2 import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -55,11 +55,11 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteByte(')') + return builder.String() } // Groups is a parsable slice of Group. diff --git a/entc/integration/migrate/entv2/pet.go b/entc/integration/migrate/entv2/pet.go index e9f9d6b17..994b2136c 100644 --- a/entc/integration/migrate/entv2/pet.go +++ b/entc/integration/migrate/entv2/pet.go @@ -7,8 +7,8 @@ package entv2 import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -55,11 +55,11 @@ func (pe *Pet) Unwrap() *Pet { // String implements the fmt.Stringer. func (pe *Pet) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Pet(") - buf.WriteString(fmt.Sprintf("id=%v", pe.ID)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Pet(") + builder.WriteString(fmt.Sprintf("id=%v", pe.ID)) + builder.WriteByte(')') + return builder.String() } // Pets is a parsable slice of Pet. diff --git a/entc/integration/migrate/entv2/user.go b/entc/integration/migrate/entv2/user.go index 56de11542..25e48cc69 100644 --- a/entc/integration/migrate/entv2/user.go +++ b/entc/integration/migrate/entv2/user.go @@ -7,8 +7,8 @@ package entv2 import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" "github.com/facebookincubator/ent/entc/integration/migrate/entv2/user" @@ -96,19 +96,27 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(fmt.Sprintf(", phone=%v", u.Phone)) - buf.WriteString(fmt.Sprintf(", buffer=%v", u.Buffer)) - buf.WriteString(fmt.Sprintf(", title=%v", u.Title)) - buf.WriteString(fmt.Sprintf(", new_name=%v", u.NewName)) - buf.WriteString(fmt.Sprintf(", blob=%v", u.Blob)) - buf.WriteString(fmt.Sprintf(", state=%v", u.State)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteString(", phone=") + builder.WriteString(u.Phone) + builder.WriteString(", buffer=") + builder.WriteString(fmt.Sprintf("%v", u.Buffer)) + builder.WriteString(", title=") + builder.WriteString(u.Title) + builder.WriteString(", new_name=") + builder.WriteString(u.NewName) + builder.WriteString(", blob=") + builder.WriteString(fmt.Sprintf("%v", u.Blob)) + builder.WriteString(", state=") + builder.WriteString(fmt.Sprintf("%v", u.State)) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/entc/integration/template/ent/group.go b/entc/integration/template/ent/group.go index 0433a054e..8b6abef29 100644 --- a/entc/integration/template/ent/group.go +++ b/entc/integration/template/ent/group.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -60,12 +60,13 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(fmt.Sprintf(", max_users=%v", gr.MaxUsers)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteString(", max_users=") + builder.WriteString(fmt.Sprintf("%v", gr.MaxUsers)) + builder.WriteByte(')') + return builder.String() } // Groups is a parsable slice of Group. diff --git a/entc/integration/template/ent/pet.go b/entc/integration/template/ent/pet.go index de2704585..a2145d730 100644 --- a/entc/integration/template/ent/pet.go +++ b/entc/integration/template/ent/pet.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "time" "github.com/facebookincubator/ent/dialect/sql" @@ -74,15 +74,17 @@ func (pe *Pet) Unwrap() *Pet { // String implements the fmt.Stringer. func (pe *Pet) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Pet(") - buf.WriteString(fmt.Sprintf("id=%v", pe.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", pe.Age)) + var builder strings.Builder + builder.WriteString("Pet(") + builder.WriteString(fmt.Sprintf("id=%v", pe.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", pe.Age)) if v := pe.LicensedAt; v != nil { - buf.WriteString(fmt.Sprintf(", licensed_at=%v", *v)) + builder.WriteString(", licensed_at=") + builder.WriteString(v.Format(time.ANSIC)) } - buf.WriteString(")") - return buf.String() + builder.WriteByte(')') + return builder.String() } // Pets is a parsable slice of Pet. diff --git a/entc/integration/template/ent/user.go b/entc/integration/template/ent/user.go index 3af85d0a7..33c1ef7e7 100644 --- a/entc/integration/template/ent/user.go +++ b/entc/integration/template/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,12 +70,13 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/edgeindex/ent/city.go b/examples/edgeindex/ent/city.go index 927fa649d..79bafc514 100644 --- a/examples/edgeindex/ent/city.go +++ b/examples/edgeindex/ent/city.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -65,12 +65,13 @@ func (c *City) Unwrap() *City { // String implements the fmt.Stringer. func (c *City) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("City(") - buf.WriteString(fmt.Sprintf("id=%v", c.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", c.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("City(") + builder.WriteString(fmt.Sprintf("id=%v", c.ID)) + builder.WriteString(", name=") + builder.WriteString(c.Name) + builder.WriteByte(')') + return builder.String() } // Cities is a parsable slice of City. diff --git a/examples/edgeindex/ent/street.go b/examples/edgeindex/ent/street.go index c9c6f64eb..3e21e6ea7 100644 --- a/examples/edgeindex/ent/street.go +++ b/examples/edgeindex/ent/street.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -65,12 +65,13 @@ func (s *Street) Unwrap() *Street { // String implements the fmt.Stringer. func (s *Street) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Street(") - buf.WriteString(fmt.Sprintf("id=%v", s.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", s.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Street(") + builder.WriteString(fmt.Sprintf("id=%v", s.ID)) + builder.WriteString(", name=") + builder.WriteString(s.Name) + builder.WriteByte(')') + return builder.String() } // Streets is a parsable slice of Street. diff --git a/examples/entcpkg/ent/user.go b/examples/entcpkg/ent/user.go index 5bd124326..c602468ea 100644 --- a/examples/entcpkg/ent/user.go +++ b/examples/entcpkg/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -55,11 +55,11 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/m2m2types/ent/group.go b/examples/m2m2types/ent/group.go index 03f7eb285..381c34baf 100644 --- a/examples/m2m2types/ent/group.go +++ b/examples/m2m2types/ent/group.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -65,12 +65,13 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", gr.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteString(", name=") + builder.WriteString(gr.Name) + builder.WriteByte(')') + return builder.String() } // Groups is a parsable slice of Group. diff --git a/examples/m2m2types/ent/user.go b/examples/m2m2types/ent/user.go index 8eb266207..30dd93d50 100644 --- a/examples/m2m2types/ent/user.go +++ b/examples/m2m2types/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,13 +70,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/m2mbidi/ent/user.go b/examples/m2mbidi/ent/user.go index 34ebd9955..df4d8707a 100644 --- a/examples/m2mbidi/ent/user.go +++ b/examples/m2mbidi/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,13 +70,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/m2mrecur/ent/user.go b/examples/m2mrecur/ent/user.go index 11c8bb5c2..9ef05438c 100644 --- a/examples/m2mrecur/ent/user.go +++ b/examples/m2mrecur/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -75,13 +75,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/o2m2types/ent/pet.go b/examples/o2m2types/ent/pet.go index c150305a8..af895849f 100644 --- a/examples/o2m2types/ent/pet.go +++ b/examples/o2m2types/ent/pet.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -65,12 +65,13 @@ func (pe *Pet) Unwrap() *Pet { // String implements the fmt.Stringer. func (pe *Pet) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Pet(") - buf.WriteString(fmt.Sprintf("id=%v", pe.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", pe.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Pet(") + builder.WriteString(fmt.Sprintf("id=%v", pe.ID)) + builder.WriteString(", name=") + builder.WriteString(pe.Name) + builder.WriteByte(')') + return builder.String() } // Pets is a parsable slice of Pet. diff --git a/examples/o2m2types/ent/user.go b/examples/o2m2types/ent/user.go index 94c8cd6dd..a1617faf5 100644 --- a/examples/o2m2types/ent/user.go +++ b/examples/o2m2types/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,13 +70,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/o2mrecur/ent/node.go b/examples/o2mrecur/ent/node.go index 536846af0..39da90e83 100644 --- a/examples/o2mrecur/ent/node.go +++ b/examples/o2mrecur/ent/node.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,12 +70,13 @@ func (n *Node) Unwrap() *Node { // String implements the fmt.Stringer. func (n *Node) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Node(") - buf.WriteString(fmt.Sprintf("id=%v", n.ID)) - buf.WriteString(fmt.Sprintf(", value=%v", n.Value)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Node(") + builder.WriteString(fmt.Sprintf("id=%v", n.ID)) + builder.WriteString(", value=") + builder.WriteString(fmt.Sprintf("%v", n.Value)) + builder.WriteByte(')') + return builder.String() } // Nodes is a parsable slice of Node. diff --git a/examples/o2o2types/ent/card.go b/examples/o2o2types/ent/card.go index 1e1dfcd2e..33d79d8dd 100644 --- a/examples/o2o2types/ent/card.go +++ b/examples/o2o2types/ent/card.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "time" "github.com/facebookincubator/ent/dialect/sql" @@ -71,13 +71,15 @@ func (c *Card) Unwrap() *Card { // String implements the fmt.Stringer. func (c *Card) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Card(") - buf.WriteString(fmt.Sprintf("id=%v", c.ID)) - buf.WriteString(fmt.Sprintf(", expired=%v", c.Expired)) - buf.WriteString(fmt.Sprintf(", number=%v", c.Number)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Card(") + builder.WriteString(fmt.Sprintf("id=%v", c.ID)) + builder.WriteString(", expired=") + builder.WriteString(c.Expired.Format(time.ANSIC)) + builder.WriteString(", number=") + builder.WriteString(c.Number) + builder.WriteByte(')') + return builder.String() } // Cards is a parsable slice of Card. diff --git a/examples/o2o2types/ent/user.go b/examples/o2o2types/ent/user.go index 63ba658e1..b1e9538a5 100644 --- a/examples/o2o2types/ent/user.go +++ b/examples/o2o2types/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,13 +70,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/o2obidi/ent/user.go b/examples/o2obidi/ent/user.go index 67befccb8..b6ab7f1ac 100644 --- a/examples/o2obidi/ent/user.go +++ b/examples/o2obidi/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,13 +70,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/o2orecur/ent/node.go b/examples/o2orecur/ent/node.go index ffb20f13f..0dbb3dbd5 100644 --- a/examples/o2orecur/ent/node.go +++ b/examples/o2orecur/ent/node.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,12 +70,13 @@ func (n *Node) Unwrap() *Node { // String implements the fmt.Stringer. func (n *Node) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Node(") - buf.WriteString(fmt.Sprintf("id=%v", n.ID)) - buf.WriteString(fmt.Sprintf(", value=%v", n.Value)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Node(") + builder.WriteString(fmt.Sprintf("id=%v", n.ID)) + builder.WriteString(", value=") + builder.WriteString(fmt.Sprintf("%v", n.Value)) + builder.WriteByte(')') + return builder.String() } // Nodes is a parsable slice of Node. diff --git a/examples/start/ent/car.go b/examples/start/ent/car.go index 3614f32c4..745f8dd10 100644 --- a/examples/start/ent/car.go +++ b/examples/start/ent/car.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "time" "github.com/facebookincubator/ent/dialect/sql" @@ -71,13 +71,15 @@ func (c *Car) Unwrap() *Car { // String implements the fmt.Stringer. func (c *Car) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Car(") - buf.WriteString(fmt.Sprintf("id=%v", c.ID)) - buf.WriteString(fmt.Sprintf(", model=%v", c.Model)) - buf.WriteString(fmt.Sprintf(", registered_at=%v", c.RegisteredAt)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Car(") + builder.WriteString(fmt.Sprintf("id=%v", c.ID)) + builder.WriteString(", model=") + builder.WriteString(c.Model) + builder.WriteString(", registered_at=") + builder.WriteString(c.RegisteredAt.Format(time.ANSIC)) + builder.WriteByte(')') + return builder.String() } // Cars is a parsable slice of Car. diff --git a/examples/start/ent/group.go b/examples/start/ent/group.go index 03f7eb285..381c34baf 100644 --- a/examples/start/ent/group.go +++ b/examples/start/ent/group.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -65,12 +65,13 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", gr.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteString(", name=") + builder.WriteString(gr.Name) + builder.WriteByte(')') + return builder.String() } // Groups is a parsable slice of Group. diff --git a/examples/start/ent/user.go b/examples/start/ent/user.go index ea6921b57..5678af7c4 100644 --- a/examples/start/ent/user.go +++ b/examples/start/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -75,13 +75,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User. diff --git a/examples/traversal/ent/group.go b/examples/traversal/ent/group.go index 1ad5fb182..8e4db36ad 100644 --- a/examples/traversal/ent/group.go +++ b/examples/traversal/ent/group.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,12 +70,13 @@ func (gr *Group) Unwrap() *Group { // String implements the fmt.Stringer. func (gr *Group) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Group(") - buf.WriteString(fmt.Sprintf("id=%v", gr.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", gr.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Group(") + builder.WriteString(fmt.Sprintf("id=%v", gr.ID)) + builder.WriteString(", name=") + builder.WriteString(gr.Name) + builder.WriteByte(')') + return builder.String() } // Groups is a parsable slice of Group. diff --git a/examples/traversal/ent/pet.go b/examples/traversal/ent/pet.go index fef711de8..4a3bbe0b4 100644 --- a/examples/traversal/ent/pet.go +++ b/examples/traversal/ent/pet.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -70,12 +70,13 @@ func (pe *Pet) Unwrap() *Pet { // String implements the fmt.Stringer. func (pe *Pet) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("Pet(") - buf.WriteString(fmt.Sprintf("id=%v", pe.ID)) - buf.WriteString(fmt.Sprintf(", name=%v", pe.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("Pet(") + builder.WriteString(fmt.Sprintf("id=%v", pe.ID)) + builder.WriteString(", name=") + builder.WriteString(pe.Name) + builder.WriteByte(')') + return builder.String() } // Pets is a parsable slice of Pet. diff --git a/examples/traversal/ent/user.go b/examples/traversal/ent/user.go index 350078fdc..818549297 100644 --- a/examples/traversal/ent/user.go +++ b/examples/traversal/ent/user.go @@ -7,8 +7,8 @@ package ent import ( - "bytes" "fmt" + "strings" "github.com/facebookincubator/ent/dialect/sql" ) @@ -85,13 +85,15 @@ func (u *User) Unwrap() *User { // String implements the fmt.Stringer. func (u *User) String() string { - buf := bytes.NewBuffer(nil) - buf.WriteString("User(") - buf.WriteString(fmt.Sprintf("id=%v", u.ID)) - buf.WriteString(fmt.Sprintf(", age=%v", u.Age)) - buf.WriteString(fmt.Sprintf(", name=%v", u.Name)) - buf.WriteString(")") - return buf.String() + var builder strings.Builder + builder.WriteString("User(") + builder.WriteString(fmt.Sprintf("id=%v", u.ID)) + builder.WriteString(", age=") + builder.WriteString(fmt.Sprintf("%v", u.Age)) + builder.WriteString(", name=") + builder.WriteString(u.Name) + builder.WriteByte(')') + return builder.String() } // Users is a parsable slice of User.