entc/gen: avoid using Go keywords as variables on scan

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/161

Reviewed By: alexsn

Differential Revision: D18483166

fbshipit-source-id: 7273d284232c1bf515cc84326904b580fb70a0e3
This commit is contained in:
Ariel Mashraki
2019-11-13 11:34:02 -08:00
committed by Facebook Github Bot
parent 84fd066e2c
commit 8093ec4127
24 changed files with 391 additions and 391 deletions

View File

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

View File

@@ -13,7 +13,7 @@ func ({{ $receiver }} *{{ $.Name }}) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
{{- $scan := print "v" $receiver }}
{{- $scan := print "scan" $receiver }}
var {{ $scan }} struct {
ID {{ $.ID.Type }} `json:"id,omitempty"`
{{ range $_, $f := $.Fields }}
@@ -41,7 +41,7 @@ func ({{ $receiver }} *{{ $slice }}) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
{{- $scan := print "v" $receiver }}
{{- $scan := print "scan" $receiver }}
var {{ $scan }} []struct {
ID {{ $.ID.Type }} `json:"id,omitempty"`
{{ range $_, $f := $.Fields }}

View File

@@ -9,7 +9,7 @@ in the LICENSE file in the root directory of this source tree.
// FromRows scans the sql response data into {{ $.Name }}.
func ({{ $receiver }} *{{ $.Name }}) FromRows(rows *sql.Rows) error {
{{- $scan := print "v" $receiver }}
{{- $scan := print "scan" $receiver }}
var {{ $scan }} struct {
ID {{ if $.ID.IsString }}int{{ else }}{{ $.ID.Type }}{{ end }}
{{ range $_, $f := $.Fields }}
@@ -53,7 +53,7 @@ func ({{ $receiver }} *{{ $.Name }}) FromRows(rows *sql.Rows) error {
// FromRows scans the sql response data into {{ $slice }}.
func ({{ $receiver }} *{{ $slice }}) FromRows(rows *sql.Rows) error {
for rows.Next() {
{{- $scan := print "v" $receiver }}
{{- $scan := print "scan" $receiver }}
{{ $scan }} := &{{ $.Name }}{}
if err := {{ $scan }}.FromRows(rows); err != nil {
return err

View File

@@ -22,16 +22,16 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&scanu.ID,
); err != nil {
return err
}
u.ID = vu.ID
u.ID = scanu.ID
return nil
}
@@ -68,11 +68,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}

View File

@@ -36,7 +36,7 @@ type Card struct {
// FromRows scans the sql response data into Card.
func (c *Card) FromRows(rows *sql.Rows) error {
var vc struct {
var scanc struct {
ID int
CreateTime sql.NullTime
UpdateTime sql.NullTime
@@ -45,19 +45,19 @@ func (c *Card) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `card.Columns`.
if err := rows.Scan(
&vc.ID,
&vc.CreateTime,
&vc.UpdateTime,
&vc.Number,
&vc.Name,
&scanc.ID,
&scanc.CreateTime,
&scanc.UpdateTime,
&scanc.Number,
&scanc.Name,
); err != nil {
return err
}
c.ID = strconv.Itoa(vc.ID)
c.CreateTime = vc.CreateTime.Time
c.UpdateTime = vc.UpdateTime.Time
c.Number = vc.Number.String
c.Name = vc.Name.String
c.ID = strconv.Itoa(scanc.ID)
c.CreateTime = scanc.CreateTime.Time
c.UpdateTime = scanc.UpdateTime.Time
c.Number = scanc.Number.String
c.Name = scanc.Name.String
return nil
}
@@ -67,21 +67,21 @@ func (c *Card) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vc struct {
var scanc struct {
ID string `json:"id,omitempty"`
CreateTime int64 `json:"create_time,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
Number string `json:"number,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vc); err != nil {
if err := vmap.Decode(&scanc); err != nil {
return err
}
c.ID = vc.ID
c.CreateTime = time.Unix(0, vc.CreateTime)
c.UpdateTime = time.Unix(0, vc.UpdateTime)
c.Number = vc.Number
c.Name = vc.Name
c.ID = scanc.ID
c.CreateTime = time.Unix(0, scanc.CreateTime)
c.UpdateTime = time.Unix(0, scanc.UpdateTime)
c.Number = scanc.Number
c.Name = scanc.Name
return nil
}
@@ -137,11 +137,11 @@ type Cards []*Card
// FromRows scans the sql response data into Cards.
func (c *Cards) FromRows(rows *sql.Rows) error {
for rows.Next() {
vc := &Card{}
if err := vc.FromRows(rows); err != nil {
scanc := &Card{}
if err := scanc.FromRows(rows); err != nil {
return err
}
*c = append(*c, vc)
*c = append(*c, scanc)
}
return nil
}
@@ -152,17 +152,17 @@ func (c *Cards) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vc []struct {
var scanc []struct {
ID string `json:"id,omitempty"`
CreateTime int64 `json:"create_time,omitempty"`
UpdateTime int64 `json:"update_time,omitempty"`
Number string `json:"number,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vc); err != nil {
if err := vmap.Decode(&scanc); err != nil {
return err
}
for _, v := range vc {
for _, v := range scanc {
*c = append(*c, &Card{
ID: v.ID,
CreateTime: time.Unix(0, v.CreateTime),

View File

@@ -30,7 +30,7 @@ type Comment struct {
// FromRows scans the sql response data into Comment.
func (c *Comment) FromRows(rows *sql.Rows) error {
var vc struct {
var scanc struct {
ID int
UniqueInt sql.NullInt64
UniqueFloat sql.NullFloat64
@@ -38,19 +38,19 @@ func (c *Comment) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `comment.Columns`.
if err := rows.Scan(
&vc.ID,
&vc.UniqueInt,
&vc.UniqueFloat,
&vc.NillableInt,
&scanc.ID,
&scanc.UniqueInt,
&scanc.UniqueFloat,
&scanc.NillableInt,
); err != nil {
return err
}
c.ID = strconv.Itoa(vc.ID)
c.UniqueInt = int(vc.UniqueInt.Int64)
c.UniqueFloat = vc.UniqueFloat.Float64
if vc.NillableInt.Valid {
c.ID = strconv.Itoa(scanc.ID)
c.UniqueInt = int(scanc.UniqueInt.Int64)
c.UniqueFloat = scanc.UniqueFloat.Float64
if scanc.NillableInt.Valid {
c.NillableInt = new(int)
*c.NillableInt = int(vc.NillableInt.Int64)
*c.NillableInt = int(scanc.NillableInt.Int64)
}
return nil
}
@@ -61,19 +61,19 @@ func (c *Comment) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vc struct {
var scanc struct {
ID string `json:"id,omitempty"`
UniqueInt int `json:"unique_int,omitempty"`
UniqueFloat float64 `json:"unique_float,omitempty"`
NillableInt *int `json:"nillable_int,omitempty"`
}
if err := vmap.Decode(&vc); err != nil {
if err := vmap.Decode(&scanc); err != nil {
return err
}
c.ID = vc.ID
c.UniqueInt = vc.UniqueInt
c.UniqueFloat = vc.UniqueFloat
c.NillableInt = vc.NillableInt
c.ID = scanc.ID
c.UniqueInt = scanc.UniqueInt
c.UniqueFloat = scanc.UniqueFloat
c.NillableInt = scanc.NillableInt
return nil
}
@@ -124,11 +124,11 @@ type Comments []*Comment
// FromRows scans the sql response data into Comments.
func (c *Comments) FromRows(rows *sql.Rows) error {
for rows.Next() {
vc := &Comment{}
if err := vc.FromRows(rows); err != nil {
scanc := &Comment{}
if err := scanc.FromRows(rows); err != nil {
return err
}
*c = append(*c, vc)
*c = append(*c, scanc)
}
return nil
}
@@ -139,16 +139,16 @@ func (c *Comments) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vc []struct {
var scanc []struct {
ID string `json:"id,omitempty"`
UniqueInt int `json:"unique_int,omitempty"`
UniqueFloat float64 `json:"unique_float,omitempty"`
NillableInt *int `json:"nillable_int,omitempty"`
}
if err := vmap.Decode(&vc); err != nil {
if err := vmap.Decode(&scanc); err != nil {
return err
}
for _, v := range vc {
for _, v := range scanc {
*c = append(*c, &Comment{
ID: v.ID,
UniqueInt: v.UniqueInt,

View File

@@ -59,7 +59,7 @@ type FieldType struct {
// FromRows scans the sql response data into FieldType.
func (ft *FieldType) FromRows(rows *sql.Rows) error {
var vft struct {
var scanft struct {
ID int
Int sql.NullInt64
Int8 sql.NullInt64
@@ -81,60 +81,60 @@ func (ft *FieldType) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `fieldtype.Columns`.
if err := rows.Scan(
&vft.ID,
&vft.Int,
&vft.Int8,
&vft.Int16,
&vft.Int32,
&vft.Int64,
&vft.OptionalInt,
&vft.OptionalInt8,
&vft.OptionalInt16,
&vft.OptionalInt32,
&vft.OptionalInt64,
&vft.NillableInt,
&vft.NillableInt8,
&vft.NillableInt16,
&vft.NillableInt32,
&vft.NillableInt64,
&vft.ValidateOptionalInt32,
&vft.State,
&scanft.ID,
&scanft.Int,
&scanft.Int8,
&scanft.Int16,
&scanft.Int32,
&scanft.Int64,
&scanft.OptionalInt,
&scanft.OptionalInt8,
&scanft.OptionalInt16,
&scanft.OptionalInt32,
&scanft.OptionalInt64,
&scanft.NillableInt,
&scanft.NillableInt8,
&scanft.NillableInt16,
&scanft.NillableInt32,
&scanft.NillableInt64,
&scanft.ValidateOptionalInt32,
&scanft.State,
); err != nil {
return err
}
ft.ID = strconv.Itoa(vft.ID)
ft.Int = int(vft.Int.Int64)
ft.Int8 = int8(vft.Int8.Int64)
ft.Int16 = int16(vft.Int16.Int64)
ft.Int32 = int32(vft.Int32.Int64)
ft.Int64 = vft.Int64.Int64
ft.OptionalInt = int(vft.OptionalInt.Int64)
ft.OptionalInt8 = int8(vft.OptionalInt8.Int64)
ft.OptionalInt16 = int16(vft.OptionalInt16.Int64)
ft.OptionalInt32 = int32(vft.OptionalInt32.Int64)
ft.OptionalInt64 = vft.OptionalInt64.Int64
if vft.NillableInt.Valid {
ft.ID = strconv.Itoa(scanft.ID)
ft.Int = int(scanft.Int.Int64)
ft.Int8 = int8(scanft.Int8.Int64)
ft.Int16 = int16(scanft.Int16.Int64)
ft.Int32 = int32(scanft.Int32.Int64)
ft.Int64 = scanft.Int64.Int64
ft.OptionalInt = int(scanft.OptionalInt.Int64)
ft.OptionalInt8 = int8(scanft.OptionalInt8.Int64)
ft.OptionalInt16 = int16(scanft.OptionalInt16.Int64)
ft.OptionalInt32 = int32(scanft.OptionalInt32.Int64)
ft.OptionalInt64 = scanft.OptionalInt64.Int64
if scanft.NillableInt.Valid {
ft.NillableInt = new(int)
*ft.NillableInt = int(vft.NillableInt.Int64)
*ft.NillableInt = int(scanft.NillableInt.Int64)
}
if vft.NillableInt8.Valid {
if scanft.NillableInt8.Valid {
ft.NillableInt8 = new(int8)
*ft.NillableInt8 = int8(vft.NillableInt8.Int64)
*ft.NillableInt8 = int8(scanft.NillableInt8.Int64)
}
if vft.NillableInt16.Valid {
if scanft.NillableInt16.Valid {
ft.NillableInt16 = new(int16)
*ft.NillableInt16 = int16(vft.NillableInt16.Int64)
*ft.NillableInt16 = int16(scanft.NillableInt16.Int64)
}
if vft.NillableInt32.Valid {
if scanft.NillableInt32.Valid {
ft.NillableInt32 = new(int32)
*ft.NillableInt32 = int32(vft.NillableInt32.Int64)
*ft.NillableInt32 = int32(scanft.NillableInt32.Int64)
}
if vft.NillableInt64.Valid {
if scanft.NillableInt64.Valid {
ft.NillableInt64 = new(int64)
*ft.NillableInt64 = vft.NillableInt64.Int64
*ft.NillableInt64 = scanft.NillableInt64.Int64
}
ft.ValidateOptionalInt32 = int32(vft.ValidateOptionalInt32.Int64)
ft.State = fieldtype.State(vft.State.String)
ft.ValidateOptionalInt32 = int32(scanft.ValidateOptionalInt32.Int64)
ft.State = fieldtype.State(scanft.State.String)
return nil
}
@@ -144,7 +144,7 @@ func (ft *FieldType) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vft struct {
var scanft struct {
ID string `json:"id,omitempty"`
Int int `json:"int,omitempty"`
Int8 int8 `json:"int8,omitempty"`
@@ -164,27 +164,27 @@ func (ft *FieldType) FromResponse(res *gremlin.Response) error {
ValidateOptionalInt32 int32 `json:"validate_optional_int32,omitempty"`
State fieldtype.State `json:"state,omitempty"`
}
if err := vmap.Decode(&vft); err != nil {
if err := vmap.Decode(&scanft); err != nil {
return err
}
ft.ID = vft.ID
ft.Int = vft.Int
ft.Int8 = vft.Int8
ft.Int16 = vft.Int16
ft.Int32 = vft.Int32
ft.Int64 = vft.Int64
ft.OptionalInt = vft.OptionalInt
ft.OptionalInt8 = vft.OptionalInt8
ft.OptionalInt16 = vft.OptionalInt16
ft.OptionalInt32 = vft.OptionalInt32
ft.OptionalInt64 = vft.OptionalInt64
ft.NillableInt = vft.NillableInt
ft.NillableInt8 = vft.NillableInt8
ft.NillableInt16 = vft.NillableInt16
ft.NillableInt32 = vft.NillableInt32
ft.NillableInt64 = vft.NillableInt64
ft.ValidateOptionalInt32 = vft.ValidateOptionalInt32
ft.State = vft.State
ft.ID = scanft.ID
ft.Int = scanft.Int
ft.Int8 = scanft.Int8
ft.Int16 = scanft.Int16
ft.Int32 = scanft.Int32
ft.Int64 = scanft.Int64
ft.OptionalInt = scanft.OptionalInt
ft.OptionalInt8 = scanft.OptionalInt8
ft.OptionalInt16 = scanft.OptionalInt16
ft.OptionalInt32 = scanft.OptionalInt32
ft.OptionalInt64 = scanft.OptionalInt64
ft.NillableInt = scanft.NillableInt
ft.NillableInt8 = scanft.NillableInt8
ft.NillableInt16 = scanft.NillableInt16
ft.NillableInt32 = scanft.NillableInt32
ft.NillableInt64 = scanft.NillableInt64
ft.ValidateOptionalInt32 = scanft.ValidateOptionalInt32
ft.State = scanft.State
return nil
}
@@ -271,11 +271,11 @@ type FieldTypes []*FieldType
// FromRows scans the sql response data into FieldTypes.
func (ft *FieldTypes) FromRows(rows *sql.Rows) error {
for rows.Next() {
vft := &FieldType{}
if err := vft.FromRows(rows); err != nil {
scanft := &FieldType{}
if err := scanft.FromRows(rows); err != nil {
return err
}
*ft = append(*ft, vft)
*ft = append(*ft, scanft)
}
return nil
}
@@ -286,7 +286,7 @@ func (ft *FieldTypes) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vft []struct {
var scanft []struct {
ID string `json:"id,omitempty"`
Int int `json:"int,omitempty"`
Int8 int8 `json:"int8,omitempty"`
@@ -306,10 +306,10 @@ func (ft *FieldTypes) FromResponse(res *gremlin.Response) error {
ValidateOptionalInt32 int32 `json:"validate_optional_int32,omitempty"`
State fieldtype.State `json:"state,omitempty"`
}
if err := vmap.Decode(&vft); err != nil {
if err := vmap.Decode(&scanft); err != nil {
return err
}
for _, v := range vft {
for _, v := range scanft {
*ft = append(*ft, &FieldType{
ID: v.ID,
Int: v.Int,

View File

@@ -32,7 +32,7 @@ type File struct {
// FromRows scans the sql response data into File.
func (f *File) FromRows(rows *sql.Rows) error {
var vf struct {
var scanf struct {
ID int
Size sql.NullInt64
Name sql.NullString
@@ -41,22 +41,22 @@ func (f *File) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `file.Columns`.
if err := rows.Scan(
&vf.ID,
&vf.Size,
&vf.Name,
&vf.User,
&vf.Group,
&scanf.ID,
&scanf.Size,
&scanf.Name,
&scanf.User,
&scanf.Group,
); err != nil {
return err
}
f.ID = strconv.Itoa(vf.ID)
f.Size = int(vf.Size.Int64)
f.Name = vf.Name.String
if vf.User.Valid {
f.ID = strconv.Itoa(scanf.ID)
f.Size = int(scanf.Size.Int64)
f.Name = scanf.Name.String
if scanf.User.Valid {
f.User = new(string)
*f.User = vf.User.String
*f.User = scanf.User.String
}
f.Group = vf.Group.String
f.Group = scanf.Group.String
return nil
}
@@ -66,21 +66,21 @@ func (f *File) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vf struct {
var scanf struct {
ID string `json:"id,omitempty"`
Size int `json:"fsize,omitempty"`
Name string `json:"name,omitempty"`
User *string `json:"user,omitempty"`
Group string `json:"group,omitempty"`
}
if err := vmap.Decode(&vf); err != nil {
if err := vmap.Decode(&scanf); err != nil {
return err
}
f.ID = vf.ID
f.Size = vf.Size
f.Name = vf.Name
f.User = vf.User
f.Group = vf.Group
f.ID = scanf.ID
f.Size = scanf.Size
f.Name = scanf.Name
f.User = scanf.User
f.Group = scanf.Group
return nil
}
@@ -143,11 +143,11 @@ type Files []*File
// FromRows scans the sql response data into Files.
func (f *Files) FromRows(rows *sql.Rows) error {
for rows.Next() {
vf := &File{}
if err := vf.FromRows(rows); err != nil {
scanf := &File{}
if err := scanf.FromRows(rows); err != nil {
return err
}
*f = append(*f, vf)
*f = append(*f, scanf)
}
return nil
}
@@ -158,17 +158,17 @@ func (f *Files) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vf []struct {
var scanf []struct {
ID string `json:"id,omitempty"`
Size int `json:"fsize,omitempty"`
Name string `json:"name,omitempty"`
User *string `json:"user,omitempty"`
Group string `json:"group,omitempty"`
}
if err := vmap.Decode(&vf); err != nil {
if err := vmap.Decode(&scanf); err != nil {
return err
}
for _, v := range vf {
for _, v := range scanf {
*f = append(*f, &File{
ID: v.ID,
Size: v.Size,

View File

@@ -26,19 +26,19 @@ type FileType struct {
// FromRows scans the sql response data into FileType.
func (ft *FileType) FromRows(rows *sql.Rows) error {
var vft struct {
var scanft struct {
ID int
Name sql.NullString
}
// the order here should be the same as in the `filetype.Columns`.
if err := rows.Scan(
&vft.ID,
&vft.Name,
&scanft.ID,
&scanft.Name,
); err != nil {
return err
}
ft.ID = strconv.Itoa(vft.ID)
ft.Name = vft.Name.String
ft.ID = strconv.Itoa(scanft.ID)
ft.Name = scanft.Name.String
return nil
}
@@ -48,15 +48,15 @@ func (ft *FileType) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vft struct {
var scanft struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vft); err != nil {
if err := vmap.Decode(&scanft); err != nil {
return err
}
ft.ID = vft.ID
ft.Name = vft.Name
ft.ID = scanft.ID
ft.Name = scanft.Name
return nil
}
@@ -106,11 +106,11 @@ type FileTypes []*FileType
// FromRows scans the sql response data into FileTypes.
func (ft *FileTypes) FromRows(rows *sql.Rows) error {
for rows.Next() {
vft := &FileType{}
if err := vft.FromRows(rows); err != nil {
scanft := &FileType{}
if err := scanft.FromRows(rows); err != nil {
return err
}
*ft = append(*ft, vft)
*ft = append(*ft, scanft)
}
return nil
}
@@ -121,14 +121,14 @@ func (ft *FileTypes) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vft []struct {
var scanft []struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vft); err != nil {
if err := vmap.Decode(&scanft); err != nil {
return err
}
for _, v := range vft {
for _, v := range scanft {
*ft = append(*ft, &FileType{
ID: v.ID,
Name: v.Name,

View File

@@ -35,7 +35,7 @@ type Group struct {
// FromRows scans the sql response data into Group.
func (gr *Group) FromRows(rows *sql.Rows) error {
var vgr struct {
var scangr struct {
ID int
Active sql.NullBool
Expire sql.NullTime
@@ -45,24 +45,24 @@ func (gr *Group) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `group.Columns`.
if err := rows.Scan(
&vgr.ID,
&vgr.Active,
&vgr.Expire,
&vgr.Type,
&vgr.MaxUsers,
&vgr.Name,
&scangr.ID,
&scangr.Active,
&scangr.Expire,
&scangr.Type,
&scangr.MaxUsers,
&scangr.Name,
); err != nil {
return err
}
gr.ID = strconv.Itoa(vgr.ID)
gr.Active = vgr.Active.Bool
gr.Expire = vgr.Expire.Time
if vgr.Type.Valid {
gr.ID = strconv.Itoa(scangr.ID)
gr.Active = scangr.Active.Bool
gr.Expire = scangr.Expire.Time
if scangr.Type.Valid {
gr.Type = new(string)
*gr.Type = vgr.Type.String
*gr.Type = scangr.Type.String
}
gr.MaxUsers = int(vgr.MaxUsers.Int64)
gr.Name = vgr.Name.String
gr.MaxUsers = int(scangr.MaxUsers.Int64)
gr.Name = scangr.Name.String
return nil
}
@@ -72,7 +72,7 @@ func (gr *Group) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vgr struct {
var scangr struct {
ID string `json:"id,omitempty"`
Active bool `json:"active,omitempty"`
Expire int64 `json:"expire,omitempty"`
@@ -80,15 +80,15 @@ func (gr *Group) FromResponse(res *gremlin.Response) error {
MaxUsers int `json:"max_users,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vgr); err != nil {
if err := vmap.Decode(&scangr); err != nil {
return err
}
gr.ID = vgr.ID
gr.Active = vgr.Active
gr.Expire = time.Unix(0, vgr.Expire)
gr.Type = vgr.Type
gr.MaxUsers = vgr.MaxUsers
gr.Name = vgr.Name
gr.ID = scangr.ID
gr.Active = scangr.Active
gr.Expire = time.Unix(0, scangr.Expire)
gr.Type = scangr.Type
gr.MaxUsers = scangr.MaxUsers
gr.Name = scangr.Name
return nil
}
@@ -163,11 +163,11 @@ type Groups []*Group
// FromRows scans the sql response data into Groups.
func (gr *Groups) FromRows(rows *sql.Rows) error {
for rows.Next() {
vgr := &Group{}
if err := vgr.FromRows(rows); err != nil {
scangr := &Group{}
if err := scangr.FromRows(rows); err != nil {
return err
}
*gr = append(*gr, vgr)
*gr = append(*gr, scangr)
}
return nil
}
@@ -178,7 +178,7 @@ func (gr *Groups) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vgr []struct {
var scangr []struct {
ID string `json:"id,omitempty"`
Active bool `json:"active,omitempty"`
Expire int64 `json:"expire,omitempty"`
@@ -186,10 +186,10 @@ func (gr *Groups) FromResponse(res *gremlin.Response) error {
MaxUsers int `json:"max_users,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vgr); err != nil {
if err := vmap.Decode(&scangr); err != nil {
return err
}
for _, v := range vgr {
for _, v := range scangr {
*gr = append(*gr, &Group{
ID: v.ID,
Active: v.Active,

View File

@@ -28,22 +28,22 @@ type GroupInfo struct {
// FromRows scans the sql response data into GroupInfo.
func (gi *GroupInfo) FromRows(rows *sql.Rows) error {
var vgi struct {
var scangi struct {
ID int
Desc sql.NullString
MaxUsers sql.NullInt64
}
// the order here should be the same as in the `groupinfo.Columns`.
if err := rows.Scan(
&vgi.ID,
&vgi.Desc,
&vgi.MaxUsers,
&scangi.ID,
&scangi.Desc,
&scangi.MaxUsers,
); err != nil {
return err
}
gi.ID = strconv.Itoa(vgi.ID)
gi.Desc = vgi.Desc.String
gi.MaxUsers = int(vgi.MaxUsers.Int64)
gi.ID = strconv.Itoa(scangi.ID)
gi.Desc = scangi.Desc.String
gi.MaxUsers = int(scangi.MaxUsers.Int64)
return nil
}
@@ -53,17 +53,17 @@ func (gi *GroupInfo) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vgi struct {
var scangi struct {
ID string `json:"id,omitempty"`
Desc string `json:"desc,omitempty"`
MaxUsers int `json:"max_users,omitempty"`
}
if err := vmap.Decode(&vgi); err != nil {
if err := vmap.Decode(&scangi); err != nil {
return err
}
gi.ID = vgi.ID
gi.Desc = vgi.Desc
gi.MaxUsers = vgi.MaxUsers
gi.ID = scangi.ID
gi.Desc = scangi.Desc
gi.MaxUsers = scangi.MaxUsers
return nil
}
@@ -115,11 +115,11 @@ type GroupInfos []*GroupInfo
// FromRows scans the sql response data into GroupInfos.
func (gi *GroupInfos) FromRows(rows *sql.Rows) error {
for rows.Next() {
vgi := &GroupInfo{}
if err := vgi.FromRows(rows); err != nil {
scangi := &GroupInfo{}
if err := scangi.FromRows(rows); err != nil {
return err
}
*gi = append(*gi, vgi)
*gi = append(*gi, scangi)
}
return nil
}
@@ -130,15 +130,15 @@ func (gi *GroupInfos) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vgi []struct {
var scangi []struct {
ID string `json:"id,omitempty"`
Desc string `json:"desc,omitempty"`
MaxUsers int `json:"max_users,omitempty"`
}
if err := vmap.Decode(&vgi); err != nil {
if err := vmap.Decode(&scangi); err != nil {
return err
}
for _, v := range vgi {
for _, v := range scangi {
*gi = append(*gi, &GroupInfo{
ID: v.ID,
Desc: v.Desc,

View File

@@ -24,16 +24,16 @@ type Item struct {
// FromRows scans the sql response data into Item.
func (i *Item) FromRows(rows *sql.Rows) error {
var vi struct {
var scani struct {
ID int
}
// the order here should be the same as in the `item.Columns`.
if err := rows.Scan(
&vi.ID,
&scani.ID,
); err != nil {
return err
}
i.ID = strconv.Itoa(vi.ID)
i.ID = strconv.Itoa(scani.ID)
return nil
}
@@ -43,13 +43,13 @@ func (i *Item) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vi struct {
var scani struct {
ID string `json:"id,omitempty"`
}
if err := vmap.Decode(&vi); err != nil {
if err := vmap.Decode(&scani); err != nil {
return err
}
i.ID = vi.ID
i.ID = scani.ID
return nil
}
@@ -92,11 +92,11 @@ type Items []*Item
// FromRows scans the sql response data into Items.
func (i *Items) FromRows(rows *sql.Rows) error {
for rows.Next() {
vi := &Item{}
if err := vi.FromRows(rows); err != nil {
scani := &Item{}
if err := scani.FromRows(rows); err != nil {
return err
}
*i = append(*i, vi)
*i = append(*i, scani)
}
return nil
}
@@ -107,13 +107,13 @@ func (i *Items) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vi []struct {
var scani []struct {
ID string `json:"id,omitempty"`
}
if err := vmap.Decode(&vi); err != nil {
if err := vmap.Decode(&scani); err != nil {
return err
}
for _, v := range vi {
for _, v := range scani {
*i = append(*i, &Item{
ID: v.ID,
})

View File

@@ -26,19 +26,19 @@ type Node struct {
// FromRows scans the sql response data into Node.
func (n *Node) FromRows(rows *sql.Rows) error {
var vn struct {
var scann struct {
ID int
Value sql.NullInt64
}
// the order here should be the same as in the `node.Columns`.
if err := rows.Scan(
&vn.ID,
&vn.Value,
&scann.ID,
&scann.Value,
); err != nil {
return err
}
n.ID = strconv.Itoa(vn.ID)
n.Value = int(vn.Value.Int64)
n.ID = strconv.Itoa(scann.ID)
n.Value = int(scann.Value.Int64)
return nil
}
@@ -48,15 +48,15 @@ func (n *Node) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vn struct {
var scann struct {
ID string `json:"id,omitempty"`
Value int `json:"value,omitempty"`
}
if err := vmap.Decode(&vn); err != nil {
if err := vmap.Decode(&scann); err != nil {
return err
}
n.ID = vn.ID
n.Value = vn.Value
n.ID = scann.ID
n.Value = scann.Value
return nil
}
@@ -111,11 +111,11 @@ type Nodes []*Node
// FromRows scans the sql response data into Nodes.
func (n *Nodes) FromRows(rows *sql.Rows) error {
for rows.Next() {
vn := &Node{}
if err := vn.FromRows(rows); err != nil {
scann := &Node{}
if err := scann.FromRows(rows); err != nil {
return err
}
*n = append(*n, vn)
*n = append(*n, scann)
}
return nil
}
@@ -126,14 +126,14 @@ func (n *Nodes) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vn []struct {
var scann []struct {
ID string `json:"id,omitempty"`
Value int `json:"value,omitempty"`
}
if err := vmap.Decode(&vn); err != nil {
if err := vmap.Decode(&scann); err != nil {
return err
}
for _, v := range vn {
for _, v := range scann {
*n = append(*n, &Node{
ID: v.ID,
Value: v.Value,

View File

@@ -26,19 +26,19 @@ type Pet struct {
// FromRows scans the sql response data into Pet.
func (pe *Pet) FromRows(rows *sql.Rows) error {
var vpe struct {
var scanpe struct {
ID int
Name sql.NullString
}
// the order here should be the same as in the `pet.Columns`.
if err := rows.Scan(
&vpe.ID,
&vpe.Name,
&scanpe.ID,
&scanpe.Name,
); err != nil {
return err
}
pe.ID = strconv.Itoa(vpe.ID)
pe.Name = vpe.Name.String
pe.ID = strconv.Itoa(scanpe.ID)
pe.Name = scanpe.Name.String
return nil
}
@@ -48,15 +48,15 @@ func (pe *Pet) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vpe struct {
var scanpe struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vpe); err != nil {
if err := vmap.Decode(&scanpe); err != nil {
return err
}
pe.ID = vpe.ID
pe.Name = vpe.Name
pe.ID = scanpe.ID
pe.Name = scanpe.Name
return nil
}
@@ -111,11 +111,11 @@ type Pets []*Pet
// FromRows scans the sql response data into Pets.
func (pe *Pets) FromRows(rows *sql.Rows) error {
for rows.Next() {
vpe := &Pet{}
if err := vpe.FromRows(rows); err != nil {
scanpe := &Pet{}
if err := scanpe.FromRows(rows); err != nil {
return err
}
*pe = append(*pe, vpe)
*pe = append(*pe, scanpe)
}
return nil
}
@@ -126,14 +126,14 @@ func (pe *Pets) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vpe []struct {
var scanpe []struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
if err := vmap.Decode(&vpe); err != nil {
if err := vmap.Decode(&scanpe); err != nil {
return err
}
for _, v := range vpe {
for _, v := range scanpe {
*pe = append(*pe, &Pet{
ID: v.ID,
Name: v.Name,

View File

@@ -36,7 +36,7 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
Age sql.NullInt64
Name sql.NullString
@@ -47,23 +47,23 @@ func (u *User) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.Age,
&vu.Name,
&vu.Last,
&vu.Nickname,
&vu.Phone,
&vu.Password,
&scanu.ID,
&scanu.Age,
&scanu.Name,
&scanu.Last,
&scanu.Nickname,
&scanu.Phone,
&scanu.Password,
); err != nil {
return err
}
u.ID = strconv.Itoa(vu.ID)
u.Age = int(vu.Age.Int64)
u.Name = vu.Name.String
u.Last = vu.Last.String
u.Nickname = vu.Nickname.String
u.Phone = vu.Phone.String
u.Password = vu.Password.String
u.ID = strconv.Itoa(scanu.ID)
u.Age = int(scanu.Age.Int64)
u.Name = scanu.Name.String
u.Last = scanu.Last.String
u.Nickname = scanu.Nickname.String
u.Phone = scanu.Phone.String
u.Password = scanu.Password.String
return nil
}
@@ -73,7 +73,7 @@ func (u *User) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vu struct {
var scanu struct {
ID string `json:"id,omitempty"`
Age int `json:"age,omitempty"`
Name string `json:"name,omitempty"`
@@ -82,16 +82,16 @@ func (u *User) FromResponse(res *gremlin.Response) error {
Phone string `json:"phone,omitempty"`
Password string `json:"password,omitempty"`
}
if err := vmap.Decode(&vu); err != nil {
if err := vmap.Decode(&scanu); err != nil {
return err
}
u.ID = vu.ID
u.Age = vu.Age
u.Name = vu.Name
u.Last = vu.Last
u.Nickname = vu.Nickname
u.Phone = vu.Phone
u.Password = vu.Password
u.ID = scanu.ID
u.Age = scanu.Age
u.Name = scanu.Name
u.Last = scanu.Last
u.Nickname = scanu.Nickname
u.Phone = scanu.Phone
u.Password = scanu.Password
return nil
}
@@ -200,11 +200,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}
@@ -215,7 +215,7 @@ func (u *Users) FromResponse(res *gremlin.Response) error {
if err != nil {
return err
}
var vu []struct {
var scanu []struct {
ID string `json:"id,omitempty"`
Age int `json:"age,omitempty"`
Name string `json:"name,omitempty"`
@@ -224,10 +224,10 @@ func (u *Users) FromResponse(res *gremlin.Response) error {
Phone string `json:"phone,omitempty"`
Password string `json:"password,omitempty"`
}
if err := vmap.Decode(&vu); err != nil {
if err := vmap.Decode(&scanu); err != nil {
return err
}
for _, v := range vu {
for _, v := range scanu {
*u = append(*u, &User{
ID: v.ID,
Age: v.Age,

View File

@@ -24,19 +24,19 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID uint64
Name sql.NullString
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.Name,
&scanu.ID,
&scanu.Name,
); err != nil {
return err
}
u.ID = vu.ID
u.Name = vu.Name.String
u.ID = scanu.ID
u.Name = scanu.Name.String
return nil
}
@@ -90,11 +90,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}

View File

@@ -37,7 +37,7 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
URL []byte
Raw []byte
@@ -48,43 +48,43 @@ func (u *User) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.URL,
&vu.Raw,
&vu.Dirs,
&vu.Ints,
&vu.Floats,
&vu.Strings,
&scanu.ID,
&scanu.URL,
&scanu.Raw,
&scanu.Dirs,
&scanu.Ints,
&scanu.Floats,
&scanu.Strings,
); err != nil {
return err
}
u.ID = vu.ID
if value := vu.URL; len(value) > 0 {
u.ID = scanu.ID
if value := scanu.URL; len(value) > 0 {
if err := json.Unmarshal(value, &u.URL); err != nil {
return fmt.Errorf("unmarshal field url: %v", err)
}
}
if value := vu.Raw; len(value) > 0 {
if value := scanu.Raw; len(value) > 0 {
if err := json.Unmarshal(value, &u.Raw); err != nil {
return fmt.Errorf("unmarshal field raw: %v", err)
}
}
if value := vu.Dirs; len(value) > 0 {
if value := scanu.Dirs; len(value) > 0 {
if err := json.Unmarshal(value, &u.Dirs); err != nil {
return fmt.Errorf("unmarshal field dirs: %v", err)
}
}
if value := vu.Ints; len(value) > 0 {
if value := scanu.Ints; len(value) > 0 {
if err := json.Unmarshal(value, &u.Ints); err != nil {
return fmt.Errorf("unmarshal field ints: %v", err)
}
}
if value := vu.Floats; len(value) > 0 {
if value := scanu.Floats; len(value) > 0 {
if err := json.Unmarshal(value, &u.Floats); err != nil {
return fmt.Errorf("unmarshal field floats: %v", err)
}
}
if value := vu.Strings; len(value) > 0 {
if value := scanu.Strings; len(value) > 0 {
if err := json.Unmarshal(value, &u.Strings); err != nil {
return fmt.Errorf("unmarshal field strings: %v", err)
}
@@ -137,11 +137,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}

View File

@@ -35,7 +35,7 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
Age sql.NullInt64
Name sql.NullString
@@ -46,23 +46,23 @@ func (u *User) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.Age,
&vu.Name,
&vu.Address,
&vu.Renamed,
&vu.Blob,
&vu.State,
&scanu.ID,
&scanu.Age,
&scanu.Name,
&scanu.Address,
&scanu.Renamed,
&scanu.Blob,
&scanu.State,
); err != nil {
return err
}
u.ID = vu.ID
u.Age = int32(vu.Age.Int64)
u.Name = vu.Name.String
u.Address = vu.Address.String
u.Renamed = vu.Renamed.String
u.Blob = vu.Blob
u.State = user.State(vu.State.String)
u.ID = scanu.ID
u.Age = int32(scanu.Age.Int64)
u.Name = scanu.Name.String
u.Address = scanu.Address.String
u.Renamed = scanu.Renamed.String
u.Blob = scanu.Blob
u.State = user.State(scanu.State.String)
return nil
}
@@ -111,11 +111,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}

View File

@@ -22,16 +22,16 @@ type Group struct {
// FromRows scans the sql response data into Group.
func (gr *Group) FromRows(rows *sql.Rows) error {
var vgr struct {
var scangr struct {
ID int
}
// the order here should be the same as in the `group.Columns`.
if err := rows.Scan(
&vgr.ID,
&scangr.ID,
); err != nil {
return err
}
gr.ID = vgr.ID
gr.ID = scangr.ID
return nil
}
@@ -68,11 +68,11 @@ type Groups []*Group
// FromRows scans the sql response data into Groups.
func (gr *Groups) FromRows(rows *sql.Rows) error {
for rows.Next() {
vgr := &Group{}
if err := vgr.FromRows(rows); err != nil {
scangr := &Group{}
if err := scangr.FromRows(rows); err != nil {
return err
}
*gr = append(*gr, vgr)
*gr = append(*gr, scangr)
}
return nil
}

View File

@@ -22,16 +22,16 @@ type Pet struct {
// FromRows scans the sql response data into Pet.
func (pe *Pet) FromRows(rows *sql.Rows) error {
var vpe struct {
var scanpe struct {
ID int
}
// the order here should be the same as in the `pet.Columns`.
if err := rows.Scan(
&vpe.ID,
&scanpe.ID,
); err != nil {
return err
}
pe.ID = vpe.ID
pe.ID = scanpe.ID
return nil
}
@@ -68,11 +68,11 @@ type Pets []*Pet
// FromRows scans the sql response data into Pets.
func (pe *Pets) FromRows(rows *sql.Rows) error {
for rows.Next() {
vpe := &Pet{}
if err := vpe.FromRows(rows); err != nil {
scanpe := &Pet{}
if err := scanpe.FromRows(rows); err != nil {
return err
}
*pe = append(*pe, vpe)
*pe = append(*pe, scanpe)
}
return nil
}

View File

@@ -39,7 +39,7 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
Age sql.NullInt64
Name sql.NullString
@@ -52,27 +52,27 @@ func (u *User) FromRows(rows *sql.Rows) error {
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.Age,
&vu.Name,
&vu.Phone,
&vu.Buffer,
&vu.Title,
&vu.NewName,
&vu.Blob,
&vu.State,
&scanu.ID,
&scanu.Age,
&scanu.Name,
&scanu.Phone,
&scanu.Buffer,
&scanu.Title,
&scanu.NewName,
&scanu.Blob,
&scanu.State,
); err != nil {
return err
}
u.ID = vu.ID
u.Age = int(vu.Age.Int64)
u.Name = vu.Name.String
u.Phone = vu.Phone.String
u.Buffer = vu.Buffer
u.Title = vu.Title.String
u.NewName = vu.NewName.String
u.Blob = vu.Blob
u.State = user.State(vu.State.String)
u.ID = scanu.ID
u.Age = int(scanu.Age.Int64)
u.Name = scanu.Name.String
u.Phone = scanu.Phone.String
u.Buffer = scanu.Buffer
u.Title = scanu.Title.String
u.NewName = scanu.NewName.String
u.Blob = scanu.Blob
u.State = user.State(scanu.State.String)
return nil
}
@@ -125,11 +125,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}

View File

@@ -24,19 +24,19 @@ type Group struct {
// FromRows scans the sql response data into Group.
func (gr *Group) FromRows(rows *sql.Rows) error {
var vgr struct {
var scangr struct {
ID int
MaxUsers sql.NullInt64
}
// the order here should be the same as in the `group.Columns`.
if err := rows.Scan(
&vgr.ID,
&vgr.MaxUsers,
&scangr.ID,
&scangr.MaxUsers,
); err != nil {
return err
}
gr.ID = vgr.ID
gr.MaxUsers = int(vgr.MaxUsers.Int64)
gr.ID = scangr.ID
gr.MaxUsers = int(scangr.MaxUsers.Int64)
return nil
}
@@ -75,11 +75,11 @@ type Groups []*Group
// FromRows scans the sql response data into Groups.
func (gr *Groups) FromRows(rows *sql.Rows) error {
for rows.Next() {
vgr := &Group{}
if err := vgr.FromRows(rows); err != nil {
scangr := &Group{}
if err := scangr.FromRows(rows); err != nil {
return err
}
*gr = append(*gr, vgr)
*gr = append(*gr, scangr)
}
return nil
}

View File

@@ -27,24 +27,24 @@ type Pet struct {
// FromRows scans the sql response data into Pet.
func (pe *Pet) FromRows(rows *sql.Rows) error {
var vpe struct {
var scanpe struct {
ID int
Age sql.NullInt64
LicensedAt sql.NullTime
}
// the order here should be the same as in the `pet.Columns`.
if err := rows.Scan(
&vpe.ID,
&vpe.Age,
&vpe.LicensedAt,
&scanpe.ID,
&scanpe.Age,
&scanpe.LicensedAt,
); err != nil {
return err
}
pe.ID = vpe.ID
pe.Age = int(vpe.Age.Int64)
if vpe.LicensedAt.Valid {
pe.ID = scanpe.ID
pe.Age = int(scanpe.Age.Int64)
if scanpe.LicensedAt.Valid {
pe.LicensedAt = new(time.Time)
*pe.LicensedAt = vpe.LicensedAt.Time
*pe.LicensedAt = scanpe.LicensedAt.Time
}
return nil
}
@@ -93,11 +93,11 @@ type Pets []*Pet
// FromRows scans the sql response data into Pets.
func (pe *Pets) FromRows(rows *sql.Rows) error {
for rows.Next() {
vpe := &Pet{}
if err := vpe.FromRows(rows); err != nil {
scanpe := &Pet{}
if err := scanpe.FromRows(rows); err != nil {
return err
}
*pe = append(*pe, vpe)
*pe = append(*pe, scanpe)
}
return nil
}

View File

@@ -24,19 +24,19 @@ type User struct {
// FromRows scans the sql response data into User.
func (u *User) FromRows(rows *sql.Rows) error {
var vu struct {
var scanu struct {
ID int
Name sql.NullString
}
// the order here should be the same as in the `user.Columns`.
if err := rows.Scan(
&vu.ID,
&vu.Name,
&scanu.ID,
&scanu.Name,
); err != nil {
return err
}
u.ID = vu.ID
u.Name = vu.Name.String
u.ID = scanu.ID
u.Name = scanu.Name.String
return nil
}
@@ -85,11 +85,11 @@ type Users []*User
// FromRows scans the sql response data into Users.
func (u *Users) FromRows(rows *sql.Rows) error {
for rows.Next() {
vu := &User{}
if err := vu.FromRows(rows); err != nil {
scanu := &User{}
if err := scanu.FromRows(rows); err != nil {
return err
}
*u = append(*u, vu)
*u = append(*u, scanu)
}
return nil
}