entc: improve numeric addition api

Reviewed By: alexsn

Differential Revision: D17474547

fbshipit-source-id: 08e367793faac76eb0cece880259a49a8bcbc95b
This commit is contained in:
Ariel Mashraki
2019-09-19 04:58:21 -07:00
committed by Facebook Github Bot
parent bc5e8316dd
commit bf913111fd
14 changed files with 351 additions and 59 deletions

View File

@@ -197,7 +197,7 @@ func templateBuilderQueryTmpl() (*asset, error) {
return a, nil
}
var _templateBuilderSetterTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x4b\x6f\xe3\x36\x17\x5d\x4b\xbf\xe2\x7e\x82\xbf\x42\x32\x26\xcc\xcc\xec\x5a\xc0\x8b\x34\x4e\x00\x03\x6d\x66\xe1\x99\x55\x10\x14\x8a\x78\xe9\xb0\xa3\x90\x1a\x92\x72\x1b\xb8\xfa\xef\x05\x1f\x7a\x58\x96\x63\x67\xda\xee\x64\xf2\xbe\x78\xcf\xe1\xb9\xf4\x6e\x77\x39\x8f\xaf\x65\xf5\xa2\xf8\xe6\xc9\xc0\xc7\xf7\x1f\x7e\xbc\xa8\x14\x6a\x14\x06\x6e\xf3\x02\x1f\xa5\xfc\x0a\x2b\x51\x10\xb8\x2a\x4b\x70\x46\x1a\xec\xbe\xda\x22\x25\xf1\xe7\x27\xae\x41\xcb\x5a\x15\x08\x85\xa4\x08\x5c\x43\xc9\x0b\x14\x1a\x29\xd4\x82\xa2\x02\xf3\x84\x70\x55\xe5\xc5\x13\xc2\x47\xf2\xbe\xdd\x05\x26\x6b\x41\x63\x2e\xdc\xfe\x2f\xab\xeb\x9b\xbb\xf5\x0d\x30\x5e\x22\x84\x35\x25\xa5\x01\xca\x15\x16\x46\xaa\x17\x90\x0c\xcc\x20\x99\x51\x88\x24\x9e\x5f\x36\x4d\x1c\xef\x76\x40\x91\x71\x81\x90\x68\x34\x06\x55\x02\x4d\x63\x57\x67\x8f\x35\x2f\x6d\x0d\x3f\x2d\xa0\xca\x75\x91\x97\x30\x23\xeb\x42\x56\x48\x7e\x0e\x3b\xc1\x50\x61\x81\x7c\xeb\x2d\xbb\xef\xce\x3d\x18\x31\x8e\x25\xd5\xd6\x64\x46\x6e\xfd\x77\xd8\xa9\x2b\x9a\x1b\xef\xcd\xf2\x52\xa3\x5f\xbf\x00\xce\x40\x2a\x48\x9f\x72\xbd\xae\x19\xe3\x7f\xf6\x21\x93\x2f\xce\x25\xc9\x5e\xdb\xfd\x24\xac\x41\xd3\xc4\xd1\x30\xc9\x02\x8c\xaa\xb1\x5b\x0e\x55\xd9\xa2\x7e\xad\x4d\xfe\x58\xe2\xb0\xb6\x0b\x40\x41\x21\x74\x49\xe5\x62\x83\x30\xfb\xed\x1d\xcc\x98\x3b\x06\xeb\x2c\x5d\xa8\x6a\xff\xf8\x8c\x7c\x7e\xa9\x90\xac\x8d\xe2\x62\xd3\xe7\xab\x45\xe1\x1a\xaa\xb8\x30\x90\xac\xd1\x24\x90\xb6\xdd\x65\xe4\x2e\x7f\x46\x5f\xf3\xe5\x25\x74\xf6\x4d\x03\x1a\x8d\x76\xc0\xba\x45\x67\x67\x97\x5d\x09\x24\x8e\x9c\x59\xba\x87\x45\xd3\xc0\x7c\x88\x62\xd3\x64\xc3\x88\xa9\x2f\xb9\x69\x42\x44\x5b\xac\xb3\x19\x39\xc1\x2e\x8e\xa2\x51\x60\xe2\x5d\xd6\x46\xd5\x85\x71\xfd\xb2\x86\x0b\xf8\xa1\x8d\x19\x47\x91\x42\x53\x2b\x01\x23\xcf\x38\x6a\x62\xdb\x88\xcb\x39\xe4\x5b\xc9\x29\x6c\x50\xa0\x32\xb6\x43\x82\x97\xa5\xed\x3f\x78\x16\x6a\x60\x52\xf5\x8b\xe6\xa5\x42\x4d\xc0\x51\xd6\x96\xc3\x19\xe4\x82\x42\x2a\xa4\xe9\x5a\x7d\x17\x8c\x33\x48\xa5\x03\xe0\x53\x65\xb8\x14\xbe\xb3\x4b\x64\x79\x5d\x9a\xcc\xbb\xa4\xd6\xb9\xe3\xc4\x8c\x11\x4f\x99\xd6\xc8\x43\xe0\x8e\xdd\x56\x70\x7b\x00\x5c\x9b\xee\x08\x80\x2d\x82\x7b\x01\x4e\x20\x69\x8f\x65\xb7\x36\x7c\x8b\x02\xb6\x79\x59\x3b\x4d\xb0\x15\x0b\x5e\x92\x38\x7a\x0b\xd0\xa3\xc4\x3d\xe0\xf3\x33\x10\x8f\x38\x83\xce\xe1\x7f\x0b\x9b\xde\xaf\x4f\x73\x21\xa4\x98\xb7\x2e\x99\x35\xb5\x4d\x38\xca\x83\xc8\xe3\xd8\xde\xaf\x01\xa6\x1d\x9c\xf5\x33\x2a\x5e\xf4\x30\x75\x98\x8c\x2e\xd1\x15\xa5\x27\x30\x68\x6f\x51\x4e\xa9\xee\x8f\x65\xe4\x3e\x06\x6f\xec\xef\xf7\x5c\xa4\x83\xee\xe5\x94\x9e\x71\x99\xbe\xaf\x8b\x3d\xfd\x4f\x75\xf0\xba\xc4\x5c\x9d\xd9\xc3\xc2\xda\x7a\x06\x7b\x82\x4a\xf6\xaf\xb4\xf1\xcc\x86\x1d\xe9\x96\xe0\xe5\x94\xb5\x2b\xf6\x88\x8b\x9d\x03\xe7\xf7\x76\xd0\xe5\xfd\x59\x80\x7e\xa4\xdd\xd0\x0d\xf6\xb3\x40\xba\x61\x90\xe4\x96\x99\x4d\xe3\x51\x99\x21\xf9\x22\xf8\x37\x37\x7c\x82\xcd\xc2\xcd\xdc\x60\x12\xc2\x3b\x7f\x4e\xf5\xbe\xe0\x74\xd0\xc8\x2a\x83\x54\x73\xb1\xa9\xcb\x5c\xd9\x98\xae\xeb\x7f\x85\x09\x9d\x41\xb2\x5a\xea\xe3\x39\xdb\xb8\xd3\x61\xdb\x1f\x18\xe0\x4f\x56\xcb\x51\x6d\x81\x0b\x6d\x98\x40\x7a\x69\x69\xda\x8b\x1a\x76\xa2\x86\x74\x83\xed\x35\xc3\x70\xab\xc3\xd6\xe3\x0b\x70\xea\x8b\x74\x1a\x3e\x28\x54\x77\x09\xdf\x36\xd9\xfa\xaa\xd2\xc3\xd3\xbb\x64\xe8\x5f\x17\x9c\x6a\x20\x84\x74\x69\x9c\x37\x59\x2d\x5f\xbf\xbb\x41\x11\xc7\x64\xc4\x03\x66\x0d\xd4\xf2\x3c\x07\x78\xce\xbf\x62\xfa\x9c\x57\xf7\xa3\x42\x1e\xb4\xb3\xdc\x39\x3d\x0d\x77\x77\xef\x5c\x17\x5e\x1e\xce\x49\x73\xcf\xe9\x03\x2c\xa0\x8d\xb8\xf3\xe1\x2e\x7c\x4f\x42\x1c\x3b\x72\xb9\x7b\xc6\x38\x7e\xdb\x3e\x1d\x17\xfd\x89\x04\xfa\x9e\x3f\x1c\x24\x89\xba\x4c\x81\x44\xaf\xbc\x0d\x86\x02\xd6\x1d\x72\x86\xbd\x94\x1d\xcc\xe5\xd5\x52\x9f\x35\x9a\x47\x9c\x3e\x9c\xcf\x6d\xa0\xf1\x88\x3e\x9f\xcd\xff\xc9\xf4\xee\xcb\x4a\x39\xf5\xa6\x27\x99\x6a\xa9\xca\xe9\xf1\xb1\xed\x38\x37\x05\xe9\xe0\x06\xcd\x39\x7d\xeb\x10\xef\x5f\xc1\xa5\xfc\x03\x15\xa4\x0e\x10\x06\xc9\xff\xc9\x07\x9d\xec\xf5\xac\x7b\x97\x73\x06\xf8\xcd\x7a\xed\x75\xc4\x07\x5a\x40\xb2\x4d\xc2\xcf\x61\x0a\xf6\x8a\x32\x8e\xe1\x9e\x78\x4a\x9f\x54\xac\xdd\x6e\x2c\x4a\x43\x4d\x9a\x66\xc0\x3f\x7f\x83\x4f\x08\xe1\x50\xa3\xe6\xa3\x9c\xaf\x3c\xd5\xa7\x14\x62\x1a\xc1\x31\xe8\x6d\x3d\x64\xb5\xcc\x26\xe4\x81\xfb\xff\x6f\x4e\xad\xee\x1f\x46\x54\x7c\x07\x25\x8a\x2e\x42\x96\xb5\xba\xe4\xf4\x24\xe1\xfd\x4c\xb2\x78\x73\x6f\xe5\xf7\x17\x90\xfc\x3e\x98\x33\x03\x2d\xf2\xfb\x4d\xd3\x4b\x52\xdf\x31\xc7\x6a\x2b\x39\xad\xd1\x43\x20\xb5\xdd\xee\x17\xc9\x6a\x79\x82\xc6\xe3\x26\x70\xaa\x09\x21\xd9\x48\xb4\x86\x2f\x80\xfe\xeb\xef\x00\x00\x00\xff\xff\xd0\x77\xaf\x9a\x01\x10\x00\x00")
var _templateBuilderSetterTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x4b\x8f\xdb\x36\x10\x3e\x4b\xbf\x62\x2a\xb8\x85\xe4\x66\xb9\x49\x6e\x2d\xe0\xc3\x36\x4e\x00\x03\xed\xe6\xe0\xe4\xb4\x58\x14\x5a\x71\xe4\x65\xa3\x25\x15\x92\x72\xbb\x70\xf5\xdf\x0b\xbe\x24\x59\x96\x1f\x9b\xb6\x37\x9b\x9c\xf7\x7c\xf3\x71\xb4\xdb\x5d\xcf\xe3\x77\xa2\x7e\x96\x6c\xf3\xa8\xe1\xed\xeb\x37\x3f\x5d\xd5\x12\x15\x72\x0d\x1f\xf2\x02\x1f\x84\xf8\x02\x2b\x5e\x10\xb8\xa9\x2a\xb0\x42\x0a\xcc\xbd\xdc\x22\x25\xf1\xa7\x47\xa6\x40\x89\x46\x16\x08\x85\xa0\x08\x4c\x41\xc5\x0a\xe4\x0a\x29\x34\x9c\xa2\x04\xfd\x88\x70\x53\xe7\xc5\x23\xc2\x5b\xf2\x3a\xdc\x42\x29\x1a\x4e\x63\xc6\xed\xfd\xaf\xab\x77\xef\x6f\xd7\xef\xa1\x64\x15\x82\x3f\x93\x42\x68\xa0\x4c\x62\xa1\x85\x7c\x06\x51\x82\x1e\x38\xd3\x12\x91\xc4\xf3\xeb\xb6\x8d\xe3\xdd\x0e\x28\x96\x8c\x23\x24\x0a\xb5\x46\x99\x40\xdb\x9a\xd3\xd9\x43\xc3\x2a\x13\xc3\xcf\x0b\xa8\x73\x55\xe4\x15\xcc\xc8\xba\x10\x35\x92\x5f\xfc\x8d\x17\x94\x58\x20\xdb\x3a\xc9\xee\x77\xa7\xee\x85\x4a\x86\x15\x55\x46\x64\x46\x3e\xb8\xdf\xfe\xa6\xa9\x69\xae\x9d\x76\x99\x57\x0a\xdd\xf9\x15\xb0\x12\x84\x84\xf4\x31\x57\xeb\xa6\x2c\xd9\x5f\xbd\xc9\xe4\xb3\x55\x49\xb2\x53\xb7\x1f\xb9\x11\x68\xdb\x38\x1a\x3a\x59\x80\x96\x0d\x76\xc7\x3e\x2a\x13\xd4\x6f\x8d\xce\x1f\x2a\x1c\xc6\x76\x05\xc8\x29\xf8\x2a\xc9\x9c\x6f\x10\x66\xbf\xbf\x82\x59\x69\xd3\x28\x3b\x49\x6b\xaa\xde\x4f\xbf\x24\x9f\x9e\x6b\x24\x6b\x2d\x19\xdf\xf4\xfe\x1a\x5e\xd8\x82\x4a\xc6\x35\x24\x6b\xd4\x09\xa4\xa1\xba\x25\xb9\xcd\x9f\xd0\xc5\x7c\x7d\x0d\x9d\x7c\xdb\x82\x42\xad\x6c\x63\xed\xa1\x95\x33\xc7\x36\x04\x12\x47\x56\x2c\xdd\xeb\x45\xdb\xc2\x7c\xd8\xc5\xb6\xcd\x86\x16\x53\x17\x72\xdb\x7a\x8b\x26\x58\x2b\x33\x52\x82\x5d\x1c\x45\x23\xc3\xc4\xa9\xac\xb5\x6c\x0a\x6d\xeb\x65\x04\x17\xf0\x43\xb0\x69\x55\xae\xe0\x7a\x6e\xe2\xd6\x26\x7f\xde\x3c\xa1\x64\x05\x68\xe3\x46\x6c\x51\x4a\x46\x11\x6a\x89\x5b\x26\x1a\x05\x45\x5e\x55\x0a\xb4\x80\x1b\x4a\x09\x58\x60\x3a\x13\xac\x84\x9c\xd3\xae\x9a\xb7\xde\x4c\xd7\x4e\x2b\x78\x10\x5f\x4e\xe9\x91\x10\x39\xab\xbc\x65\xdf\xd9\x28\x92\xa8\x1b\xc9\x61\x64\x23\x8e\xda\xd8\xb4\xec\x7a\x0e\xf9\x56\x30\x0a\x1b\xe4\x28\x5d\x2e\xac\xaa\x0c\x52\xc0\xcd\x8b\x82\x52\xc8\xfe\xd0\x64\xa8\x42\x0e\xbb\x5d\xc8\x20\xe5\x42\xf7\x69\x78\xe1\x0c\x52\x61\xa1\xf2\xb1\xd6\x4c\x70\x87\x81\x25\x96\x79\x53\xe9\xcc\xa9\xa4\x36\xfd\x90\xee\xac\x24\x0e\xdc\x41\x28\x0b\xd5\x86\x59\x88\xe0\xc3\x01\xc4\x82\xbb\x23\x50\x0b\x58\xdb\x33\x70\x06\x73\x26\x2d\x73\xb5\x61\x5b\xe4\xb0\xcd\xab\xc6\xb2\x97\x89\x98\xb3\x8a\xc4\xd1\x4b\x20\x39\x72\xdc\x43\x73\x7e\x01\x36\x23\x56\x42\xa7\xf0\x9d\xed\xb0\x3b\x9f\x46\xad\x77\x31\x0f\x2a\x99\x11\xb5\x20\x3a\x86\x83\xc8\xf5\x31\x30\xc1\xa0\xa7\xa7\x51\x39\x31\xee\x37\x94\x9e\xe9\x41\x98\xf7\x9c\x52\xd5\xa7\xa5\xc5\x7e\x0f\x5e\x58\xdf\x6f\x19\xf9\x50\xd6\x8b\xc6\xea\x54\xd5\x8f\xcf\xe2\x90\x2e\xa2\x16\xd0\x50\xbf\xb3\x31\xbf\xd4\xc8\x8f\x0b\xd8\x33\xf2\xcd\x7d\xec\x07\xf0\x5c\x0f\xdf\x55\x98\xcb\x0b\xbb\x58\x18\x59\x37\x43\x6e\x44\x44\xf9\x9f\x34\xf2\x48\xcb\x2e\xa4\x69\xc7\x81\x07\xd2\x36\xd8\x23\x2a\xe6\xcd\xbc\xbc\xb6\x83\x2a\xef\xbf\x9b\xe8\x9e\xff\xf7\x74\x83\xfd\xbb\x29\xec\xc3\x99\xe4\x66\x36\xda\xd6\x75\x65\x86\xe4\x33\x67\x5f\xed\x43\xed\x65\x16\x76\x3f\xf1\x22\x81\xbc\xcd\x1d\xa3\x6a\x9f\xf2\xba\xd6\x88\x3a\x83\x54\x31\xbe\x69\xaa\x5c\x1a\x9b\xb6\xea\x7f\xfb\x6d\x26\x83\x64\xb5\x54\xc7\x7d\x06\xbb\xd3\x66\xc3\x1f\xf4\xed\x4f\x56\xcb\x51\x6c\x1e\x0b\xc1\x8c\x1f\x3b\x61\xb0\xda\xd3\x2a\x76\xb4\x8a\x74\x83\x61\xd0\xd1\xf3\x8a\xbf\x7a\x78\x06\x46\x5d\x90\xf6\x15\x19\x04\xaa\x3a\x87\x2f\xdb\x02\xfa\xa8\xd2\xc3\xec\xad\x33\x74\x9b\x18\xa3\x0a\x08\x21\x9d\x1b\xab\x4d\x56\xcb\xd3\xec\x31\x41\x1e\x2e\xaf\x13\xcc\x71\x99\x02\x3c\xe5\x5f\x30\x7d\xca\xeb\xbb\x51\x20\xf7\xca\x4a\xee\x2c\xa3\xfb\xd9\xdd\xcb\xeb\x6a\x7a\x57\x98\x72\x73\xc7\xe8\x3d\x2c\x20\x58\xdc\x85\x6d\xc4\xd6\xc4\xdb\x31\x8f\x3e\xb3\x2b\x9f\xc5\xb7\xa9\xd3\xf1\x67\x67\xc2\x81\xba\x63\xf7\x07\x4e\xa2\xf6\xf2\xed\x64\x48\x60\x5d\x92\x33\xec\xa9\xec\x60\x33\x58\x2d\xd5\x45\xcb\xc1\x08\xd3\x87\x1b\x42\x30\x34\x5e\x12\x2e\x47\xf3\xff\xb2\x3f\xf4\x61\xa5\x8c\x3a\xd1\xb3\x48\x35\x50\x65\xf4\xf8\xe2\x60\x31\x37\xd5\xd2\xc1\x04\xcd\x19\x7d\xe9\x1a\xd1\x7f\x31\x54\xe2\x4f\x94\x90\xda\x86\x94\x90\x7c\x4f\xde\xa8\x64\xaf\x66\xdd\x37\x0c\x2b\x01\xbf\x1a\xad\xbd\x8a\x38\x43\x0b\x48\xb6\x89\xff\x3b\x74\x51\x9e\x60\xc6\x71\xbb\x27\x3e\x3b\xce\x32\xd6\x6e\x37\x26\xa5\x21\x27\x4d\x23\xe0\xdf\x7f\xaf\x4c\x10\xe1\x90\xa3\xe6\x23\x9f\x27\x3e\x6b\xa6\x18\x62\xba\x83\xe3\xa6\x87\x78\xc8\x6a\x99\x4d\xd0\x03\x73\xdf\xba\x96\xad\xee\xee\x47\x50\x7c\x05\x15\xf2\xce\x42\x96\x05\x5e\xb2\x7c\x92\xb0\xfe\x4d\x32\xfd\x66\x4e\xca\xdd\x2f\x20\xf9\x63\xf0\xce\x0c\xb8\xc8\xdd\xb7\x6d\x4f\x49\x7d\xc5\x2c\xaa\x0d\xe5\x04\xa1\x7b\xe8\x17\xa7\xfe\x90\xac\x96\x67\x60\x3c\x2e\x02\xa3\x8a\x10\x92\x8d\x48\x6b\xb8\x01\xf4\xbf\xfe\x09\x00\x00\xff\xff\x9f\x3d\x4f\x4f\x2d\x11\x00\x00")
func templateBuilderSetterTmplBytes() ([]byte, error) {
return bindataRead(
@@ -212,7 +212,7 @@ func templateBuilderSetterTmpl() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "template/builder/setter.tmpl", size: 4097, mode: os.FileMode(420), modTime: time.Unix(1568744710, 0)}
info := bindataFileInfo{name: "template/builder/setter.tmpl", size: 4397, mode: os.FileMode(420), modTime: time.Unix(1568886398, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}

View File

@@ -20,6 +20,10 @@ in the LICENSE file in the root directory of this source tree.
// {{ $func }} sets the {{ $f.Name }} field.
func ({{ $receiver }} *{{ $builder }}) {{ $func }}({{ $p }} {{ $f.Type }}) *{{ $builder }} {
{{ $receiver }}.{{ $f.StructField }} = &{{ $p }}
{{- /* setting numeric type override previous calls to Add. */}}
{{- if and $f.Type.Numeric $updater }}
{{ $receiver }}.add{{ $f.StructField }} = nil
{{- end }}
return {{ $receiver }}
}
@@ -39,7 +43,11 @@ in the LICENSE file in the root directory of this source tree.
{{ $func := print "Add" (pascal $f.Name) }}
// {{ $func }} adds {{ $p }} to {{ $f.Name }}.
func ({{ $receiver }} *{{ $builder }}) {{ $func }}({{ $p }} {{ $f.Type }}) *{{ $builder }} {
{{ $receiver }}.add{{ $f.StructField }} = &{{ $p }}
if {{ $receiver }}.add{{ $f.StructField }} == nil {
{{ $receiver }}.add{{ $f.StructField }} = &{{ $p }}
} else {
*{{ $receiver }}.add{{ $f.StructField }} += {{ $p }}
}
return {{ $receiver }}
}
{{ end }}

View File

@@ -44,30 +44,41 @@ func (cu *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate {
// SetUniqueInt sets the unique_int field.
func (cu *CommentUpdate) SetUniqueInt(i int) *CommentUpdate {
cu.unique_int = &i
cu.addunique_int = nil
return cu
}
// AddUniqueInt adds i to unique_int.
func (cu *CommentUpdate) AddUniqueInt(i int) *CommentUpdate {
cu.addunique_int = &i
if cu.addunique_int == nil {
cu.addunique_int = &i
} else {
*cu.addunique_int += i
}
return cu
}
// SetUniqueFloat sets the unique_float field.
func (cu *CommentUpdate) SetUniqueFloat(f float64) *CommentUpdate {
cu.unique_float = &f
cu.addunique_float = nil
return cu
}
// AddUniqueFloat adds f to unique_float.
func (cu *CommentUpdate) AddUniqueFloat(f float64) *CommentUpdate {
cu.addunique_float = &f
if cu.addunique_float == nil {
cu.addunique_float = &f
} else {
*cu.addunique_float += f
}
return cu
}
// SetNillableInt sets the nillable_int field.
func (cu *CommentUpdate) SetNillableInt(i int) *CommentUpdate {
cu.nillable_int = &i
cu.addnillable_int = nil
return cu
}
@@ -81,7 +92,11 @@ func (cu *CommentUpdate) SetNillableNillableInt(i *int) *CommentUpdate {
// AddNillableInt adds i to nillable_int.
func (cu *CommentUpdate) AddNillableInt(i int) *CommentUpdate {
cu.addnillable_int = &i
if cu.addnillable_int == nil {
cu.addnillable_int = &i
} else {
*cu.addnillable_int += i
}
return cu
}
@@ -292,30 +307,41 @@ type CommentUpdateOne struct {
// SetUniqueInt sets the unique_int field.
func (cuo *CommentUpdateOne) SetUniqueInt(i int) *CommentUpdateOne {
cuo.unique_int = &i
cuo.addunique_int = nil
return cuo
}
// AddUniqueInt adds i to unique_int.
func (cuo *CommentUpdateOne) AddUniqueInt(i int) *CommentUpdateOne {
cuo.addunique_int = &i
if cuo.addunique_int == nil {
cuo.addunique_int = &i
} else {
*cuo.addunique_int += i
}
return cuo
}
// SetUniqueFloat sets the unique_float field.
func (cuo *CommentUpdateOne) SetUniqueFloat(f float64) *CommentUpdateOne {
cuo.unique_float = &f
cuo.addunique_float = nil
return cuo
}
// AddUniqueFloat adds f to unique_float.
func (cuo *CommentUpdateOne) AddUniqueFloat(f float64) *CommentUpdateOne {
cuo.addunique_float = &f
if cuo.addunique_float == nil {
cuo.addunique_float = &f
} else {
*cuo.addunique_float += f
}
return cuo
}
// SetNillableInt sets the nillable_int field.
func (cuo *CommentUpdateOne) SetNillableInt(i int) *CommentUpdateOne {
cuo.nillable_int = &i
cuo.addnillable_int = nil
return cuo
}
@@ -329,7 +355,11 @@ func (cuo *CommentUpdateOne) SetNillableNillableInt(i *int) *CommentUpdateOne {
// AddNillableInt adds i to nillable_int.
func (cuo *CommentUpdateOne) AddNillableInt(i int) *CommentUpdateOne {
cuo.addnillable_int = &i
if cuo.addnillable_int == nil {
cuo.addnillable_int = &i
} else {
*cuo.addnillable_int += i
}
return cuo
}

View File

@@ -79,66 +79,92 @@ func (ftu *FieldTypeUpdate) Where(ps ...predicate.FieldType) *FieldTypeUpdate {
// SetInt sets the int field.
func (ftu *FieldTypeUpdate) SetInt(i int) *FieldTypeUpdate {
ftu.int = &i
ftu.addint = nil
return ftu
}
// AddInt adds i to int.
func (ftu *FieldTypeUpdate) AddInt(i int) *FieldTypeUpdate {
ftu.addint = &i
if ftu.addint == nil {
ftu.addint = &i
} else {
*ftu.addint += i
}
return ftu
}
// SetInt8 sets the int8 field.
func (ftu *FieldTypeUpdate) SetInt8(i int8) *FieldTypeUpdate {
ftu.int8 = &i
ftu.addint8 = nil
return ftu
}
// AddInt8 adds i to int8.
func (ftu *FieldTypeUpdate) AddInt8(i int8) *FieldTypeUpdate {
ftu.addint8 = &i
if ftu.addint8 == nil {
ftu.addint8 = &i
} else {
*ftu.addint8 += i
}
return ftu
}
// SetInt16 sets the int16 field.
func (ftu *FieldTypeUpdate) SetInt16(i int16) *FieldTypeUpdate {
ftu.int16 = &i
ftu.addint16 = nil
return ftu
}
// AddInt16 adds i to int16.
func (ftu *FieldTypeUpdate) AddInt16(i int16) *FieldTypeUpdate {
ftu.addint16 = &i
if ftu.addint16 == nil {
ftu.addint16 = &i
} else {
*ftu.addint16 += i
}
return ftu
}
// SetInt32 sets the int32 field.
func (ftu *FieldTypeUpdate) SetInt32(i int32) *FieldTypeUpdate {
ftu.int32 = &i
ftu.addint32 = nil
return ftu
}
// AddInt32 adds i to int32.
func (ftu *FieldTypeUpdate) AddInt32(i int32) *FieldTypeUpdate {
ftu.addint32 = &i
if ftu.addint32 == nil {
ftu.addint32 = &i
} else {
*ftu.addint32 += i
}
return ftu
}
// SetInt64 sets the int64 field.
func (ftu *FieldTypeUpdate) SetInt64(i int64) *FieldTypeUpdate {
ftu.int64 = &i
ftu.addint64 = nil
return ftu
}
// AddInt64 adds i to int64.
func (ftu *FieldTypeUpdate) AddInt64(i int64) *FieldTypeUpdate {
ftu.addint64 = &i
if ftu.addint64 == nil {
ftu.addint64 = &i
} else {
*ftu.addint64 += i
}
return ftu
}
// SetOptionalInt sets the optional_int field.
func (ftu *FieldTypeUpdate) SetOptionalInt(i int) *FieldTypeUpdate {
ftu.optional_int = &i
ftu.addoptional_int = nil
return ftu
}
@@ -152,7 +178,11 @@ func (ftu *FieldTypeUpdate) SetNillableOptionalInt(i *int) *FieldTypeUpdate {
// AddOptionalInt adds i to optional_int.
func (ftu *FieldTypeUpdate) AddOptionalInt(i int) *FieldTypeUpdate {
ftu.addoptional_int = &i
if ftu.addoptional_int == nil {
ftu.addoptional_int = &i
} else {
*ftu.addoptional_int += i
}
return ftu
}
@@ -166,6 +196,7 @@ func (ftu *FieldTypeUpdate) ClearOptionalInt() *FieldTypeUpdate {
// SetOptionalInt8 sets the optional_int8 field.
func (ftu *FieldTypeUpdate) SetOptionalInt8(i int8) *FieldTypeUpdate {
ftu.optional_int8 = &i
ftu.addoptional_int8 = nil
return ftu
}
@@ -179,7 +210,11 @@ func (ftu *FieldTypeUpdate) SetNillableOptionalInt8(i *int8) *FieldTypeUpdate {
// AddOptionalInt8 adds i to optional_int8.
func (ftu *FieldTypeUpdate) AddOptionalInt8(i int8) *FieldTypeUpdate {
ftu.addoptional_int8 = &i
if ftu.addoptional_int8 == nil {
ftu.addoptional_int8 = &i
} else {
*ftu.addoptional_int8 += i
}
return ftu
}
@@ -193,6 +228,7 @@ func (ftu *FieldTypeUpdate) ClearOptionalInt8() *FieldTypeUpdate {
// SetOptionalInt16 sets the optional_int16 field.
func (ftu *FieldTypeUpdate) SetOptionalInt16(i int16) *FieldTypeUpdate {
ftu.optional_int16 = &i
ftu.addoptional_int16 = nil
return ftu
}
@@ -206,7 +242,11 @@ func (ftu *FieldTypeUpdate) SetNillableOptionalInt16(i *int16) *FieldTypeUpdate
// AddOptionalInt16 adds i to optional_int16.
func (ftu *FieldTypeUpdate) AddOptionalInt16(i int16) *FieldTypeUpdate {
ftu.addoptional_int16 = &i
if ftu.addoptional_int16 == nil {
ftu.addoptional_int16 = &i
} else {
*ftu.addoptional_int16 += i
}
return ftu
}
@@ -220,6 +260,7 @@ func (ftu *FieldTypeUpdate) ClearOptionalInt16() *FieldTypeUpdate {
// SetOptionalInt32 sets the optional_int32 field.
func (ftu *FieldTypeUpdate) SetOptionalInt32(i int32) *FieldTypeUpdate {
ftu.optional_int32 = &i
ftu.addoptional_int32 = nil
return ftu
}
@@ -233,7 +274,11 @@ func (ftu *FieldTypeUpdate) SetNillableOptionalInt32(i *int32) *FieldTypeUpdate
// AddOptionalInt32 adds i to optional_int32.
func (ftu *FieldTypeUpdate) AddOptionalInt32(i int32) *FieldTypeUpdate {
ftu.addoptional_int32 = &i
if ftu.addoptional_int32 == nil {
ftu.addoptional_int32 = &i
} else {
*ftu.addoptional_int32 += i
}
return ftu
}
@@ -247,6 +292,7 @@ func (ftu *FieldTypeUpdate) ClearOptionalInt32() *FieldTypeUpdate {
// SetOptionalInt64 sets the optional_int64 field.
func (ftu *FieldTypeUpdate) SetOptionalInt64(i int64) *FieldTypeUpdate {
ftu.optional_int64 = &i
ftu.addoptional_int64 = nil
return ftu
}
@@ -260,7 +306,11 @@ func (ftu *FieldTypeUpdate) SetNillableOptionalInt64(i *int64) *FieldTypeUpdate
// AddOptionalInt64 adds i to optional_int64.
func (ftu *FieldTypeUpdate) AddOptionalInt64(i int64) *FieldTypeUpdate {
ftu.addoptional_int64 = &i
if ftu.addoptional_int64 == nil {
ftu.addoptional_int64 = &i
} else {
*ftu.addoptional_int64 += i
}
return ftu
}
@@ -274,6 +324,7 @@ func (ftu *FieldTypeUpdate) ClearOptionalInt64() *FieldTypeUpdate {
// SetNillableInt sets the nillable_int field.
func (ftu *FieldTypeUpdate) SetNillableInt(i int) *FieldTypeUpdate {
ftu.nillable_int = &i
ftu.addnillable_int = nil
return ftu
}
@@ -287,7 +338,11 @@ func (ftu *FieldTypeUpdate) SetNillableNillableInt(i *int) *FieldTypeUpdate {
// AddNillableInt adds i to nillable_int.
func (ftu *FieldTypeUpdate) AddNillableInt(i int) *FieldTypeUpdate {
ftu.addnillable_int = &i
if ftu.addnillable_int == nil {
ftu.addnillable_int = &i
} else {
*ftu.addnillable_int += i
}
return ftu
}
@@ -301,6 +356,7 @@ func (ftu *FieldTypeUpdate) ClearNillableInt() *FieldTypeUpdate {
// SetNillableInt8 sets the nillable_int8 field.
func (ftu *FieldTypeUpdate) SetNillableInt8(i int8) *FieldTypeUpdate {
ftu.nillable_int8 = &i
ftu.addnillable_int8 = nil
return ftu
}
@@ -314,7 +370,11 @@ func (ftu *FieldTypeUpdate) SetNillableNillableInt8(i *int8) *FieldTypeUpdate {
// AddNillableInt8 adds i to nillable_int8.
func (ftu *FieldTypeUpdate) AddNillableInt8(i int8) *FieldTypeUpdate {
ftu.addnillable_int8 = &i
if ftu.addnillable_int8 == nil {
ftu.addnillable_int8 = &i
} else {
*ftu.addnillable_int8 += i
}
return ftu
}
@@ -328,6 +388,7 @@ func (ftu *FieldTypeUpdate) ClearNillableInt8() *FieldTypeUpdate {
// SetNillableInt16 sets the nillable_int16 field.
func (ftu *FieldTypeUpdate) SetNillableInt16(i int16) *FieldTypeUpdate {
ftu.nillable_int16 = &i
ftu.addnillable_int16 = nil
return ftu
}
@@ -341,7 +402,11 @@ func (ftu *FieldTypeUpdate) SetNillableNillableInt16(i *int16) *FieldTypeUpdate
// AddNillableInt16 adds i to nillable_int16.
func (ftu *FieldTypeUpdate) AddNillableInt16(i int16) *FieldTypeUpdate {
ftu.addnillable_int16 = &i
if ftu.addnillable_int16 == nil {
ftu.addnillable_int16 = &i
} else {
*ftu.addnillable_int16 += i
}
return ftu
}
@@ -355,6 +420,7 @@ func (ftu *FieldTypeUpdate) ClearNillableInt16() *FieldTypeUpdate {
// SetNillableInt32 sets the nillable_int32 field.
func (ftu *FieldTypeUpdate) SetNillableInt32(i int32) *FieldTypeUpdate {
ftu.nillable_int32 = &i
ftu.addnillable_int32 = nil
return ftu
}
@@ -368,7 +434,11 @@ func (ftu *FieldTypeUpdate) SetNillableNillableInt32(i *int32) *FieldTypeUpdate
// AddNillableInt32 adds i to nillable_int32.
func (ftu *FieldTypeUpdate) AddNillableInt32(i int32) *FieldTypeUpdate {
ftu.addnillable_int32 = &i
if ftu.addnillable_int32 == nil {
ftu.addnillable_int32 = &i
} else {
*ftu.addnillable_int32 += i
}
return ftu
}
@@ -382,6 +452,7 @@ func (ftu *FieldTypeUpdate) ClearNillableInt32() *FieldTypeUpdate {
// SetNillableInt64 sets the nillable_int64 field.
func (ftu *FieldTypeUpdate) SetNillableInt64(i int64) *FieldTypeUpdate {
ftu.nillable_int64 = &i
ftu.addnillable_int64 = nil
return ftu
}
@@ -395,7 +466,11 @@ func (ftu *FieldTypeUpdate) SetNillableNillableInt64(i *int64) *FieldTypeUpdate
// AddNillableInt64 adds i to nillable_int64.
func (ftu *FieldTypeUpdate) AddNillableInt64(i int64) *FieldTypeUpdate {
ftu.addnillable_int64 = &i
if ftu.addnillable_int64 == nil {
ftu.addnillable_int64 = &i
} else {
*ftu.addnillable_int64 += i
}
return ftu
}
@@ -409,6 +484,7 @@ func (ftu *FieldTypeUpdate) ClearNillableInt64() *FieldTypeUpdate {
// SetValidateOptionalInt32 sets the validate_optional_int32 field.
func (ftu *FieldTypeUpdate) SetValidateOptionalInt32(i int32) *FieldTypeUpdate {
ftu.validate_optional_int32 = &i
ftu.addvalidate_optional_int32 = nil
return ftu
}
@@ -422,7 +498,11 @@ func (ftu *FieldTypeUpdate) SetNillableValidateOptionalInt32(i *int32) *FieldTyp
// AddValidateOptionalInt32 adds i to validate_optional_int32.
func (ftu *FieldTypeUpdate) AddValidateOptionalInt32(i int32) *FieldTypeUpdate {
ftu.addvalidate_optional_int32 = &i
if ftu.addvalidate_optional_int32 == nil {
ftu.addvalidate_optional_int32 = &i
} else {
*ftu.addvalidate_optional_int32 += i
}
return ftu
}
@@ -854,66 +934,92 @@ type FieldTypeUpdateOne struct {
// SetInt sets the int field.
func (ftuo *FieldTypeUpdateOne) SetInt(i int) *FieldTypeUpdateOne {
ftuo.int = &i
ftuo.addint = nil
return ftuo
}
// AddInt adds i to int.
func (ftuo *FieldTypeUpdateOne) AddInt(i int) *FieldTypeUpdateOne {
ftuo.addint = &i
if ftuo.addint == nil {
ftuo.addint = &i
} else {
*ftuo.addint += i
}
return ftuo
}
// SetInt8 sets the int8 field.
func (ftuo *FieldTypeUpdateOne) SetInt8(i int8) *FieldTypeUpdateOne {
ftuo.int8 = &i
ftuo.addint8 = nil
return ftuo
}
// AddInt8 adds i to int8.
func (ftuo *FieldTypeUpdateOne) AddInt8(i int8) *FieldTypeUpdateOne {
ftuo.addint8 = &i
if ftuo.addint8 == nil {
ftuo.addint8 = &i
} else {
*ftuo.addint8 += i
}
return ftuo
}
// SetInt16 sets the int16 field.
func (ftuo *FieldTypeUpdateOne) SetInt16(i int16) *FieldTypeUpdateOne {
ftuo.int16 = &i
ftuo.addint16 = nil
return ftuo
}
// AddInt16 adds i to int16.
func (ftuo *FieldTypeUpdateOne) AddInt16(i int16) *FieldTypeUpdateOne {
ftuo.addint16 = &i
if ftuo.addint16 == nil {
ftuo.addint16 = &i
} else {
*ftuo.addint16 += i
}
return ftuo
}
// SetInt32 sets the int32 field.
func (ftuo *FieldTypeUpdateOne) SetInt32(i int32) *FieldTypeUpdateOne {
ftuo.int32 = &i
ftuo.addint32 = nil
return ftuo
}
// AddInt32 adds i to int32.
func (ftuo *FieldTypeUpdateOne) AddInt32(i int32) *FieldTypeUpdateOne {
ftuo.addint32 = &i
if ftuo.addint32 == nil {
ftuo.addint32 = &i
} else {
*ftuo.addint32 += i
}
return ftuo
}
// SetInt64 sets the int64 field.
func (ftuo *FieldTypeUpdateOne) SetInt64(i int64) *FieldTypeUpdateOne {
ftuo.int64 = &i
ftuo.addint64 = nil
return ftuo
}
// AddInt64 adds i to int64.
func (ftuo *FieldTypeUpdateOne) AddInt64(i int64) *FieldTypeUpdateOne {
ftuo.addint64 = &i
if ftuo.addint64 == nil {
ftuo.addint64 = &i
} else {
*ftuo.addint64 += i
}
return ftuo
}
// SetOptionalInt sets the optional_int field.
func (ftuo *FieldTypeUpdateOne) SetOptionalInt(i int) *FieldTypeUpdateOne {
ftuo.optional_int = &i
ftuo.addoptional_int = nil
return ftuo
}
@@ -927,7 +1033,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt(i *int) *FieldTypeUpdateO
// AddOptionalInt adds i to optional_int.
func (ftuo *FieldTypeUpdateOne) AddOptionalInt(i int) *FieldTypeUpdateOne {
ftuo.addoptional_int = &i
if ftuo.addoptional_int == nil {
ftuo.addoptional_int = &i
} else {
*ftuo.addoptional_int += i
}
return ftuo
}
@@ -941,6 +1051,7 @@ func (ftuo *FieldTypeUpdateOne) ClearOptionalInt() *FieldTypeUpdateOne {
// SetOptionalInt8 sets the optional_int8 field.
func (ftuo *FieldTypeUpdateOne) SetOptionalInt8(i int8) *FieldTypeUpdateOne {
ftuo.optional_int8 = &i
ftuo.addoptional_int8 = nil
return ftuo
}
@@ -954,7 +1065,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt8(i *int8) *FieldTypeUpdat
// AddOptionalInt8 adds i to optional_int8.
func (ftuo *FieldTypeUpdateOne) AddOptionalInt8(i int8) *FieldTypeUpdateOne {
ftuo.addoptional_int8 = &i
if ftuo.addoptional_int8 == nil {
ftuo.addoptional_int8 = &i
} else {
*ftuo.addoptional_int8 += i
}
return ftuo
}
@@ -968,6 +1083,7 @@ func (ftuo *FieldTypeUpdateOne) ClearOptionalInt8() *FieldTypeUpdateOne {
// SetOptionalInt16 sets the optional_int16 field.
func (ftuo *FieldTypeUpdateOne) SetOptionalInt16(i int16) *FieldTypeUpdateOne {
ftuo.optional_int16 = &i
ftuo.addoptional_int16 = nil
return ftuo
}
@@ -981,7 +1097,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt16(i *int16) *FieldTypeUpd
// AddOptionalInt16 adds i to optional_int16.
func (ftuo *FieldTypeUpdateOne) AddOptionalInt16(i int16) *FieldTypeUpdateOne {
ftuo.addoptional_int16 = &i
if ftuo.addoptional_int16 == nil {
ftuo.addoptional_int16 = &i
} else {
*ftuo.addoptional_int16 += i
}
return ftuo
}
@@ -995,6 +1115,7 @@ func (ftuo *FieldTypeUpdateOne) ClearOptionalInt16() *FieldTypeUpdateOne {
// SetOptionalInt32 sets the optional_int32 field.
func (ftuo *FieldTypeUpdateOne) SetOptionalInt32(i int32) *FieldTypeUpdateOne {
ftuo.optional_int32 = &i
ftuo.addoptional_int32 = nil
return ftuo
}
@@ -1008,7 +1129,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt32(i *int32) *FieldTypeUpd
// AddOptionalInt32 adds i to optional_int32.
func (ftuo *FieldTypeUpdateOne) AddOptionalInt32(i int32) *FieldTypeUpdateOne {
ftuo.addoptional_int32 = &i
if ftuo.addoptional_int32 == nil {
ftuo.addoptional_int32 = &i
} else {
*ftuo.addoptional_int32 += i
}
return ftuo
}
@@ -1022,6 +1147,7 @@ func (ftuo *FieldTypeUpdateOne) ClearOptionalInt32() *FieldTypeUpdateOne {
// SetOptionalInt64 sets the optional_int64 field.
func (ftuo *FieldTypeUpdateOne) SetOptionalInt64(i int64) *FieldTypeUpdateOne {
ftuo.optional_int64 = &i
ftuo.addoptional_int64 = nil
return ftuo
}
@@ -1035,7 +1161,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableOptionalInt64(i *int64) *FieldTypeUpd
// AddOptionalInt64 adds i to optional_int64.
func (ftuo *FieldTypeUpdateOne) AddOptionalInt64(i int64) *FieldTypeUpdateOne {
ftuo.addoptional_int64 = &i
if ftuo.addoptional_int64 == nil {
ftuo.addoptional_int64 = &i
} else {
*ftuo.addoptional_int64 += i
}
return ftuo
}
@@ -1049,6 +1179,7 @@ func (ftuo *FieldTypeUpdateOne) ClearOptionalInt64() *FieldTypeUpdateOne {
// SetNillableInt sets the nillable_int field.
func (ftuo *FieldTypeUpdateOne) SetNillableInt(i int) *FieldTypeUpdateOne {
ftuo.nillable_int = &i
ftuo.addnillable_int = nil
return ftuo
}
@@ -1062,7 +1193,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt(i *int) *FieldTypeUpdateO
// AddNillableInt adds i to nillable_int.
func (ftuo *FieldTypeUpdateOne) AddNillableInt(i int) *FieldTypeUpdateOne {
ftuo.addnillable_int = &i
if ftuo.addnillable_int == nil {
ftuo.addnillable_int = &i
} else {
*ftuo.addnillable_int += i
}
return ftuo
}
@@ -1076,6 +1211,7 @@ func (ftuo *FieldTypeUpdateOne) ClearNillableInt() *FieldTypeUpdateOne {
// SetNillableInt8 sets the nillable_int8 field.
func (ftuo *FieldTypeUpdateOne) SetNillableInt8(i int8) *FieldTypeUpdateOne {
ftuo.nillable_int8 = &i
ftuo.addnillable_int8 = nil
return ftuo
}
@@ -1089,7 +1225,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt8(i *int8) *FieldTypeUpdat
// AddNillableInt8 adds i to nillable_int8.
func (ftuo *FieldTypeUpdateOne) AddNillableInt8(i int8) *FieldTypeUpdateOne {
ftuo.addnillable_int8 = &i
if ftuo.addnillable_int8 == nil {
ftuo.addnillable_int8 = &i
} else {
*ftuo.addnillable_int8 += i
}
return ftuo
}
@@ -1103,6 +1243,7 @@ func (ftuo *FieldTypeUpdateOne) ClearNillableInt8() *FieldTypeUpdateOne {
// SetNillableInt16 sets the nillable_int16 field.
func (ftuo *FieldTypeUpdateOne) SetNillableInt16(i int16) *FieldTypeUpdateOne {
ftuo.nillable_int16 = &i
ftuo.addnillable_int16 = nil
return ftuo
}
@@ -1116,7 +1257,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt16(i *int16) *FieldTypeUpd
// AddNillableInt16 adds i to nillable_int16.
func (ftuo *FieldTypeUpdateOne) AddNillableInt16(i int16) *FieldTypeUpdateOne {
ftuo.addnillable_int16 = &i
if ftuo.addnillable_int16 == nil {
ftuo.addnillable_int16 = &i
} else {
*ftuo.addnillable_int16 += i
}
return ftuo
}
@@ -1130,6 +1275,7 @@ func (ftuo *FieldTypeUpdateOne) ClearNillableInt16() *FieldTypeUpdateOne {
// SetNillableInt32 sets the nillable_int32 field.
func (ftuo *FieldTypeUpdateOne) SetNillableInt32(i int32) *FieldTypeUpdateOne {
ftuo.nillable_int32 = &i
ftuo.addnillable_int32 = nil
return ftuo
}
@@ -1143,7 +1289,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt32(i *int32) *FieldTypeUpd
// AddNillableInt32 adds i to nillable_int32.
func (ftuo *FieldTypeUpdateOne) AddNillableInt32(i int32) *FieldTypeUpdateOne {
ftuo.addnillable_int32 = &i
if ftuo.addnillable_int32 == nil {
ftuo.addnillable_int32 = &i
} else {
*ftuo.addnillable_int32 += i
}
return ftuo
}
@@ -1157,6 +1307,7 @@ func (ftuo *FieldTypeUpdateOne) ClearNillableInt32() *FieldTypeUpdateOne {
// SetNillableInt64 sets the nillable_int64 field.
func (ftuo *FieldTypeUpdateOne) SetNillableInt64(i int64) *FieldTypeUpdateOne {
ftuo.nillable_int64 = &i
ftuo.addnillable_int64 = nil
return ftuo
}
@@ -1170,7 +1321,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableNillableInt64(i *int64) *FieldTypeUpd
// AddNillableInt64 adds i to nillable_int64.
func (ftuo *FieldTypeUpdateOne) AddNillableInt64(i int64) *FieldTypeUpdateOne {
ftuo.addnillable_int64 = &i
if ftuo.addnillable_int64 == nil {
ftuo.addnillable_int64 = &i
} else {
*ftuo.addnillable_int64 += i
}
return ftuo
}
@@ -1184,6 +1339,7 @@ func (ftuo *FieldTypeUpdateOne) ClearNillableInt64() *FieldTypeUpdateOne {
// SetValidateOptionalInt32 sets the validate_optional_int32 field.
func (ftuo *FieldTypeUpdateOne) SetValidateOptionalInt32(i int32) *FieldTypeUpdateOne {
ftuo.validate_optional_int32 = &i
ftuo.addvalidate_optional_int32 = nil
return ftuo
}
@@ -1197,7 +1353,11 @@ func (ftuo *FieldTypeUpdateOne) SetNillableValidateOptionalInt32(i *int32) *Fiel
// AddValidateOptionalInt32 adds i to validate_optional_int32.
func (ftuo *FieldTypeUpdateOne) AddValidateOptionalInt32(i int32) *FieldTypeUpdateOne {
ftuo.addvalidate_optional_int32 = &i
if ftuo.addvalidate_optional_int32 == nil {
ftuo.addvalidate_optional_int32 = &i
} else {
*ftuo.addvalidate_optional_int32 += i
}
return ftuo
}

View File

@@ -50,6 +50,7 @@ func (fu *FileUpdate) Where(ps ...predicate.File) *FileUpdate {
// SetSize sets the size field.
func (fu *FileUpdate) SetSize(i int) *FileUpdate {
fu.size = &i
fu.addsize = nil
return fu
}
@@ -63,7 +64,11 @@ func (fu *FileUpdate) SetNillableSize(i *int) *FileUpdate {
// AddSize adds i to size.
func (fu *FileUpdate) AddSize(i int) *FileUpdate {
fu.addsize = &i
if fu.addsize == nil {
fu.addsize = &i
} else {
*fu.addsize += i
}
return fu
}
@@ -417,6 +422,7 @@ type FileUpdateOne struct {
// SetSize sets the size field.
func (fuo *FileUpdateOne) SetSize(i int) *FileUpdateOne {
fuo.size = &i
fuo.addsize = nil
return fuo
}
@@ -430,7 +436,11 @@ func (fuo *FileUpdateOne) SetNillableSize(i *int) *FileUpdateOne {
// AddSize adds i to size.
func (fuo *FileUpdateOne) AddSize(i int) *FileUpdateOne {
fuo.addsize = &i
if fuo.addsize == nil {
fuo.addsize = &i
} else {
*fuo.addsize += i
}
return fuo
}

View File

@@ -99,6 +99,7 @@ func (gu *GroupUpdate) ClearType() *GroupUpdate {
// SetMaxUsers sets the max_users field.
func (gu *GroupUpdate) SetMaxUsers(i int) *GroupUpdate {
gu.max_users = &i
gu.addmax_users = nil
return gu
}
@@ -112,7 +113,11 @@ func (gu *GroupUpdate) SetNillableMaxUsers(i *int) *GroupUpdate {
// AddMaxUsers adds i to max_users.
func (gu *GroupUpdate) AddMaxUsers(i int) *GroupUpdate {
gu.addmax_users = &i
if gu.addmax_users == nil {
gu.addmax_users = &i
} else {
*gu.addmax_users += i
}
return gu
}
@@ -721,6 +726,7 @@ func (guo *GroupUpdateOne) ClearType() *GroupUpdateOne {
// SetMaxUsers sets the max_users field.
func (guo *GroupUpdateOne) SetMaxUsers(i int) *GroupUpdateOne {
guo.max_users = &i
guo.addmax_users = nil
return guo
}
@@ -734,7 +740,11 @@ func (guo *GroupUpdateOne) SetNillableMaxUsers(i *int) *GroupUpdateOne {
// AddMaxUsers adds i to max_users.
func (guo *GroupUpdateOne) AddMaxUsers(i int) *GroupUpdateOne {
guo.addmax_users = &i
if guo.addmax_users == nil {
guo.addmax_users = &i
} else {
*guo.addmax_users += i
}
return guo
}

View File

@@ -50,6 +50,7 @@ func (giu *GroupInfoUpdate) SetDesc(s string) *GroupInfoUpdate {
// SetMaxUsers sets the max_users field.
func (giu *GroupInfoUpdate) SetMaxUsers(i int) *GroupInfoUpdate {
giu.max_users = &i
giu.addmax_users = nil
return giu
}
@@ -63,7 +64,11 @@ func (giu *GroupInfoUpdate) SetNillableMaxUsers(i *int) *GroupInfoUpdate {
// AddMaxUsers adds i to max_users.
func (giu *GroupInfoUpdate) AddMaxUsers(i int) *GroupInfoUpdate {
giu.addmax_users = &i
if giu.addmax_users == nil {
giu.addmax_users = &i
} else {
*giu.addmax_users += i
}
return giu
}
@@ -322,6 +327,7 @@ func (giuo *GroupInfoUpdateOne) SetDesc(s string) *GroupInfoUpdateOne {
// SetMaxUsers sets the max_users field.
func (giuo *GroupInfoUpdateOne) SetMaxUsers(i int) *GroupInfoUpdateOne {
giuo.max_users = &i
giuo.addmax_users = nil
return giuo
}
@@ -335,7 +341,11 @@ func (giuo *GroupInfoUpdateOne) SetNillableMaxUsers(i *int) *GroupInfoUpdateOne
// AddMaxUsers adds i to max_users.
func (giuo *GroupInfoUpdateOne) AddMaxUsers(i int) *GroupInfoUpdateOne {
giuo.addmax_users = &i
if giuo.addmax_users == nil {
giuo.addmax_users = &i
} else {
*giuo.addmax_users += i
}
return giuo
}

View File

@@ -45,6 +45,7 @@ func (nu *NodeUpdate) Where(ps ...predicate.Node) *NodeUpdate {
// SetValue sets the value field.
func (nu *NodeUpdate) SetValue(i int) *NodeUpdate {
nu.value = &i
nu.addvalue = nil
return nu
}
@@ -58,7 +59,11 @@ func (nu *NodeUpdate) SetNillableValue(i *int) *NodeUpdate {
// AddValue adds i to value.
func (nu *NodeUpdate) AddValue(i int) *NodeUpdate {
nu.addvalue = &i
if nu.addvalue == nil {
nu.addvalue = &i
} else {
*nu.addvalue += i
}
return nu
}
@@ -373,6 +378,7 @@ type NodeUpdateOne struct {
// SetValue sets the value field.
func (nuo *NodeUpdateOne) SetValue(i int) *NodeUpdateOne {
nuo.value = &i
nuo.addvalue = nil
return nuo
}
@@ -386,7 +392,11 @@ func (nuo *NodeUpdateOne) SetNillableValue(i *int) *NodeUpdateOne {
// AddValue adds i to value.
func (nuo *NodeUpdateOne) AddValue(i int) *NodeUpdateOne {
nuo.addvalue = &i
if nuo.addvalue == nil {
nuo.addvalue = &i
} else {
*nuo.addvalue += i
}
return nuo
}

View File

@@ -71,12 +71,17 @@ func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
// SetAge sets the age field.
func (uu *UserUpdate) SetAge(i int) *UserUpdate {
uu.age = &i
uu.addage = nil
return uu
}
// AddAge adds i to age.
func (uu *UserUpdate) AddAge(i int) *UserUpdate {
uu.addage = &i
if uu.addage == nil {
uu.addage = &i
} else {
*uu.addage += i
}
return uu
}
@@ -1309,12 +1314,17 @@ type UserUpdateOne struct {
// SetAge sets the age field.
func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne {
uuo.age = &i
uuo.addage = nil
return uuo
}
// AddAge adds i to age.
func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne {
uuo.addage = &i
if uuo.addage == nil {
uuo.addage = &i
} else {
*uuo.addage += i
}
return uuo
}

View File

@@ -366,6 +366,10 @@ func AddValues(t *testing.T, client *ent.Client) {
cmt1 = cmt1.Update().AddUniqueInt(20).AddNillableInt(20).SaveX(ctx)
require.Equal(21, cmt1.UniqueInt)
require.Equal(20, *cmt1.NillableInt)
cmt1 = cmt1.Update().AddUniqueInt(10).AddUniqueInt(-1).SaveX(ctx)
require.Equal(30, cmt1.UniqueInt)
require.Equal(30, client.Comment.GetX(ctx, cmt1.ID).UniqueInt)
}
func Delete(t *testing.T, client *ent.Client) {

View File

@@ -39,12 +39,17 @@ func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
// SetAge sets the age field.
func (uu *UserUpdate) SetAge(i int32) *UserUpdate {
uu.age = &i
uu.addage = nil
return uu
}
// AddAge adds i to age.
func (uu *UserUpdate) AddAge(i int32) *UserUpdate {
uu.addage = &i
if uu.addage == nil {
uu.addage = &i
} else {
*uu.addage += i
}
return uu
}
@@ -229,12 +234,17 @@ type UserUpdateOne struct {
// SetAge sets the age field.
func (uuo *UserUpdateOne) SetAge(i int32) *UserUpdateOne {
uuo.age = &i
uuo.addage = nil
return uuo
}
// AddAge adds i to age.
func (uuo *UserUpdateOne) AddAge(i int32) *UserUpdateOne {
uuo.addage = &i
if uuo.addage == nil {
uuo.addage = &i
} else {
*uuo.addage += i
}
return uuo
}

View File

@@ -40,12 +40,17 @@ func (uu *UserUpdate) Where(ps ...predicate.User) *UserUpdate {
// SetAge sets the age field.
func (uu *UserUpdate) SetAge(i int) *UserUpdate {
uu.age = &i
uu.addage = nil
return uu
}
// AddAge adds i to age.
func (uu *UserUpdate) AddAge(i int) *UserUpdate {
uu.addage = &i
if uu.addage == nil {
uu.addage = &i
} else {
*uu.addage += i
}
return uu
}
@@ -234,12 +239,17 @@ type UserUpdateOne struct {
// SetAge sets the age field.
func (uuo *UserUpdateOne) SetAge(i int) *UserUpdateOne {
uuo.age = &i
uuo.addage = nil
return uuo
}
// AddAge adds i to age.
func (uuo *UserUpdateOne) AddAge(i int) *UserUpdateOne {
uuo.addage = &i
if uuo.addage == nil {
uuo.addage = &i
} else {
*uuo.addage += i
}
return uuo
}

View File

@@ -32,12 +32,17 @@ func (gu *GroupUpdate) Where(ps ...predicate.Group) *GroupUpdate {
// SetMaxUsers sets the max_users field.
func (gu *GroupUpdate) SetMaxUsers(i int) *GroupUpdate {
gu.max_users = &i
gu.addmax_users = nil
return gu
}
// AddMaxUsers adds i to max_users.
func (gu *GroupUpdate) AddMaxUsers(i int) *GroupUpdate {
gu.addmax_users = &i
if gu.addmax_users == nil {
gu.addmax_users = &i
} else {
*gu.addmax_users += i
}
return gu
}
@@ -128,12 +133,17 @@ type GroupUpdateOne struct {
// SetMaxUsers sets the max_users field.
func (guo *GroupUpdateOne) SetMaxUsers(i int) *GroupUpdateOne {
guo.max_users = &i
guo.addmax_users = nil
return guo
}
// AddMaxUsers adds i to max_users.
func (guo *GroupUpdateOne) AddMaxUsers(i int) *GroupUpdateOne {
guo.addmax_users = &i
if guo.addmax_users == nil {
guo.addmax_users = &i
} else {
*guo.addmax_users += i
}
return guo
}

View File

@@ -36,12 +36,17 @@ func (pu *PetUpdate) Where(ps ...predicate.Pet) *PetUpdate {
// SetAge sets the age field.
func (pu *PetUpdate) SetAge(i int) *PetUpdate {
pu.age = &i
pu.addage = nil
return pu
}
// AddAge adds i to age.
func (pu *PetUpdate) AddAge(i int) *PetUpdate {
pu.addage = &i
if pu.addage == nil {
pu.addage = &i
} else {
*pu.addage += i
}
return pu
}
@@ -185,12 +190,17 @@ type PetUpdateOne struct {
// SetAge sets the age field.
func (puo *PetUpdateOne) SetAge(i int) *PetUpdateOne {
puo.age = &i
puo.addage = nil
return puo
}
// AddAge adds i to age.
func (puo *PetUpdateOne) AddAge(i int) *PetUpdateOne {
puo.addage = &i
if puo.addage == nil {
puo.addage = &i
} else {
*puo.addage += i
}
return puo
}