From 2480b5c0ef16c123762a7a14b9225cf5af61871e Mon Sep 17 00:00:00 2001 From: Ariel Mashraki Date: Sat, 17 Apr 2021 10:06:10 +0300 Subject: [PATCH] entc/gen: wrap nillable fields with custom go-type with sql.nullscanner --- dialect/sql/driver.go | 14 ++++ doc/website/docusaurus.config.js | 1 - entc/gen/internal/bindata.go | 8 +- entc/gen/template/dialect/sql/decode.tmpl | 30 +++---- entc/gen/template/dialect/sql/query.tmpl | 16 ++-- entc/gen/type.go | 79 ++++++++++++++++++- entc/integration/customid/ent/blob_query.go | 2 +- entc/integration/customid/ent/group_query.go | 2 +- entc/integration/customid/ent/pet_query.go | 2 +- entc/integration/customid/ent/user_query.go | 2 +- entc/integration/edgefield/ent/info.go | 1 - entc/integration/ent/card_query.go | 2 +- entc/integration/ent/fieldtype.go | 39 +++++---- entc/integration/ent/group_query.go | 2 +- entc/integration/ent/schema/fieldtype.go | 1 + entc/integration/ent/spec_query.go | 2 +- entc/integration/ent/user_query.go | 8 +- entc/integration/gremlin/ent/fieldtype.go | 6 +- entc/integration/hooks/ent/user_query.go | 2 +- entc/integration/idtype/ent/user_query.go | 4 +- entc/integration/json/ent/user.go | 7 -- entc/integration/migrate/entv2/user_query.go | 2 +- .../multischema/ent/group_query.go | 2 +- .../integration/multischema/ent/user_query.go | 2 +- entc/integration/privacy/ent/task_query.go | 2 +- entc/integration/privacy/ent/team_query.go | 4 +- entc/integration/privacy/ent/user_query.go | 2 +- entc/integration/template/ent/user_query.go | 2 +- entc/integration/type_test.go | 3 + examples/m2m2types/ent/group_query.go | 2 +- examples/m2m2types/ent/user_query.go | 2 +- examples/m2mbidi/ent/user_query.go | 2 +- examples/m2mrecur/ent/user_query.go | 4 +- examples/privacytenant/ent/group_query.go | 2 +- examples/privacytenant/ent/user.go | 1 - examples/privacytenant/ent/user_query.go | 2 +- examples/start/ent/group_query.go | 2 +- examples/start/ent/user_query.go | 2 +- examples/traversal/ent/group_query.go | 2 +- examples/traversal/ent/pet_query.go | 2 +- examples/traversal/ent/user_query.go | 4 +- 41 files changed, 181 insertions(+), 95 deletions(-) diff --git a/dialect/sql/driver.go b/dialect/sql/driver.go index 33cc1840a..359d51479 100644 --- a/dialect/sql/driver.go +++ b/dialect/sql/driver.go @@ -148,3 +148,17 @@ type ( // TxOptions holds the transaction options to be used in DB.BeginTx. TxOptions = sql.TxOptions ) + +// NullScanner represents an sql.Scanner that may be null. +// NullScanner implements the sql.Scanner interface so it can +// be used as a scan destination, similar to the types above. +type NullScanner struct { + S sql.Scanner + Valid bool // Valid is true if the Scan value is not NULL. +} + +// Scan implements the Scanner interface. +func (n *NullScanner) Scan(value interface{}) error { + n.Valid = value != nil + return n.S.Scan(value) +} diff --git a/doc/website/docusaurus.config.js b/doc/website/docusaurus.config.js index 5e221ce03..eb9faa7c4 100644 --- a/doc/website/docusaurus.config.js +++ b/doc/website/docusaurus.config.js @@ -207,7 +207,6 @@ module.exports={
Design by Moriah Rich, illustration by Ariel Mashraki. `, - }, "algolia": { "apiKey": "bfc8175da1bd5078f1c02e5c8a6fe782", diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index defbe728a..8b2a51333 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -652,7 +652,7 @@ func templateDialectSqlCreateTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlDecodeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x59\x6f\xdb\xb8\x16\x7e\xb6\x7e\xc5\xa9\x90\x14\x56\xe0\xc8\xb9\xc5\xc5\x05\x6e\x3a\x1e\xa0\xe8\x02\x78\x3a\xc8\x14\x49\xd3\x97\x20\x0f\xac\x74\x68\xb3\x91\x49\x87\xa4\x9b\x04\x82\xfe\xfb\x80\x9b\x4c\x7a\xc9\x32\x83\x02\x6d\x10\x91\x67\x3f\xdf\x77\x48\xa6\x6d\xc7\x47\xd9\x7b\xb1\x7c\x90\x6c\x36\xd7\xf0\xe6\xe4\x3f\xff\x3f\x5e\x4a\x54\xc8\x35\x7c\x22\x15\x7e\x17\xe2\x06\xa6\xbc\x2a\xe1\x5d\xd3\x80\x15\x52\x60\xf6\xe5\x4f\xac\xcb\xec\xeb\x9c\x29\x50\x62\x25\x2b\x84\x4a\xd4\x08\x4c\x41\xc3\x2a\xe4\x0a\x6b\x58\xf1\x1a\x25\xe8\x39\xc2\xbb\x25\xa9\xe6\x08\x6f\xca\x93\xb0\x0b\x54\xac\x78\x9d\x31\x6e\xf7\xff\x9c\xbe\xff\x78\x76\xf1\x11\x28\x6b\x10\xfc\x9a\x14\x42\x43\xcd\x24\x56\x5a\xc8\x07\x10\x14\x74\xe4\x4c\x4b\xc4\x32\x3b\x1a\x77\x5d\x96\x99\x1c\x60\x26\xf4\xc3\x12\x4f\x01\xb9\x9e\x89\x92\x89\x31\x72\x6d\xfe\x57\xe3\x19\xf2\xd2\xec\x5d\x54\x62\x89\x10\x54\xa0\x46\xca\x38\x42\x5e\x33\xd2\x60\xa5\xc7\xea\xb6\x19\xd7\x68\x92\x18\x0b\x8e\x39\x74\x9d\x91\x3a\x90\x58\x21\xfb\x89\x12\x4e\x27\x70\x50\x9e\x87\x2f\x6f\xe4\x80\xd5\x7c\xd5\x34\xc6\xbc\x13\x98\x7e\x28\xcf\x56\x4d\xf3\xd5\x2c\x74\x5d\xdb\x02\xa3\xc0\x85\x76\x3b\x97\x0a\xe5\x07\xeb\xb6\x76\x9b\xb1\xfa\x04\x72\x75\xdb\x58\xed\x29\xd7\xff\xfb\x6f\xee\x44\x90\xd7\x21\x94\xca\xc8\x29\xe3\xa7\x66\x95\x4e\x94\x87\x0d\x53\xde\xc9\x7b\xc1\x95\x26\x5c\x17\x5e\x4d\x12\x3e\x43\x38\xa0\x2e\xbe\x4f\x0c\x9b\x5a\x99\xad\x81\x31\xc9\xc9\xc2\x59\xb4\xfa\x7e\x95\x51\x98\x13\xf5\x19\x1f\x7a\x97\x07\x34\xce\x2a\x1b\x44\xba\x13\x98\xa1\xde\x2b\xb8\x4e\x20\x51\x21\xcb\xa5\x59\xf6\xdf\x07\xb4\x0f\xba\x97\xf4\xf6\x26\xa0\xf6\x58\xf7\xba\x2e\x47\xef\x23\x1b\x8f\x41\x55\x84\x7f\x23\xcd\x0a\x0d\x4c\xf5\x4a\x72\x65\xd1\xe4\x0c\x50\x21\xad\x00\x67\x7c\x06\x3f\x9d\x14\x95\x62\x01\xa6\xf2\xe7\xe2\x4e\x95\x19\x5d\xf1\x0a\x86\x47\x26\x86\xf2\x8c\x2c\x4c\x1a\x45\x64\x74\x58\x89\x66\xb5\xe0\x0a\xae\xae\x95\x96\x8c\xcf\x0a\x18\x5e\x5d\x33\xae\x51\x52\x52\x61\xdb\x8d\x00\xa5\x14\xb2\x80\x36\x1b\x78\x0f\xa7\x13\x58\x90\x1b\xdc\x94\x6b\x90\x07\x6b\x45\x91\x0d\x4c\x6c\xcc\xc8\xba\x86\x05\x3f\x6d\x36\x18\xa8\x3b\xa6\xab\x79\x58\xba\x62\xd7\x76\x75\xd0\xb6\xc7\xa1\xbb\x26\xbd\x11\x1c\x04\x25\xd3\x6a\x5f\x33\xdb\xae\xc1\xa0\x22\x0a\x61\x8d\x06\x66\x84\x9d\x98\x57\xe9\xc1\x6a\x76\xe1\x04\xba\x6e\xd4\x17\xd6\x16\xe3\x0b\xa9\x6e\xc8\xcc\xd4\xa3\xb4\x0d\x8a\xe1\x79\x6a\x7d\xf8\x7c\x4d\x7c\x13\xe0\x78\x37\x34\x72\xda\x41\xa1\x08\x01\x07\x38\x24\xe1\x9b\x70\xe8\x8d\x43\xe8\x25\xc7\xfb\xa5\x90\x1a\xeb\x4f\x42\x22\x9b\xf1\xcf\xf8\xd0\xa7\x61\x74\x3c\x94\xe9\x8d\x03\xf3\x66\x86\x49\xa4\x91\x89\x2b\xcb\x37\xe8\xba\xeb\x53\x18\x8f\xad\x24\x0d\x1d\xde\x1b\x7e\x60\x2f\xdd\xe0\x6e\xc2\x54\x53\x86\x46\x79\xbe\xa7\x0c\xe8\x2b\xb4\x23\xff\x1a\x29\x59\x35\xda\xd5\xce\x61\x15\x38\x6b\x46\x40\x17\xba\xfc\x68\x40\x44\x87\xf9\xca\x54\x03\x2b\x8d\xb5\x6f\x3f\x1c\xde\x5a\x18\xdb\xba\xc6\x28\xcd\x47\x11\x40\x8c\xbb\x2e\x33\xff\xbc\x61\x97\xdb\xc8\x38\xc8\x1c\x51\x88\x52\x6c\x16\xa8\xe2\x3e\x1c\x55\x3c\x6a\xf5\x9c\x68\xb8\x43\x89\x9e\x47\x58\xa7\x54\x81\x21\xa1\x1a\xd7\x7c\x2a\x8c\x51\x2d\xac\x89\x38\x2e\xa0\x76\xe4\x04\x66\x25\x33\xb5\xeb\x60\x83\x69\x71\x54\x5b\x5c\x1b\x85\xd8\x12\x26\x15\x8e\x71\x86\x13\x8c\xc2\x62\x04\xdc\x0e\x34\xe4\x43\x27\x5d\xa4\x54\x7b\x0b\x0b\xf8\x0d\xb8\xa5\x90\x2f\x4e\x5c\xf0\x05\x53\x0b\x62\xd8\xc6\x57\x8b\xef\x28\xcd\xb9\x63\x32\xf4\x9e\x4f\xe1\xb0\x86\x57\x13\x38\xac\xf3\x91\x75\x55\xd8\x22\x5b\x58\xb2\xfa\xde\x38\xce\x59\xde\x93\x09\x6f\xdd\x72\x9c\xb1\x1b\xfb\xf7\x66\xde\xff\x48\x67\xbc\x1d\x01\x61\xbb\xeb\x9e\x35\x0b\xd6\xe2\x6e\x28\xec\x64\x81\xfd\x8e\x8e\x86\xc0\x58\x13\x36\xa3\x40\xcc\x28\xde\x3c\x9f\x86\x42\xba\xc5\xa9\xba\xb0\xc5\x0f\x5f\x97\x97\xd3\x0f\x45\xcc\xc7\x3b\xa6\xe7\x80\xf7\xda\x4e\x74\xc8\xa7\xf5\x7d\xee\x62\xca\x2d\x3f\x73\xab\x08\xf9\x39\x56\x79\x52\x08\x47\xba\xb6\x05\x8d\x8b\x65\x43\xf4\xee\xb3\x98\x3a\x1b\x65\xec\x31\x9d\x21\x9e\x7b\x59\x4f\xe1\x11\x08\x3b\x4b\x3c\x9f\xa3\x12\x95\xc3\xa3\x84\xb9\x96\x95\x06\x35\xaf\xc4\x8d\x9b\xa9\x3b\x31\x11\x91\xd0\xd2\xee\xf0\xab\xa5\xa0\x0d\x0d\x98\x81\x82\x75\xe5\xac\x85\x30\x93\x5c\x4d\x05\x26\x10\xfa\xe0\x87\x83\xc3\x67\xb9\x8e\x24\xc9\x6d\x3d\x1e\x77\x1d\xde\x8f\x74\x9a\x6e\xf5\xf9\x99\x6d\xa2\xbf\xa6\x49\x7b\xb2\x7a\xf6\xd0\xdf\x3f\xf3\x43\x09\x18\xb5\x5b\xdb\xd7\xab\x27\x48\x90\x0e\xee\x27\xcf\x8d\x8d\xe3\xce\xb3\xc7\xf0\x64\xc3\xf9\xd0\x32\x8a\x6e\xf3\x89\x46\x6c\xa2\x81\x4b\x45\x54\xe6\x7f\xd6\xa6\xfc\x42\xcb\x55\xa5\x7b\x81\x9b\x32\x5a\xe8\xad\xbf\xb8\x8b\x1b\x5c\xdb\x22\x9b\x21\xce\x4b\x09\xf7\x36\xa6\xda\x0b\xb8\x86\xf5\x0c\x8f\x1d\xe1\xd6\x27\xb7\x3d\xf4\x22\xea\x0d\x3a\x17\x5f\x88\xab\xfc\x46\x1a\x56\xf7\xde\x36\x39\x69\x0d\x6d\xd6\x2a\xba\xba\xd0\x40\xd4\x62\x6d\x20\x8c\x4b\x5a\x9e\xb1\xa6\x21\xdf\x1b\x84\xa1\xbf\x21\x18\xe1\x7e\xd5\x34\xf5\x28\xb9\x40\x3d\xc7\x73\xe2\x75\x6b\x3c\xac\x67\xcb\x3e\x76\x25\x47\xbe\x3b\xea\xa3\xdb\xf1\xe3\x8f\x1e\xdf\xfd\xae\x3f\xce\x1c\x33\xed\xab\xa9\x9c\xd6\xf7\x70\xdc\x6f\xd1\x78\xcb\x85\xbf\xde\x94\xa8\xe3\xed\x73\xac\x62\x4d\x2b\x6c\xa9\xbc\x91\x7d\xdb\x3a\xe8\x07\xbd\xad\x5d\xaf\x3b\xb1\xf8\x4c\xde\x15\xc7\x6e\x00\x94\x53\xf5\xc7\xc5\x5f\x67\xae\x12\x8f\x41\xd3\x03\x73\xeb\xb2\x16\x83\xf3\xa5\xa7\x40\x72\x9d\x0c\xa8\x8c\xfc\xd9\x0b\x59\x8a\x4e\x73\x8f\xe0\xac\x81\xd7\xaf\xed\xfd\xe4\xc8\x01\x19\x7e\x87\x13\x17\x82\xb9\x3f\x48\xfb\xee\xfc\xa1\x04\x2f\x2f\xf9\x82\x48\x35\x27\x8d\x97\x1c\xc1\x6b\x07\x2b\xdd\x23\xca\x17\xab\x78\x6b\x15\xbd\xf9\x36\xdb\xcb\x34\x6f\x70\x57\x0a\xa7\x70\x78\x97\xdb\xb7\x8c\x85\x9e\x07\x57\x3a\x01\x6c\x47\x93\xe7\x6f\x54\xce\xe3\x97\xb4\xa1\x37\xf2\xeb\x9b\x10\xdd\x79\x12\xe2\xda\x2b\xe7\x85\xb9\xcb\xa2\x2c\x60\x38\x27\xea\x8b\x44\xca\xee\xa3\xe0\xcc\xfb\x3c\x0f\xd3\xfa\xb1\x51\xb3\x86\x64\x18\x07\xd6\x7a\x7c\x9c\xee\xea\xdb\x23\xa3\xe7\x68\xbf\x4a\x0a\x63\x47\x98\xdc\xc6\x94\xef\x1d\xdc\xff\xde\x5a\x32\x7e\xd6\xa6\xf7\x40\xbc\xcd\x9e\xf4\xba\xd1\x93\xf5\x1c\x4d\xba\x74\x6e\x7f\x4e\xd5\x17\x2d\xd3\x09\x6b\xdd\xed\x18\x87\xd1\x77\xf4\xeb\x13\xa3\x70\x41\xf8\x43\x9e\xfe\x69\xe1\xef\x00\x00\x00\xff\xff\x1c\x44\xde\x86\x28\x13\x00\x00") +var _templateDialectSqlDecodeTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\xdb\x6e\xdb\xb8\x16\x7d\xb6\xbe\x62\x57\x48\x0a\x2b\x70\xe4\x9c\xe2\xe0\x00\x27\x1d\x0f\x50\xf4\x02\x78\x3a\xc8\x14\x49\xd3\x97\x20\x0f\xac\xb4\x69\xb3\x91\x48\x87\xa4\x9b\x04\x82\xfe\x7d\xc0\x9b\x4c\xc9\x76\x2e\x33\x28\x30\x53\x54\xe4\xe6\xbe\xae\xb5\x48\xb7\x69\xa6\x47\xc9\x7b\xb1\x7a\x90\x6c\xb1\xd4\xf0\xe6\xe4\x3f\xff\x3f\x5e\x49\x54\xc8\x35\x7c\x22\x05\x7e\x17\xe2\x06\xe6\xbc\xc8\xe1\x5d\x55\x81\x35\x52\x60\xf6\xe5\x4f\x2c\xf3\xe4\xeb\x92\x29\x50\x62\x2d\x0b\x84\x42\x94\x08\x4c\x41\xc5\x0a\xe4\x0a\x4b\x58\xf3\x12\x25\xe8\x25\xc2\xbb\x15\x29\x96\x08\x6f\xf2\x93\xb0\x0b\x54\xac\x79\x99\x30\x6e\xf7\xff\x9c\xbf\xff\x78\x76\xf1\x11\x28\xab\x10\xfc\x9a\x14\x42\x43\xc9\x24\x16\x5a\xc8\x07\x10\x14\x74\x14\x4c\x4b\xc4\x3c\x39\x9a\xb6\x6d\x92\x98\x1a\x60\x21\xf4\xc3\x0a\x4f\x01\xb9\x5e\x88\x9c\x89\x29\x72\x6d\xfe\x2f\xa6\x0b\xe4\xb9\xd9\xbb\x28\xc4\x0a\x21\x1c\x81\x12\x29\xe3\x08\x69\xc9\x48\x85\x85\x9e\xaa\xdb\x6a\x5a\xa2\x29\x62\x2a\x38\xa6\xd0\xb6\xc6\xea\x40\x62\x81\xec\x27\x4a\x38\x9d\xc1\x41\x7e\x1e\xbe\xbc\x93\x03\x56\xaa\x82\x70\xe3\xde\x19\xcc\x3f\xe4\x67\x78\x77\x51\x10\xfe\xd5\xac\xb5\x6d\xd3\x00\xa3\xc0\x85\x76\x9b\x97\x0a\xe5\x07\x1b\xb9\x74\x9b\xb1\x87\x19\xa4\x1c\xef\xc6\xea\xb6\xca\xcf\xd6\x55\x35\xe7\xfa\x7f\xff\xcd\x52\x67\x87\xbc\x0c\x29\x15\xc6\x58\x99\x78\x25\x2b\x74\xcf\xc3\xb8\x62\xca\x47\x7a\x2f\xb8\xd2\x84\xeb\xcc\x1f\x93\x84\x2f\x10\x0e\xa8\xcb\xf3\x13\xc3\xaa\x54\x66\x6b\x64\x5c\x72\x52\x3b\x8f\xf6\xbc\x5f\x65\x14\x96\x44\x7d\xc6\x87\x2e\xe4\x01\x1d\x54\x97\x8c\xa2\xe3\x33\x58\xa0\x7e\xcc\x76\x53\x46\xef\x14\x59\xad\xcc\xb2\xff\x3e\xa0\x5d\xea\x9d\xa5\x77\x39\x03\xb5\x3f\x80\x3f\xee\x8a\xf5\x61\x92\xe9\x14\x4c\x6f\xbe\x91\x6a\x8d\x06\xb7\x7a\x2d\xb9\xb2\xf0\x72\x3e\xa8\x90\xd6\x80\x33\xbe\x80\x9f\xce\x8a\x4a\x51\x83\x99\xc1\xb9\xb8\x53\x79\x42\xd7\xbc\x80\xf1\x91\x49\x23\x3f\x23\xb5\xa9\x24\x8b\x9c\x8e\x0b\x51\xad\x6b\xae\xe0\xea\x5a\x69\xc9\xf8\x22\x83\xf1\xd5\x35\xe3\x1a\x25\x25\x05\x36\xed\x04\x50\x4a\x21\x33\x68\x92\x91\x8f\x70\x3a\x83\x9a\xdc\xe0\xd0\xae\x42\x1e\xbc\x65\x59\x32\x32\xb9\x31\x63\xeb\x26\x17\xe2\x34\xc9\x68\xa4\xee\x98\x2e\x96\x61\xe9\x8a\x5d\xdb\xd5\x51\xd3\x1c\x87\x31\x9b\xf2\x26\x70\x10\x0e\x99\x99\xfb\xb6\xd9\xa1\x8d\x46\x05\x51\x08\x1b\x58\x30\x63\xec\xcc\xfc\x91\x0e\xba\x66\x17\x4e\xa0\x6d\x27\x5d\x63\x6d\x33\xbe\x90\xe2\x86\x2c\x4c\x3f\x72\x3b\xa3\x18\xa7\xa7\x36\x86\xaf\xd7\xe4\x37\x33\xb1\x6c\x56\x3e\x01\x93\x6b\x00\x43\x2f\x73\x93\x09\xbd\x71\x28\xbd\xe4\x78\xbf\x12\x52\x63\xf9\x49\x48\x64\x0b\xfe\x19\x1f\xba\x0a\xcc\x19\x0f\x67\x7a\xe3\x00\x3d\x2c\xae\x97\x64\xe4\xe2\xca\x12\x0f\xda\xf6\xfa\x14\xa6\x53\x6b\x49\xc3\x70\x77\x66\x1e\x28\x4c\x07\x04\xde\xa6\xab\x69\x41\xa5\x3c\xf3\xb7\x38\x10\x31\x60\xd8\x82\x12\x29\x59\x57\xda\x75\xce\x21\x15\x38\xab\x26\x40\x6b\x9d\x7f\x34\x10\xa2\xe3\x74\x6d\x1a\x82\x85\xc6\xd2\x0f\x1f\x0e\x6f\x2d\x88\x6d\x67\x63\x8c\xa6\x93\x08\x1e\x59\x32\x1a\xb5\x89\xf9\xcf\x3b\x76\xe5\x4d\x4c\x80\xc4\xd1\x84\x28\xc5\x16\x81\x28\xee\xc3\x11\xc5\x63\x56\x2f\x89\x86\x3b\x94\xe8\x59\x84\x65\x9f\x28\x30\x26\x54\xe3\x86\x4d\x99\x71\xaa\x85\x75\x11\xe7\x05\xd4\x2a\x4f\xe0\x55\x4f\x62\xdb\x16\x06\x3c\x8b\xb3\xda\x62\xda\x24\xe4\xd6\xe3\x51\xe6\xf8\x66\x18\xc1\x28\xd4\x13\xe0\x56\xd7\x90\x8f\x9d\x75\xd6\x27\xda\x5b\xa8\xe1\x37\xe0\x96\x40\xbe\x39\x71\xc3\x6b\xa6\x6a\x62\xb8\xc6\xd7\xf5\x77\x94\xe6\x1a\x32\x15\xfa\xc8\xa7\x70\x58\xc2\xab\x19\x1c\x96\xe9\xc4\x86\xca\x6c\x93\x2d\x32\x59\x79\x6f\x02\xa7\x2c\xed\xa8\x84\xb7\x6e\x39\xae\xd8\x5d\x01\xf7\x46\xfb\x7f\xf4\xa5\xde\x0a\x40\xd8\x6e\xdb\x67\x29\xc1\xc6\xdc\x49\xc2\x4e\x22\xd8\xef\xe8\x86\x08\x7c\x35\x69\x33\x0a\xc4\x68\xf1\xf0\xae\x1a\x0b\xe9\x16\xe7\xea\xc2\x36\x3f\x7c\x5d\x5e\xce\x3f\x64\x31\x25\xef\x98\x5e\x02\xde\x6b\x2b\xe9\x90\xce\xcb\xfb\xd4\xe5\x94\x5a\x8a\xa6\xf6\x20\xa4\xe7\x58\xa4\xbd\x46\x38\xde\x35\x0d\x68\xac\x57\x15\xd1\xbb\xaf\x66\xea\x7c\xe4\x71\xc4\x01\xa3\x1c\xfb\x92\x8e\xc5\x13\x10\x56\x4e\x3c\xa5\xa3\x16\xe5\xe3\xa3\x3e\x79\xed\x21\x46\xe1\x95\xb8\x71\x8a\xba\x13\x13\x11\x09\x2d\xed\x0e\xbf\x5a\x0a\xda\xd4\x80\x19\x28\xd8\x50\xce\x5b\x48\xb3\x57\xab\xe9\x80\x53\x44\xd3\x44\xaf\x0d\x0e\x9f\xf9\x26\x93\x5e\x6d\x1b\x85\xdc\x75\x87\x3f\x32\x69\xba\x35\xe7\x67\x8e\x89\xfe\x9a\x21\xed\xa9\xea\xd9\xba\xbf\x5f\xf6\x43\x0b\x18\xb5\x5b\xdb\x4f\xad\x27\x48\xd0\x97\xee\x27\xaf\x8e\xc1\x65\xe7\xd9\x63\x78\x32\x08\x3e\xb6\x8c\xa2\xdb\x7c\xa2\x11\x9b\x68\xe0\x52\x16\xb5\xf9\x9f\x8d\x29\xbd\xd0\x72\x5d\xe8\xce\xe0\x26\x8f\x16\x3a\xef\x2f\x9e\xe2\x80\x6b\x5b\x64\x33\xc4\x79\x29\xe1\xde\xc6\x54\x7b\x01\xd7\xb0\x5c\xe0\xb1\x23\xdc\xe6\xf2\xb6\x97\x5e\x44\xbd\x51\xeb\xf2\x0b\x79\xe5\xdf\x48\xc5\xca\x2e\xda\x90\x93\xd6\xd1\xb0\x57\x30\x03\x73\xc7\xbb\x20\x9e\xa8\xd9\xc6\x41\x90\x4b\x9a\x9f\xb1\xaa\x22\xdf\x2b\x84\xb1\x7f\x28\x18\xe3\x6e\xd5\x0c\xf5\xa8\xf7\x7c\x7a\x4e\xe4\x5e\xd4\x2d\x79\xd8\x68\xcb\x3e\x76\xf5\xae\x7c\x77\xd5\x47\x6f\xe3\xc7\x7f\x03\xf9\xe9\xb7\xdd\x75\xe6\x98\x69\x7f\x44\xe5\xf3\xf2\x1e\x8e\xbb\x2d\x1a\x6f\xb9\xf4\x37\x9b\x12\x75\xbc\x7d\x8e\x45\x7c\xd2\x1a\x5b\x2a\x0f\xaa\x6f\x1a\x07\xfd\x70\x6e\x6b\xd7\x9f\x9d\x59\x7c\xfa\xaa\x3a\xc7\x56\x01\xf2\xb9\xfa\xe3\xe2\xaf\x33\xb7\xfa\x28\x38\x3d\x34\x5d\xbb\xa3\xd7\x5a\x0c\xcf\x97\xde\x03\xbd\x37\x65\xc0\x65\x14\xcf\x3e\xc9\xfa\xf8\x34\x2f\x09\xce\x2a\x78\xfd\xda\xbe\x50\x8e\x1c\x94\xe1\x77\x38\x71\x29\x98\x17\x84\xb4\x3f\x44\x7f\x28\xc1\xf3\x4b\x5e\x13\xa9\x96\xa4\xf2\x96\x13\x78\xed\x80\xa5\x3b\x4c\xf9\x76\x65\x6f\xed\x41\xef\xbe\x49\xf6\x72\xcd\x3b\xdc\x55\xc2\x29\x1c\xde\xa5\xf6\xb7\x8c\x05\x9f\x87\x57\x5f\x03\xec\x4c\x7b\xbf\x87\xa3\x76\xbe\x68\x0c\x9d\x93\x5f\x3f\x04\x8f\x97\x25\x51\x5f\x24\x52\x76\x1f\x05\x4f\x83\x58\xa5\x5e\xe3\x1e\x13\x94\x0d\xee\x02\xe9\xed\xb3\x35\xbe\x34\x77\xcd\xe6\x11\x81\x39\xda\x7f\xa4\x0f\x55\x47\x8b\xd4\xe6\x94\xee\x95\xe7\x7f\xef\xad\x27\x32\x1b\xd7\x7b\x60\xdc\x24\x4f\x46\xf5\xf2\x19\x24\x73\xa3\x96\x3d\x11\x3d\xb7\x7f\xce\xd5\x17\x2d\xfb\x3a\x6a\xc3\xed\x10\xbd\xe8\x3b\xfa\xeb\x13\x82\x57\x13\xfe\x90\xf6\xff\xf9\xe0\xef\x00\x00\x00\xff\xff\x3a\x11\xe6\x0d\x1d\x13\x00\x00") func templateDialectSqlDecodeTmplBytes() ([]byte, error) { return bindataRead( @@ -667,7 +667,7 @@ func templateDialectSqlDecodeTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 4904, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/decode.tmpl", size: 4893, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } @@ -872,7 +872,7 @@ func templateDialectSqlPredicateTmpl() (*asset, error) { return a, nil } -var _templateDialectSqlQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x3b\x69\x6f\x1b\x47\xb2\x9f\xc9\x5f\x51\x19\xd8\x06\x29\x50\x43\xdb\xef\xe1\x01\x8f\x86\x16\xf0\x5a\x36\x40\x38\x91\xbd\x91\x93\x7c\x10\x84\x64\x34\x53\x43\x35\x38\xec\x19\xcd\x34\x75\x80\xe6\x7f\x5f\x54\xf5\xc1\x9e\x83\x87\x94\x75\xb2\xd8\xec\x07\x49\x64\x77\x55\x57\x75\xdd\x5d\xdd\x5a\xad\xc6\x47\xfd\x77\x79\xf1\x50\x8a\xd9\xb5\x82\xd7\x2f\x5f\xfd\xff\x71\x51\x62\x85\x52\xc1\x87\x28\xc6\xab\x3c\x9f\xc3\x54\xc6\x21\xbc\xcd\x32\x60\xa0\x0a\x68\xbe\xbc\xc5\x24\xec\x7f\xb9\x16\x15\x54\xf9\xb2\x8c\x11\xe2\x3c\x41\x10\x15\x64\x22\x46\x59\x61\x02\x4b\x99\x60\x09\xea\x1a\xe1\x6d\x11\xc5\xd7\x08\xaf\xc3\x97\x76\x16\xd2\x7c\x29\x93\xbe\x90\x3c\xff\xfd\xf4\xdd\xfb\xb3\xf3\xf7\x90\x8a\x0c\xc1\x8c\x95\x79\xae\x20\x11\x25\xc6\x2a\x2f\x1f\x20\x4f\x41\x79\xc4\x54\x89\x18\xf6\x8f\xc6\xeb\x75\xbf\x4f\x7b\x80\x59\xae\x1e\x0a\x9c\x00\x4a\x35\xcb\x43\x91\x8f\x51\x2a\xfa\x89\xc7\x33\x94\x21\xcd\x9d\xc7\x79\x81\xe0\xa1\xbc\x4d\x12\xa1\x44\x2e\xa3\x0c\x52\x81\x59\x52\x41\x9a\x6b\x7e\xaf\x96\x22\x4b\xb0\x0c\x35\xf4\x6a\x05\x09\xa6\x42\x22\x04\x89\x88\x32\x8c\xd5\xb8\xba\xc9\xc6\x37\x4b\x2c\x1f\xc6\x1a\x33\x80\xf5\xba\xdf\x5b\xad\x8e\xe1\x4e\xa8\x6b\x78\x16\xfe\x24\xf1\xbe\xc8\x4b\x85\xc9\x87\xbc\x44\x31\x93\x1f\xf1\xa1\x62\xa0\x1e\x41\x7c\xf8\x58\xc1\x55\x9e\x67\x1a\x07\x65\xd2\xc0\x57\x8b\x22\xab\x60\x72\x02\x8b\x48\xc5\xd7\x5f\x70\x51\x64\x91\xda\x41\x7f\x1c\xb9\xbd\x8c\x8f\x34\x33\xbc\x5a\x19\xc9\x19\xea\xe5\x68\x35\xb3\x2e\x4f\xf7\x56\x2b\xb8\x57\x76\x65\x0d\xf2\x6c\x83\xe9\xf3\x64\x3e\x7b\x1f\x77\xca\x24\xd0\xc0\xf0\xac\x98\xcf\x98\x6a\xc8\xa2\x0f\x3f\x47\xf1\x3c\x9a\xa1\x9d\x35\x42\x26\x88\x22\xaa\xe2\x28\x73\x80\x7f\x37\x33\x06\xb0\xc4\x18\xc5\xad\x86\x74\x9f\x1d\x3a\x71\x93\x2e\x65\x0c\x83\x1a\xec\x7a\x0d\x47\x3e\x95\xf5\x7a\x08\xd5\x4d\xf6\x36\xcb\x06\xb1\xba\x87\x38\x97\x0a\xef\x55\xf8\x4e\xff\x1d\xc2\xe0\xe2\x92\xe1\xc3\xb3\x68\x41\x2c\x8e\x00\xcb\x32\x2f\x87\xb0\xea\xf7\x6e\xa3\x12\x06\xfd\x5e\x4f\xe6\x09\x56\x70\x02\x0d\xd0\x95\x95\xd9\x7e\xdd\x3b\xe5\x9f\x40\x83\xdb\xd0\xcc\x34\xc4\xdf\xfb\xb5\x2a\x30\xee\x00\x67\x49\x9f\x17\x18\x0f\x86\x75\xea\xef\x93\x19\x5a\x6a\x59\x1e\x25\x98\x7c\x79\x28\x34\xdb\xab\x15\x64\x28\x21\x84\xf5\xfa\x92\xac\x6f\x45\x30\xbe\x9d\x20\x89\x38\x34\xc8\x6c\x21\x35\x9a\xf4\x1d\xc3\xf7\xd1\x0c\xcb\xef\xf3\x28\xf9\x40\xa6\x47\x82\xfe\xee\x04\xa4\xc8\x46\x6e\x35\xc7\x7c\xaf\x69\x4d\xc3\x43\x9d\xc4\x07\xfb\xf0\xd1\xdf\x53\x4f\xa4\x24\x0c\xc3\xb1\x18\x79\x5c\xaf\x56\x20\x52\x98\x29\x78\x26\xe0\x25\x31\xf6\xf5\x2b\x81\x6a\xe2\x8f\xdb\x8c\x43\x03\x2d\x24\x4f\x71\xaa\x5c\x22\x8f\x39\x3e\x37\xfb\x15\x29\x58\x40\x8d\xc7\xea\x0b\xcf\xf2\x04\xc3\x77\x79\xb6\x5c\x48\x5a\x21\x2a\x0a\x94\xc9\xa0\x3d\x37\x62\x35\x7b\x8e\x12\x7a\x82\x09\xc3\x70\x68\x64\xea\x13\xd5\xab\x9c\xc7\x91\xfc\x39\xca\x96\xac\x68\x72\x87\x41\x6c\xc8\x5d\x5c\x56\xaa\x14\x72\xc6\x26\x2e\xa4\xc2\x32\x8d\x62\x5c\xd5\x0c\x9c\x2d\x9b\xa4\xf8\xa2\x66\xd7\x71\x2e\x53\x31\x9b\xb4\x6c\x4f\x8f\xaf\x3d\x8f\x30\x3b\xe2\xaf\x23\xa0\x3f\xc4\x6a\x89\x6a\x59\x4a\xfe\x1a\x56\x8e\x41\xcb\xd9\xb0\xdf\x73\xec\xbf\xad\x2a\x31\x93\xdb\x58\x1f\xc1\xad\xde\x5a\x6d\x03\x43\xbd\x01\xe6\x5f\xa4\x64\xd9\x9a\xfe\x10\x4e\x4e\xe0\xa5\x96\xbf\xe1\x20\x5d\xa8\xf0\x3d\x01\xa7\x83\xc0\x06\xa6\xf5\x7a\x02\x86\x6c\x1c\x65\x19\x26\xac\xb9\x7c\xa9\xf8\xab\x90\x33\xd8\xc8\x34\xa0\xdd\xac\x3d\x39\x31\xa1\x8b\x0d\xc9\xe3\x57\x97\xdb\xbd\x90\xf7\xcf\x03\x61\xdd\x21\xbd\x6f\x4d\xb7\xf7\x45\x17\x31\x97\x75\xe1\x59\x91\x68\x21\x12\x2a\x25\xb4\x2c\xcb\xef\x60\xb1\x54\x91\x22\xfe\x29\x93\x55\x37\xd9\xac\x8c\x8a\xeb\xf0\x1f\x36\x5e\xc0\xd5\x03\x25\x49\xc0\x7b\x85\xb2\x12\xb9\xac\x20\x2f\x61\x59\x51\xaa\x36\xd9\xa0\x0a\x39\xef\x3d\x29\x1f\x91\x3a\x1f\x91\x82\x8e\x1f\x99\x83\x48\xd3\x58\x72\x2a\xa8\x6f\x8d\xdc\xa8\xa2\xd0\x3e\x6a\x99\x6b\x52\xd2\xa7\x11\xb0\xa9\x0d\xdf\x30\xbe\xf6\x72\x36\x12\x2b\x6a\x91\xb1\x4b\xb0\x40\xb7\xd8\x93\xa7\x15\x32\x73\x91\x39\xe9\xfb\x01\xb4\xa6\x7d\x27\x43\x96\x77\x02\xcf\x20\xf8\x11\xe3\xc0\xe3\x30\x20\xe8\x80\x70\x5d\x5e\x56\x3b\x04\x8c\x14\xb1\xc8\x72\x84\x9c\x05\x36\x58\x6f\x93\x56\x9b\xe1\x47\x65\xcb\x77\xf9\x52\xaa\x2d\xf9\x52\x48\xe5\x87\x10\x9d\xa7\x26\x7b\x12\xd5\x5f\xc8\x50\x8d\xe8\xdd\xbe\x58\x96\x07\x5b\xe9\xe3\xf4\xf4\xfe\x5e\x54\xdb\xf4\x44\x89\xde\x57\x94\x1c\x59\x07\x6a\x72\xe0\x2b\x7c\xe8\x3c\xad\xed\x29\x69\x94\x55\x38\xda\x1a\x54\xe3\x6b\x8c\xe7\x80\xc4\x12\xca\x18\x27\xf0\xfc\x2e\x60\x9a\x3a\x56\x59\x93\x84\xbf\xc1\xcb\xc7\x9a\xa4\x67\x4b\x70\xd4\x61\x31\xbe\x1d\xbe\x68\xcf\xd3\x1e\x48\x03\x13\x6f\x92\xbe\xdb\xb9\xde\x97\xe8\x2a\xc3\x49\x2b\x09\xf3\x30\x97\x37\x26\x4f\xb7\x41\x6c\x02\x27\xa0\xe9\xa9\x4f\x80\x0b\x0b\x47\xa1\xf7\x85\x4f\x29\x5c\xb5\x73\x09\x12\x4e\x4f\x43\x1a\x23\x8d\x55\xca\x16\x9f\x0c\xaa\xd7\x6c\xd3\xb2\x68\x8c\x11\x49\x65\x11\xf8\x37\xff\xfa\x50\xe6\x8b\x76\xda\xae\x6e\xb8\x46\xfb\x49\x8a\x9b\x25\x4e\xb8\x8e\x19\xd9\x68\xb7\xe4\xc1\x2e\xab\xd0\x33\x6f\x2c\x84\x67\x0e\x3a\x75\xeb\xe5\xe0\x04\x8e\x34\x84\x5d\xd1\x1c\xa9\x3a\x56\xd4\x33\x6f\x38\xc2\xea\xcf\x43\x32\x06\x6f\xcd\x46\xbd\xb4\x88\xe6\x38\xd8\x14\x03\x2f\x47\x3e\xea\x70\x1b\xd6\x23\xaa\xac\x0e\x89\xd2\xb2\x74\x1c\x14\x7c\xea\xe0\xd0\x60\x76\xb4\x32\x85\x9e\xfe\x7a\x21\x2e\x49\x26\x07\xac\xf8\xc4\x8a\xd0\x91\xb1\xc5\x1f\xfd\x68\x11\x17\x9d\xe2\x2d\x4a\x4c\x44\x4c\xd1\x51\x8b\xb8\x68\x89\xf7\xb3\x85\xb0\x05\x57\x85\x19\x1f\xb3\xd9\xa9\xc2\x73\xf3\x4d\x97\x86\x4d\x29\x14\xb6\xb4\x2d\x88\x29\x87\xda\xe6\x2e\x13\x0b\xa1\xba\x18\xe4\x89\x37\x66\xbe\x65\x4f\xdf\xf3\xf0\x09\x1c\xf1\xbc\x5d\x2c\x4f\xd3\x0a\x3b\x57\xd3\x33\x6f\x2c\x44\x6b\xbd\x4f\x7a\xfc\x04\x8e\x34\xc4\x6e\xe1\xe5\x65\x82\xe5\x36\xb9\x7d\xa2\xc9\x6f\x27\x33\x13\x19\x99\x56\x5f\x9f\xb1\x77\x15\x02\x76\x95\x40\x67\xa2\x7e\xbf\x96\x5c\xa3\x84\x0a\x04\x58\xa0\xba\xce\x93\x0a\x54\xce\x59\x96\x31\x8f\x6d\x48\x3d\x38\xc1\x3e\x25\xbf\xb6\x3b\x12\x7b\x92\xec\xf6\x1c\xbb\xbd\x07\x71\x48\x3b\xc2\x13\xd4\x9f\xd9\x79\xe0\x2c\xd4\x9d\xa3\x6b\x16\x44\x96\xe2\x31\x48\x53\xa7\x7a\x4b\x4d\x32\xa6\x64\x70\xd3\x14\x0a\xd5\x2b\x42\xb2\xfd\x2b\x4e\x5c\x83\xce\x74\x36\xec\xf7\x9c\x05\x7b\x18\x9a\x8b\x81\x7a\x65\x03\x50\x0b\xdb\x8c\xd3\x69\x94\x7f\x28\xd7\x0c\xd4\x2b\x5d\x30\x74\xa4\x1c\xdf\x23\x1d\xc5\xce\xe2\xc3\x03\xb0\x7c\xb8\xef\x07\x72\xb3\xff\x34\xb4\x91\xf3\x37\x2e\x2f\x0d\x99\x6f\x59\x62\x52\x94\xf9\x75\x04\xc5\x26\xd0\x6c\xcf\x05\x2c\xff\xc2\x0f\x3d\x07\x2d\xc0\xf1\xb0\x13\xf7\x89\x41\x79\x3c\x36\x81\x5f\x54\xb0\x88\x64\x12\x71\x77\x97\x18\x31\xb0\x71\x16\x2d\x2b\x0c\xe1\x17\x84\x4a\x45\xa5\xd2\x38\x2c\xfe\x04\xd3\x68\x99\x29\x7d\xf4\x1d\x41\x24\x13\xc8\x6f\xb1\x2c\x45\x82\x20\x14\x5c\x21\x29\x5c\xa4\x20\x11\x13\x4c\x42\xdf\x9e\x74\x16\x18\x98\x1c\x30\xd4\x59\x66\xb0\x88\xd4\x75\xf8\x43\x74\x3f\x95\xea\x7f\x5e\x0f\x9f\x9c\xb8\x1c\x15\xbd\xaa\xce\x5c\xb5\x6a\xd7\x42\xf4\xd7\xf5\xa8\x35\x3e\xd2\x21\x79\x5c\x44\x7a\x7f\x42\x62\xb5\x89\xd4\x30\x43\x89\x65\x44\x61\x94\x45\xc4\x50\x79\x0a\x11\xcc\xc4\x2d\x4a\xc0\x64\x86\x87\x34\xa9\x09\x6f\x13\x83\x9f\x49\x36\x3e\x2e\x49\x88\x03\x22\xc7\x8d\x8d\x3b\x23\x72\x8f\x81\xb4\xcc\x17\x86\x82\xc6\x45\xbf\xa3\x4b\x27\xd7\xda\x32\xc4\x10\x2d\x43\x1a\xa0\x9c\x43\xfc\xcf\x4a\x32\x68\x9a\x65\xf6\x55\x5e\x5b\x4f\x24\xe4\x84\xde\x9a\x53\x1e\x38\x76\x00\x7e\x0c\xb6\x30\x3f\x6e\x94\x52\x0f\x63\x1d\x51\xc5\xc5\xdd\x61\xad\x79\x60\x55\xf6\xbe\x2c\x07\x87\xf5\x04\x2a\x85\x45\xad\xef\x70\x86\x77\xe7\x0a\x8b\x01\x59\x80\xab\xf6\x29\x1a\x12\x17\xb2\x7d\x80\x80\xd6\xb8\x1e\x68\x94\xf2\x8e\xb7\xe1\xc8\x5f\xf9\x4b\x3e\xd0\x2d\x4b\x3e\x2d\x74\x2f\xde\x9e\xf4\x46\x1b\xf5\x6d\x6d\x71\x52\xe4\xc0\x7d\xd3\x48\x3f\x62\xc6\x88\xcc\x93\x1e\x9a\x56\x53\x79\x8b\x65\xb5\x19\x6b\x6d\x07\x35\x3f\xcd\xb3\x09\xa9\x52\xa4\x34\xfd\xc3\xeb\x1f\xb4\x76\x4d\x83\xb9\x63\x85\xcf\x1f\x3d\xf4\x30\x0c\x5d\x9f\x35\xab\x70\x1f\xae\x4e\x08\x1e\xbe\xdf\xa4\xd5\xb8\xb4\xf5\xc3\x7a\x11\xa4\xde\x6f\x9c\x27\xc8\x27\xbe\x65\x8e\x20\xa9\x68\x1f\x5b\xaf\xc1\x33\xde\x73\x54\x67\x28\x66\xd7\x57\x79\x59\xed\x2d\x2c\x46\x40\xc6\x3f\xdc\x12\xbb\x28\x46\xec\x8f\x5d\x91\x0e\x57\x5e\x5c\x71\x61\x8c\xbb\x9c\x87\xdc\xb5\x95\xf9\xe2\x3f\x32\x8c\x31\x98\x48\xba\x22\xd8\xf4\xf4\x0f\x8c\x3c\x22\xf9\x6f\xcc\xf9\x0b\xc4\x1c\xf2\x86\x3f\x23\xe6\xfc\xce\x80\xb3\x23\x32\xd4\x9b\xe2\x3b\xbd\x7c\xb7\x3f\xda\x3b\x06\x1d\x36\x3a\xfc\x71\xcb\xb5\xe1\x1b\x83\xe1\xd5\x10\x75\xf3\xd3\xc2\x4c\xe7\x46\x43\xdc\xd0\x32\xbb\xfe\x59\x97\xb3\xa6\xad\xa5\xef\x1c\xb8\x35\x20\x92\x0d\xf4\x22\x2a\x2e\xfc\x7e\x21\xac\xd7\xcd\x0b\xeb\x06\xb6\x29\xee\xed\x95\x95\xd6\xb1\xbe\xb0\xd3\xcd\x08\x91\x54\x17\x1c\x7a\xa7\xa7\x97\xa0\xef\xb4\x78\x9c\x98\x74\x2d\xa9\x74\x6e\x2e\xf4\xc2\xe9\x29\x2f\xeb\x5f\x67\x69\x61\x9c\xab\x72\x19\x2b\x77\x81\xea\xee\xc7\x4d\x0c\xf0\x6f\xc9\xf5\x9d\xa9\xbd\x4f\xef\xf5\x28\xd0\xd2\x2e\x2f\x2e\xeb\x41\xc3\xec\xd0\xc1\xb8\x2e\xa0\x15\x43\x0b\xf4\xb2\x71\x29\xcf\xbc\xf2\xaf\x8e\x8e\x30\x71\x5f\xeb\x0a\xf7\x7a\x34\x34\x69\x80\x6c\x66\x7b\x26\x06\x4d\xba\x82\x92\x86\xd8\xd2\x3b\xde\x11\x9f\x76\xb4\x93\x3b\x62\x92\x46\x31\x7f\x5c\x07\x6f\x62\x9a\x51\x9d\x5d\xa8\x5e\xaf\x0a\x7f\xb9\xc6\x92\xc3\x6c\x38\xb5\x57\x88\x07\x10\xbb\xd0\x57\xe9\x8d\x9d\xbe\x22\x77\xcc\xf8\xe3\x4b\xe7\x99\x97\x23\x48\xe7\x7c\x00\x1f\xfa\x1c\xb2\x93\xe5\x4b\xce\x89\x01\x91\x3f\x5b\x66\xd9\x54\xaa\xff\xfb\xdf\xc0\xdd\xd4\xb3\x31\xff\x54\x61\x79\xca\x8e\x6d\x6f\xe9\x09\xeb\x44\x4f\x12\x92\x51\xf0\x26\x14\xb8\xe5\x85\xdc\xb9\xfa\xc6\x46\xda\x34\x84\x24\x12\x1b\x88\xad\x84\x36\x97\xc0\x46\xd4\x43\xb8\x78\xed\x5f\x43\x1b\x49\x9b\x13\x43\x63\xee\x85\xdd\x0f\xd9\xff\x48\x5f\xaf\x0b\xc9\xdf\xd6\xbe\xb4\xf4\x45\xb4\xa1\x90\x2f\xd5\x08\x84\x84\x2d\x77\xdd\xe4\x12\x0c\x92\xcf\x69\xfb\xf9\x52\x85\x83\xa3\x0d\x1d\xad\x05\x8a\x61\xdf\xe5\x73\xf8\xfa\x15\x90\xe5\xb9\x89\x4b\xbd\xee\x7b\xf1\xa5\xc4\xfb\x02\x63\x85\x09\x88\x44\x1f\xb1\xb9\x6e\x23\xf7\x3b\xce\x97\x2a\x30\x0b\x9b\xb7\x21\x28\xa4\xe5\x40\x48\xc3\x00\xef\xac\x4d\x9f\x64\xfd\xfb\xc8\x0b\xd9\xa0\x9e\x2f\x15\x2b\xc5\x44\xe8\xc6\x05\xeb\xdb\x72\x16\x40\x40\xfb\x0e\x20\xe0\xb8\x14\xb0\x39\x41\x60\xd5\x1c\x38\xad\x1c\x7e\xd9\x3a\x5e\xbc\x5e\xe8\xab\xf8\xc0\xbe\x36\xf1\xec\xa4\x27\xe4\x7e\x8e\x84\xf4\x18\x72\xc6\x57\x63\x4b\x5b\xc7\xbf\x8c\x2b\x0a\xd6\x4e\x4f\x49\x75\x61\x05\x77\x59\xd3\xd2\x61\x7a\xe1\x4c\x22\x12\x32\x4d\x8e\xc9\x13\x78\x7e\x1b\x8c\xc0\x2e\x59\xd7\x90\x48\x29\xf9\x68\xc2\x0c\x7d\x61\x04\x74\xf9\xa6\x46\xd2\x66\x00\x97\x70\xcc\x00\x79\x40\xc7\xb2\xf5\xa5\xea\x58\x9b\xf1\xcd\x13\x94\x9e\x7f\x96\xf7\x3c\xce\x95\x36\x7b\xaa\xb1\x5a\xa6\x78\x44\x59\xd6\x7b\x52\x61\x56\x53\x6c\xed\x82\x7a\x7f\x9d\xb6\xb3\x52\x6b\xbe\x53\x6a\xbd\x5a\xea\x7c\x53\xc1\x49\xfe\x49\x6f\x2a\xea\x1d\x14\xcf\x9e\x7e\xd3\x65\x92\xce\xe9\x81\xce\x3c\x26\x63\x07\x13\x78\x7e\xf7\x9b\xbd\x29\x36\x2a\x62\x70\x93\xc4\xba\x4f\x1b\xd3\xd3\xa9\xb4\x46\xe3\xb2\x90\xb4\x95\xa6\xbb\xec\xd6\x0b\x99\xe7\x7f\x43\x6f\xd7\x5b\xb9\xe6\xbe\x8f\x61\xc3\xd6\x52\x5e\x21\x65\x29\x18\x4c\xf3\xc4\xc2\x37\x78\x3a\x5f\x5d\xf6\xdb\x6e\xb6\x4d\x34\x9e\xab\x35\x24\xa3\x5d\x4f\xe3\x61\x02\xcf\x6f\x7f\x1b\x81\x74\x05\x99\x56\x70\xe3\xca\xc9\x2f\xf4\x34\x73\x17\xe2\x72\x77\xd9\xe6\x3f\xe2\xda\x0d\x3c\x02\xe9\x91\x76\x47\x01\x2a\x0d\x74\xe2\xfd\x74\x27\x3f\x7c\xb4\xd6\x95\xf8\x35\x6f\x67\xf1\xd6\x55\xfc\xd2\xc7\xae\x02\xf8\xb0\xca\x6f\x87\x34\xb8\x74\x48\x59\x4f\xcf\xd0\x7b\x60\xe7\x7b\x0a\xed\x22\x9d\xeb\xbb\xfb\xf0\x4c\x64\x19\xd5\x6f\x9b\x50\x9f\x82\x13\x12\x51\x4e\xe7\x2d\x61\xd6\xf3\x5d\x9c\x4b\x25\xa4\x79\x36\xd8\xeb\x72\xc8\x9e\x66\xc8\x54\x2e\x5d\xa4\x8f\x5c\x64\xdf\x4d\xbb\xdf\x8c\xbe\x46\x90\x17\xe9\xbc\x1e\x7a\x6b\x51\x97\x23\x6e\x3a\xf7\x0d\xca\xc3\xab\x1b\x87\x19\x1c\x39\x21\x3c\xda\x5d\xff\x8d\x5c\xd5\x6e\xe8\x77\x38\x6b\xaa\x4d\xe8\x78\x8e\x0f\xda\x71\x37\xea\xb3\xfe\xfb\xad\x5d\x57\x6e\xf1\xc6\xa7\x9c\x3a\xb7\x39\xde\xd6\x93\xe7\x3e\x87\xeb\x3e\x4f\xf2\xa6\xfc\x33\xa5\x3d\x8e\x9a\x09\x7b\x24\xa5\xaf\x35\xbf\xc4\xf0\x93\x3b\x4f\x1f\x2a\x9f\x1d\x27\xd2\x8e\x17\xcb\x5e\xee\x36\x18\xbb\x5e\x2a\x1b\xa3\x6f\x3f\x10\xae\x2f\xec\xbb\x86\xbb\x96\x0b\xdb\x5c\x0d\x76\x1d\xe8\x1e\x71\x9e\x6b\x35\xa5\xea\xe7\xb4\xf5\x9f\xe5\x7d\xfb\xc2\xaf\x9e\x92\x3b\x82\xdb\x41\x01\x3a\x9d\x6f\x39\x74\xb4\x3c\xf9\x00\xf7\x15\x15\xaf\x44\x9b\xe3\x4c\xdc\xf0\xe2\xee\x88\xee\x97\xde\xd6\xbe\x0f\x8a\xef\xe9\xfc\x0f\x09\x44\x8d\xed\x1c\xc8\x5a\x3b\x7a\xed\xef\x07\xb9\xf3\xb8\x79\x2b\xb6\x5e\xcb\x4d\x27\xc1\x4b\x2c\x7b\x2a\x8e\xda\xd1\xa6\xd9\x7f\x5c\x3f\xa9\x57\xe8\x9f\x9e\x5c\x6b\x30\x2a\x6b\xff\xb6\xf2\xb6\x9c\x6d\xe6\xf8\x35\x96\x3f\xbb\xb1\x4c\x7d\x27\xb1\xcc\x32\x45\x41\xd2\x03\xf1\x7a\x0b\x7d\x6b\xbc\xd7\x51\xf5\xb9\xc4\x54\xdc\x7b\x28\x41\x75\x93\x05\xa6\x5f\xcc\xda\xd3\x7a\x30\xd8\x9a\x10\x33\xe7\x6e\x15\xbc\xe6\xb4\x96\xb1\xcc\x95\xc3\xeb\xd2\x1f\x2d\x1b\x79\xfb\x79\xe4\x7f\xf6\x8c\x8b\x12\x8b\xa8\x44\x7e\xe2\xe9\x49\x6c\xfb\x3f\xfa\x1c\x78\x87\x6b\xc2\x46\xba\xfd\x21\x82\xf7\xf8\x8e\xfc\xa2\x19\xf3\x7e\x8e\x32\x91\xe8\x90\x37\x48\x87\xb5\xc7\xff\x2f\x78\x8e\x2f\xa2\xd8\x67\x56\xe4\x0c\x13\x48\x39\x70\x4d\xb6\x3e\x63\x15\xf2\x96\xf0\xf4\xfb\x3b\x78\x7e\xc3\xee\xa2\xff\xbf\x69\x04\xe9\xd0\x3d\xdb\xf2\x64\xf7\xcf\x00\x00\x00\xff\xff\x71\x0d\xd6\xdd\x4d\x37\x00\x00") +var _templateDialectSqlQueryTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x1b\x6b\x6f\x1b\xc7\xf1\x33\xf9\x2b\x26\x07\x3b\x20\x05\xea\x68\xbb\x45\x81\xd2\x50\x01\xd7\xb2\x01\xc2\x89\xec\x46\x4e\xf2\x41\x10\x92\xd3\xdd\x1c\xb5\xe0\x71\xef\x74\xb7\xd4\x03\x34\xff\x7b\x31\xb3\x0f\xee\x3d\xf8\x90\x52\x27\x45\xd3\x0f\x92\xc8\xdd\x99\x9d\xd9\x79\xef\xec\x6a\xb5\x1a\x1f\xf5\xdf\xe6\xc5\x43\x29\x66\xd7\x0a\x5e\xbd\x78\xf9\xf7\xe3\xa2\xc4\x0a\xa5\x82\xf7\x51\x8c\x57\x79\x3e\x87\xa9\x8c\x43\x78\x93\x65\xc0\x40\x15\xd0\x7c\x79\x8b\x49\xd8\xff\x7c\x2d\x2a\xa8\xf2\x65\x19\x23\xc4\x79\x82\x20\x2a\xc8\x44\x8c\xb2\xc2\x04\x96\x32\xc1\x12\xd4\x35\xc2\x9b\x22\x8a\xaf\x11\x5e\x85\x2f\xec\x2c\xa4\xf9\x52\x26\x7d\x21\x79\xfe\xbb\xe9\xdb\x77\x67\xe7\xef\x20\x15\x19\x82\x19\x2b\xf3\x5c\x41\x22\x4a\x8c\x55\x5e\x3e\x40\x9e\x82\xf2\x88\xa9\x12\x31\xec\x1f\x8d\xd7\xeb\x7e\x9f\xf6\x00\xb3\x5c\x3d\x14\x38\x01\x94\x6a\x96\x87\x22\x1f\xa3\x54\xf4\x13\x8f\x67\x28\x43\x9a\x3b\x8f\xf3\x02\xc1\x43\x79\x93\x24\x42\x89\x5c\x46\x19\xa4\x02\xb3\xa4\x82\x34\xd7\xfc\x5e\x2d\x45\x96\x60\x19\x6a\xe8\xd5\x0a\x12\x4c\x85\x44\x08\x12\x11\x65\x18\xab\x71\x75\x93\x8d\x6f\x96\x58\x3e\x8c\x35\x66\x00\xeb\x75\xbf\xb7\x5a\x1d\xc3\x9d\x50\xd7\xf0\x2c\xfc\x51\xe2\x7d\x91\x97\x0a\x93\xf7\x79\x89\x62\x26\x3f\xe0\x43\xc5\x40\x3d\x82\x78\xff\xa1\x82\xab\x3c\xcf\x34\x0e\xca\xa4\x81\xaf\x16\x45\x56\xc1\xe4\x04\x16\x91\x8a\xaf\x3f\xe3\xa2\xc8\x22\xb5\x83\xfe\x38\x72\x7b\x19\x1f\x69\x66\x78\xb5\x32\x92\x33\xd4\xcb\xd1\x6a\x66\x5d\x9e\xee\xad\x56\x70\xaf\xec\xca\x1a\xe4\xd9\x06\xd3\xe7\xc9\x7c\xf6\x3e\xee\x94\x49\xa0\x81\xe1\x59\x31\x9f\x31\xd5\x90\x45\x1f\x7e\x8a\xe2\x79\x34\x43\x3b\x6b\x84\x4c\x10\x45\x54\xc5\x51\xe6\x00\xff\x69\x66\x0c\x60\x89\x31\x8a\x5b\x0d\xe9\x3e\x3b\x74\xe2\x26\x5d\xca\x18\x06\x35\xd8\xf5\x1a\x8e\x7c\x2a\xeb\xf5\x10\xaa\x9b\xec\x4d\x96\x0d\x62\x75\x0f\x71\x2e\x15\xde\xab\xf0\xad\xfe\x3b\x84\xc1\xc5\x25\xc3\x87\x67\xd1\x82\x58\x1c\x01\x96\x65\x5e\x0e\x61\xd5\xef\xdd\x46\x25\x0c\xfa\xbd\x9e\xcc\x13\xac\xe0\x04\x1a\xa0\x2b\x2b\xb3\xfd\xba\x77\xca\x3f\x81\x06\xb7\xa1\x99\x69\x88\xbf\xf7\x4b\x55\x60\xdc\x01\xce\x92\x3e\x2f\x30\x1e\x0c\xeb\xd4\xdf\x25\x33\xb4\xd4\xb2\x3c\x4a\x30\xf9\xfc\x50\x68\xb6\x57\x2b\xc8\x50\x42\x08\xeb\xf5\x25\x59\xdf\x8a\x60\x7c\x3b\x41\x12\x71\x68\x90\xd9\x42\x6a\x34\xe9\x3b\x86\xef\xa2\x19\x96\xdf\xe5\x51\xf2\x9e\x4c\x8f\x04\xfd\xcd\x09\x48\x91\x8d\xdc\x6a\x8e\xf9\x5e\xd3\x9a\x86\x87\x3a\x89\x0f\xf6\xfe\x83\xbf\xa7\x9e\x48\x49\x18\x86\x63\x31\xf2\xb8\x5e\xad\x40\xa4\x30\x53\xf0\x4c\xc0\x0b\x62\xec\xcb\x17\x02\xd5\xc4\x1f\xb7\x19\x87\x06\x5a\x48\x9e\xe2\x54\xb9\x44\x1e\x73\x7c\x6e\xf6\x2b\x52\xb0\x80\x1a\x8f\xd5\x17\x9e\xe5\x09\x86\x6f\xf3\x6c\xb9\x90\xb4\x42\x54\x14\x28\x93\x41\x7b\x6e\xc4\x6a\xf6\x1c\x25\xf4\x04\x13\x86\xe1\xd0\xc8\xd4\x27\xaa\x57\x39\x8f\x23\xf9\x53\x94\x2d\x59\xd1\xe4\x0e\x83\xd8\x90\xbb\xb8\xac\x54\x29\xe4\x8c\x4d\x5c\x48\x85\x65\x1a\xc5\xb8\xaa\x19\x38\x5b\x36\x49\xf1\xdb\x9a\x5d\xc7\xb9\x4c\xc5\x6c\xd2\xb2\x3d\x3d\xbe\xf6\x3c\xc2\xec\x88\xbf\x8e\x80\xfe\x10\xab\x25\xaa\x65\x29\xf9\x6b\x58\x39\x06\x2d\x67\xc3\x7e\xcf\xb1\xff\xa6\xaa\xc4\x4c\x6e\x63\x7d\x04\xb7\x7a\x6b\xb5\x0d\x0c\xf5\x06\x98\x7f\x91\x92\x65\x6b\xfa\x43\x38\x39\x81\x17\x5a\xfe\x86\x83\x74\xa1\xc2\x77\x04\x9c\x0e\x02\x1b\x98\xd6\xeb\x09\x18\xb2\x71\x94\x65\x98\xb0\xe6\xf2\xa5\xe2\xaf\x42\xce\x60\x23\xd3\x80\x76\xb3\xf6\xe4\xc4\x84\x2e\x36\x24\x8f\x5f\x5e\x6e\xf7\x42\xde\x3f\x0f\x84\x75\x87\xf4\xbe\x35\xdd\xde\x17\x5d\xc4\x5c\xd6\x85\x67\x45\xa2\x85\x48\xa8\x94\xd0\xb2\x2c\xbf\x83\xc5\x52\x45\x8a\xf8\xa7\x4c\x56\xdd\x64\xb3\x32\x2a\xae\xc3\x7f\xd9\x78\x01\x57\x0f\x94\x24\x01\xef\x15\xca\x4a\xe4\xb2\x82\xbc\x84\x65\x45\xa9\xda\x64\x83\x2a\xe4\xbc\xf7\xa4\x7c\x44\xea\x7c\x44\x0a\x3a\x7e\x64\x0e\x22\x4d\x63\xc9\xa9\xa0\xbe\x35\x72\xa3\x8a\x42\xfb\xa8\x65\xae\x49\x49\x9f\x46\xc0\xa6\x36\x7c\xcd\xf8\xda\xcb\xd9\x48\xac\xa8\x45\xc6\x2e\xc1\x02\xdd\x62\x4f\x9e\x56\xc8\xcc\x45\xe6\xa4\xef\x07\xd0\x9a\xf6\x9d\x0c\x59\xde\x09\x3c\x83\xe0\x07\x8c\x03\x8f\xc3\x80\xa0\x03\xc2\x75\x79\x59\xed\x10\x30\x52\xc4\x22\xcb\x11\x72\x16\xd8\x60\xbd\x4d\x5a\x6d\x86\x1f\x95\x2d\xdf\xe6\x4b\xa9\xb6\xe4\x4b\x21\x95\x1f\x42\x74\x9e\x9a\xec\x49\x54\x7f\x22\x43\x35\xa2\x77\xfb\x62\x59\x1e\x6c\xa5\x8f\xd3\xd3\xbb\x7b\x51\x6d\xd3\x13\x25\x7a\x5f\x51\x72\x64\x1d\xa8\xc9\x81\xaf\xf0\xa1\xf3\xb4\xb6\xa7\xa4\x51\x56\xe1\x68\x6b\x50\x8d\xaf\x31\x9e\x03\x12\x4b\x28\x63\x9c\xc0\xf3\xbb\x80\x69\xea\x58\x65\x4d\x12\xfe\x01\x2f\x1e\x6b\x92\x9e\x2d\xc1\x51\x87\xc5\xf8\x76\xf8\x6d\x7b\x9e\xf6\x40\x1a\x98\x78\x93\xf4\xdd\xce\xf5\x3e\x47\x57\x19\x4e\x5a\x49\x98\x87\xb9\xbc\x31\x79\xba\x0d\x62\x13\x38\x01\x4d\x4f\x7d\x02\x5c\x58\x38\x0a\xbd\xcf\x7c\x4a\xe1\xaa\x9d\x4b\x90\x70\x7a\x1a\xd2\x18\x69\xac\x52\xb6\xf8\x64\x50\xbd\x66\x9b\x96\x45\x63\x8c\x48\x2a\x8b\xc0\xbf\xf9\xd7\xfb\x32\x5f\xb4\xd3\x76\x75\xc3\x35\xda\x8f\x52\xdc\x2c\x71\xc2\x75\xcc\xc8\x46\xbb\x25\x0f\x76\x59\x85\x9e\x79\x6d\x21\x3c\x73\xd0\xa9\x5b\x2f\x07\x27\x70\xa4\x21\xec\x8a\xe6\x48\xd5\xb1\xa2\x9e\x79\xcd\x11\x56\x7f\x1e\x92\x31\x78\x6b\x36\xea\xa5\x45\x34\xc7\xc1\xa6\x18\x78\x31\xf2\x51\x87\xdb\xb0\x1e\x51\x65\x75\x48\x94\x96\xa5\xe3\xa0\xe0\x53\x07\x87\x06\xb3\xa3\x95\x29\xf4\xf4\xd7\x0b\x71\x49\x32\x39\x60\xc5\x27\x56\x84\x8e\x8c\x2d\xfe\xe8\x47\x8b\xb8\xe8\x14\x6f\x51\x62\x22\x62\x8a\x8e\x5a\xc4\x45\x4b\xbc\x9f\x2c\x84\x2d\xb8\x2a\xcc\xf8\x98\xcd\x4e\x15\x9e\x9b\x6f\xba\x34\x6c\x4a\xa1\xb0\xa5\x6d\x41\x4c\x39\xd4\x36\x77\x99\x58\x08\xd5\xc5\x20\x4f\xbc\x36\xf3\x2d\x7b\xfa\x8e\x87\x4f\xe0\x88\xe7\xed\x62\x79\x9a\x56\xd8\xb9\x9a\x9e\x79\x6d\x21\x5a\xeb\x7d\xd4\xe3\x27\x70\xa4\x21\x76\x0b\x2f\x2f\x13\x2c\xb7\xc9\xed\x23\x4d\x7e\x3d\x99\x99\xc8\xc8\xb4\xfa\xfa\x8c\xbd\xab\x10\xb0\xab\x04\x3a\x13\xf5\xfb\xb5\xe4\x1a\x25\x54\x20\xc0\x02\xd5\x75\x9e\x54\xa0\x72\xce\xb2\x8c\x79\x6c\x43\xea\xc1\x09\xf6\x29\xf9\xb5\xdd\x91\xd8\x93\x64\xb7\xe7\xd8\xed\x3d\x88\x43\xda\x11\x9e\xa0\xfe\xc8\xce\x03\x67\xa1\xee\x1c\x5d\xb3\x20\xb2\x14\x8f\x41\x9a\x3a\xd5\x5b\x6a\x92\x31\x25\x83\x9b\xa6\x50\xa8\x5e\x12\x92\xed\x5f\x71\xe2\x1a\x74\xa6\xb3\x61\xbf\xe7\x2c\xd8\xc3\xd0\x5c\x0c\xd4\x4b\x1b\x80\x5a\xd8\x66\x9c\x4e\xa3\xfc\x43\xb9\x66\xa0\x5e\xea\x82\xa1\x23\xe5\xf8\x1e\xe9\x28\x76\x16\x1f\x1e\x80\xe5\xc3\x7d\x3f\x90\x9b\xfd\xa7\xa1\x8d\x9c\xbf\x72\x79\x69\xc8\x7c\xcd\x12\x93\xa2\xcc\x2f\x23\x28\x36\x81\x66\x7b\x2e\x60\xf9\x17\x7e\xe8\x39\x68\x01\x8e\x87\x9d\xb8\x4f\x0c\xca\xe3\xb1\x09\xfc\xa2\x82\x45\x24\x93\x88\xbb\xbb\xc4\x88\x81\x8d\xb3\x68\x59\x61\x08\x3f\x23\x54\x2a\x2a\x95\xc6\x61\xf1\x27\x98\x46\xcb\x4c\xe9\xa3\xef\x08\x22\x99\x40\x7e\x8b\x65\x29\x12\x04\xa1\xe0\x0a\x49\xe1\x22\x05\x89\x98\x60\x12\xfa\xf6\xa4\xb3\xc0\xc0\xe4\x80\xa1\xce\x32\x83\x45\xa4\xae\xc3\xef\xa3\xfb\xa9\x54\x7f\x79\x35\x7c\x72\xe2\x72\x54\xf4\xaa\x3a\x73\xd5\xaa\x5d\x0b\xd1\x5f\xd7\xa3\xd6\xf8\x48\x87\xe4\x71\x11\xe9\xfd\x09\x89\xd5\x26\x52\xc3\x0c\x25\x96\x11\x85\x51\x16\x11\x43\xe5\x29\x44\x30\x13\xb7\x28\x01\x93\x19\x1e\xd2\xa4\x26\xbc\x4d\x0c\x7e\x26\xd9\xf8\xb8\x24\x21\x0e\x88\x1c\x37\x36\xee\x8c\xc8\x3d\x06\xd2\x32\x5f\x18\x0a\x1a\x17\xfd\x8e\x2e\x9d\x5c\x6b\xcb\x10\x43\xb4\x0c\x69\x80\x72\x0e\xf1\x3f\x2b\xc9\xa0\x69\x96\xd9\x57\x79\x6d\x3d\x91\x90\x13\x7a\x6b\x4e\x79\xe0\xd8\x01\xf8\x31\xd8\xc2\xfc\xb0\x51\x4a\x3d\x8c\x75\x44\x15\x17\x77\x87\xb5\xe6\x81\x55\xd9\xbb\xb2\x1c\x1c\xd6\x13\xa8\x14\x16\xb5\xbe\xc3\x19\xde\x9d\x2b\x2c\x06\x64\x01\xae\xda\xa7\x68\x48\x5c\xc8\xf6\x01\x02\x5a\xe3\x7a\xa0\x51\xca\x3b\xde\x86\x23\x7f\xe5\xcf\xf9\x40\xb7\x2c\xf9\xb4\xd0\xbd\x78\x7b\xd2\x1b\x6d\xd4\xb7\xb5\xc5\x49\x91\x03\xf7\x4d\x23\xfd\x80\x19\x23\x32\x4f\x7a\x68\x5a\x4d\xe5\x2d\x96\xd5\x66\xac\xb5\x1d\xd4\xfc\x34\xcf\x26\xa4\x4a\x91\xd2\xf4\xf7\xaf\xbe\xd7\xda\x35\x0d\xe6\x8e\x15\x3e\x7d\xf0\xd0\xc3\x30\x74\x7d\xd6\xac\xc2\x7d\xb8\x3a\x21\x78\xf8\x7e\x93\x56\xe3\xd2\xd6\x0f\xeb\x45\x90\x7a\xbf\x72\x9e\x20\x9f\xf8\x9a\x39\x82\xa4\xa2\x7d\x6c\xbd\x06\xcf\x78\xcf\x51\x9d\xa1\x98\x5d\x5f\xe5\x65\xb5\xb7\xb0\x18\x01\x19\xff\x70\x4b\xec\xa2\x18\xb1\x3f\x76\x45\x3a\x5c\x79\x71\xc5\x85\x31\xee\x72\x1e\x72\xd7\x56\xe6\x8b\xff\xc9\x30\xc6\x60\x22\xe9\x8a\x60\xd3\xd3\xdf\x31\xf2\x88\xe4\xff\x31\xe7\x4f\x10\x73\xc8\x1b\xfe\x88\x98\xf3\x1b\x03\xce\x8e\xc8\x50\x6f\x8a\xef\xf4\xf2\xdd\xfe\x68\xef\x18\x74\xd8\xe8\xf0\xc7\x2d\xd7\x86\xaf\x0d\x86\x57\x43\xd4\xcd\x4f\x0b\x33\x9d\x1b\x0d\x71\x43\xcb\xec\xfa\x27\x5d\xce\x9a\xb6\x96\xbe\x73\xe0\xd6\x80\x48\x36\xd0\x8b\xa8\xb8\xf0\xfb\x85\xb0\x5e\x37\x2f\xac\x1b\xd8\xa6\xb8\xb7\x57\x56\x5a\xc7\xfa\xc2\x4e\x37\x23\x44\x52\x5d\x70\xe8\x9d\x9e\x5e\x82\xbe\xd3\xe2\x71\x62\xd2\xb5\xa4\xd2\xb9\xb9\xd0\x0b\xa7\xa7\xbc\xac\x7f\x9d\xa5\x85\x71\xae\xca\x65\xac\xdc\x05\xaa\xbb\x1f\x37\x31\xc0\xbf\x25\xd7\x77\xa6\xf6\x3e\xbd\xd7\xa3\x40\x4b\xbb\xbc\xb8\xac\x07\x0d\xb3\x43\x07\xe3\xba\x80\x56\x0c\x2d\xd0\xcb\xc6\xa5\x3c\xf3\xca\xbf\x3a\x3a\xc2\xc4\x7d\xad\x2b\xdc\xeb\xd1\xd0\xa4\x01\xb2\x99\xed\x99\x18\x34\xe9\x0a\x4a\x1a\x62\x4b\xef\x78\x47\x7c\xda\xd1\x4e\xee\x88\x49\x1a\xc5\xfc\x71\x1d\xbc\x89\x69\x46\x75\x76\xa1\x7a\xbd\x2a\xfc\xf9\x1a\x4b\x0e\xb3\xe1\xd4\x5e\x21\x1e\x40\xec\x42\x5f\xa5\x37\x76\xfa\x92\xdc\x31\xe3\x8f\x2f\x9c\x67\x5e\x8e\x20\x9d\xf3\x01\x7c\xe8\x73\xc8\x4e\x96\x2f\x39\x27\x06\x44\xfe\x6c\x99\x65\x53\xa9\xfe\xf6\xd7\xc0\xdd\xd4\xb3\x31\xff\x58\x61\x79\xca\x8e\x6d\x6f\xe9\x09\xeb\x44\x4f\x9e\xc7\x91\x34\x0a\xde\x84\x02\xb7\xbc\x90\x3b\x57\xdf\xd8\x48\x9b\x86\x90\x44\x62\x03\xb1\x95\xd0\xe6\x12\xd8\x88\x7a\x08\x17\xaf\xfc\x6b\x68\x23\x69\x73\x62\x68\xcc\x49\xbc\x1b\xd8\x2d\x51\xfe\x03\x3b\x20\x24\x7d\x5f\xfb\x12\xd3\x97\xd1\x86\x4a\xbe\x54\x23\x10\x12\xb6\xdc\x77\x93\x5b\x30\x48\x3e\x27\x11\xe4\x4b\x15\x0e\x8e\x3c\x42\x1a\x44\xa4\xf0\x4d\x3e\x87\x2f\x5f\x00\x59\xa6\x9b\xd8\xd4\xeb\xbe\x1b\x5f\x4a\xbc\x2f\x30\x56\x98\x80\x48\xf4\x31\x9b\x6b\x37\x72\xc1\xe3\x7c\xa9\x02\xb3\xb0\x79\x1f\x82\x42\x5a\x0e\x84\x34\x0c\xe8\x8d\xb5\xe8\x93\xbc\x7f\x1b\x79\x21\x1b\xd4\xf3\xa5\x62\xc5\x98\x28\xdd\xb8\x64\x7d\x53\xce\x02\x08\x68\xdf\x01\x04\x1c\x9b\x02\x36\x29\x08\xac\xaa\x03\x2b\xad\x47\x5c\xb8\x8e\x17\xaf\x16\xfa\x3a\x3e\xb0\x2f\x4e\x3c\x5b\xe9\x09\xb9\x9f\x23\x21\x3d\x86\x9c\x01\xd6\xd8\x62\x19\xfe\xe7\xb8\xa2\x80\xed\xf4\x94\x54\x17\x56\x70\x97\x35\x2d\x1d\xa6\x17\xce\x26\x22\x21\xd3\xe4\xb8\x3c\x81\xe7\xb7\xc1\x08\xec\x92\x75\x0d\x89\x94\x12\x90\x26\xcc\xd0\x17\x46\x40\x97\xaf\x6b\x24\x6d\x16\x70\x49\xc7\x0c\x90\x07\x74\x2c\x5b\x5f\xaa\x8e\xb5\x19\xdf\x3c\x43\xe9\xf9\xe7\x79\xcf\xe3\x5c\x79\xb3\xa7\x22\xab\x65\x8b\x47\x94\x66\xbd\x27\x15\x67\x35\xc5\xd6\x2e\xa9\xf7\xd7\x6a\x3b\xab\xb5\xe6\x5b\xa5\xd6\xcb\xa5\xce\x77\x15\x9c\xe8\x9f\xf4\xae\xa2\xde\x45\xf1\xec\xe9\x57\x5d\x2a\xe9\xbc\x1e\xe8\xec\x63\xb2\x76\x30\x81\xe7\x77\xbf\xda\xdb\x62\xa3\x22\x06\x37\x89\xac\xfb\xc4\x31\x3d\x9d\x4a\x6b\x34\x2e\x13\x49\x5b\x6d\xba\x0b\x6f\xbd\x90\x79\x02\x38\xf4\x76\xbd\x95\x6b\xee\xfd\x18\x36\x6c\x3d\xe5\x15\x53\x96\x82\xc1\x34\xcf\x2c\x7c\x83\xa7\x33\xd6\x65\xbf\xed\x66\xdb\x44\xe3\xb9\x5a\x43\x32\xda\xf5\x34\x1e\x26\xf0\xfc\xf6\xd7\x11\x48\x57\x94\x69\x05\x37\xae\x9d\xfc\x62\x4f\x33\x77\x21\x2e\x77\x97\x6e\xfe\x43\xae\xdd\xc0\x23\x90\x1e\x69\x77\x1c\xa0\xf2\x40\x27\xdf\x8f\x77\xf2\xfd\x07\x6b\x5d\x89\x5f\xf7\x76\x16\x70\x5d\x05\x30\x7d\xec\x2a\x82\x0f\xab\xfe\x76\x48\x83\xcb\x87\x94\xf5\xf4\x0c\xbd\x47\x76\xbe\xa7\xd0\x2e\xd2\xb9\xbe\xbf\x0f\xcf\x44\x96\x51\x0d\xb7\x09\xf5\x29\x38\x21\x11\xe5\x74\xde\x12\x66\x3d\xdf\xc5\xb9\x54\x42\x9a\xa7\x83\xbd\x2e\x87\xec\x69\x86\x4c\xf5\xd2\x45\xfa\xc8\x45\xf6\xdd\xb4\xfb\xcd\xe8\x6b\x04\x79\x91\xce\xeb\xa1\xb7\x16\x75\x39\xe2\xa6\x73\xdf\xa0\x3c\xbc\xba\x71\x98\xc1\x91\x13\xc2\xa3\xdd\xf5\xbf\xc8\x55\xed\x86\x7e\x83\xb3\xa6\xda\x84\x8e\xe7\xf8\xa0\x1d\x77\xa3\x3e\xeb\xbf\x5f\xdb\x75\xe5\x16\x6f\x7c\xca\xc9\x73\x9b\xe3\x6d\x3d\x7d\xee\x73\xb8\xee\x33\x25\x6f\xca\x3f\x57\xda\x23\xa9\x99\xb0\xc7\x52\xfa\x5a\xf3\x4b\x0c\x3f\xba\x33\xf5\xa1\xf2\xd9\x71\x2a\xed\x78\xb5\xec\xe5\x6e\x83\xb1\xeb\xb5\xb2\x31\xfa\xf6\x23\xe1\xfa\xc2\xbe\x6b\xb8\xab\xb9\xb0\xcd\xd5\x60\xd7\xa1\xee\x11\x67\xba\x56\x63\xaa\x7e\x56\x5b\xff\x51\xde\xb7\x2f\xfc\xea\x29\xb9\x23\xb8\x1d\x14\xa0\xd3\xf9\x96\x43\x47\xcb\x93\x0f\x70\x5f\x51\xf1\x4a\xb4\x39\xce\xc4\x0d\x2f\xee\x8e\xe8\x7e\xe9\x6d\xed\xfb\xa0\xf8\x9e\xce\x7f\x97\x40\xd4\xd8\xce\x81\xac\xb5\xa3\xd7\xfe\x9e\x90\x3b\x93\x9b\xf7\x62\xeb\xb5\xdc\x74\x13\xbc\xc4\xb2\xa7\xe2\xa8\x1d\x6d\x9a\x3d\xc8\xf5\x93\xfa\x85\xfe\xe9\xc9\xb5\x07\xa3\xb2\xf6\xaf\x2b\x6f\xca\xd9\x66\x8e\x5f\x64\xf9\xb3\x1b\xcb\xe4\xf9\x2a\x8e\xa4\xa2\x20\xe9\x81\x78\xfd\x85\xbe\x35\xde\xeb\xa8\xfa\x54\x62\x2a\xee\x3d\x94\xa0\xba\xc9\x02\xd3\x33\x66\xed\xb1\x1e\x2c\xb6\x26\xc4\xcc\xb9\x9b\x05\xaf\x41\xad\x65\x2c\x73\x65\xf1\x3a\xf5\x47\xcb\x46\xde\x7e\x1e\xf9\xdf\x3d\xe3\xa2\xc4\x22\x2a\x91\x9f\x79\x7a\x12\xdb\xfe\xcf\x3e\x07\xde\xe3\x9a\xb0\x91\x6e\x7f\x8c\xe0\x3d\xc0\x23\xbf\x68\xc6\xbc\x9f\xa2\x4c\x24\x3a\xe4\x0d\xd2\x61\xed\x1f\x00\xbe\xe5\x39\xbe\x8c\x62\x9f\x59\x91\x33\x4c\x20\xe5\xc0\x35\xd9\xfa\x94\x55\xc8\x5b\xc2\xd3\x6f\xf0\xe0\xf9\x0d\xbb\x8b\xfe\x1f\xa7\x11\xa4\x43\xf7\x74\xcb\x93\xdd\xbf\x03\x00\x00\xff\xff\x04\x35\x72\x44\x51\x37\x00\x00") func templateDialectSqlQueryTmplBytes() ([]byte, error) { return bindataRead( @@ -887,7 +887,7 @@ func templateDialectSqlQueryTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 14157, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/dialect/sql/query.tmpl", size: 14161, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/dialect/sql/decode.tmpl b/entc/gen/template/dialect/sql/decode.tmpl index b6836e2a6..d4fb9b87e 100644 --- a/entc/gen/template/dialect/sql/decode.tmpl +++ b/entc/gen/template/dialect/sql/decode.tmpl @@ -9,15 +9,15 @@ in the LICENSE file in the root directory of this source tree. {{ define "dialect/sql/decode/one" }} {{ $receiver := $.Receiver }} -{{ $idnulltype := $.ID.NullType }}{{ if not $.ID.UserDefined }}{{ $idnulltype = "sql.NullInt64" }}{{ end }} -{{ $ctypes := dict $idnulltype (list $.ID.Constant) }} +{{ $idscantype := $.ID.NewScanType }}{{ if not $.ID.UserDefined }}{{ $idscantype = "new(sql.NullInt64)" }}{{ end }} +{{ $ctypes := dict $idscantype (list $.ID.Constant) }} {{ range $f := $.Fields }} {{ $names := list }} - {{ if hasKey $ctypes $f.NullType }} - {{ $names = get $ctypes $f.NullType }} + {{ if hasKey $ctypes $f.NewScanType }} + {{ $names = get $ctypes $f.NewScanType }} {{ end }} {{ $names = append $names $f.Constant }} - {{ $ctypes = set $ctypes $f.NullType $names }} + {{ $ctypes = set $ctypes $f.NewScanType $names }} {{ end }} // scanValues returns the types for scanning values from sql.Rows. @@ -27,12 +27,12 @@ func (*{{ $.Name }}) scanValues(columns []string) ([]interface{}, error) { switch columns[i] { {{- range $type, $columns := $ctypes }} case {{ range $i, $c := $columns }}{{ if ne $i 0 }},{{ end }}{{ $.Package }}.{{ $c }}{{ end }}: - values[i] = new({{ $type }}) + values[i] = {{ $type }} {{- end }} {{- range $i, $fk := $.UnexportedForeignKeys }} {{- $f := $fk.Field }} case {{ $.Package }}.ForeignKeys[{{ $i }}]: // {{ $f.Name }} - values[i] = new({{ if not $f.UserDefined }}sql.NullInt64{{ else }}{{ $f.NullType }}{{ end }}) + values[i] = {{ if not $f.UserDefined }}new(sql.NullInt64){{ else }}{{ $f.NewScanType }}{{ end }} {{- end }} default: return nil, fmt.Errorf("unexpected column %q for type {{ $.Name }}", columns[i]) @@ -94,9 +94,9 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(columns []string, values []int {{- $i := $.Scope.Idx -}} {{- $f := $.Scope.Field -}} {{- $ret := $.Scope.Rec -}} - {{- $field := $f.StructField }}{{ with $.Scope.StructField }}{{ $field = . }}{{ end }} - {{- if $f.IsJSON }} - if value, ok := values[{{ $i }}].(*{{ $f.NullType }}); !ok { + {{- $field := $f.StructField }}{{ with $.Scope.StructField }}{{ $field = . }}{{ end -}} + {{- if $f.IsJSON -}} + if value, ok := values[{{ $i }}].(*{{ $f.ScanType }}); !ok { return fmt.Errorf("unexpected type %T for field {{ $f.Name }}", values[{{ $i }}]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &{{ $ret }}.{{ $field }}); err != nil { @@ -104,16 +104,16 @@ func ({{ $receiver }} *{{ $.Name }}) assignValues(columns []string, values []int } } {{- else }} - {{- $nulltype := $f.NullType -}} - if value, ok := values[{{ $i }}].(*{{ $nulltype }}); !ok { + {{- $scantype := $f.ScanType -}} + if value, ok := values[{{ $i }}].(*{{ $scantype }}); !ok { return fmt.Errorf("unexpected type %T for field {{ $f.Name }}", values[{{ $i }}]) - {{- if and (not $f.Type.ValueScanner) (hasPrefix $nulltype "sql") }} + {{- if hasPrefix $scantype "sql.Null" }} } else if value.Valid { {{- if $f.NillableValue }} {{ $ret }}.{{ $field }} = new({{ $f.Type }}) - *{{ $ret }}.{{ $field }} = {{ $f.NullTypeField "value" }} + *{{ $ret }}.{{ $field }} = {{ $f.ScanTypeField "value" }} {{- else }} - {{ $ret }}.{{ $field }} = {{ $f.NullTypeField "value" }} + {{ $ret }}.{{ $field }} = {{ $f.ScanTypeField "value" }} {{- end }} {{- else }} } else if value != nil { diff --git a/entc/gen/template/dialect/sql/query.tmpl b/entc/gen/template/dialect/sql/query.tmpl index 147a8694b..c3f2dd0b5 100644 --- a/entc/gen/template/dialect/sql/query.tmpl +++ b/entc/gen/template/dialect/sql/query.tmpl @@ -280,10 +280,10 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery(ctx context.Context) *sql.Select Predicate: func(s *sql.Selector) { s.Where(sql.InValues({{ $.Package }}.{{ $e.PKConstant }}[{{ if $e.IsInverse }}1{{ else }}0{{ end }}], fks...)) }, - {{- $out := "sql.NullInt64" }}{{ if $.ID.UserDefined }}{{ $out = $.ID.NullType }}{{ end }} - {{- $in := "sql.NullInt64" }}{{ if $e.Type.ID.UserDefined }}{{ $in = $e.Type.ID.NullType }}{{ end }} + {{- $out := "sql.NullInt64" }}{{ if $.ID.UserDefined }}{{ $out = $.ID.ScanType }}{{ end }} + {{- $in := "sql.NullInt64" }}{{ if $e.Type.ID.UserDefined }}{{ $in = $e.Type.ID.ScanType }}{{ end }} ScanValues: func() [2]interface{}{ - return [2]interface{}{&{{ $out }}{}, &{{ $in }}{}} + return [2]interface{}{new({{ $out }}), new({{ $in }})} }, Assign: func(out, in interface{}) error { eout, ok := out.(*{{ $out }}) @@ -294,8 +294,8 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery(ctx context.Context) *sql.Select if !ok || ein == nil { return fmt.Errorf("unexpected id value for edge-in") } - outValue := {{ with extend $ "Arg" "eout" "Field" $.ID "NullType" $out }}{{ template "dialect/sql/query/eagerloading/m2massign" . }}{{ end }} - inValue := {{ with extend $ "Arg" "ein" "Field" $e.Type.ID "NullType" $in }}{{ template "dialect/sql/query/eagerloading/m2massign" . }}{{ end }} + outValue := {{ with extend $ "Arg" "eout" "Field" $.ID "ScanType" $out }}{{ template "dialect/sql/query/eagerloading/m2massign" . }}{{ end }} + inValue := {{ with extend $ "Arg" "ein" "Field" $e.Type.ID "ScanType" $in }}{{ template "dialect/sql/query/eagerloading/m2massign" . }}{{ end }} node, ok := ids[outValue] if !ok { return fmt.Errorf("unexpected node id in edges: %v", outValue) @@ -401,9 +401,9 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery(ctx context.Context) *sql.Select {{ define "dialect/sql/query/eagerloading/m2massign" }} {{- $arg := $.Scope.Arg }} {{- $field := $.Scope.Field }} - {{- $nulltype := $.Scope.NullType }} - {{- if hasPrefix $nulltype "sql" -}} - {{ $field.NullTypeField $arg -}} + {{- $scantype := $.Scope.ScanType }} + {{- if hasPrefix $scantype "sql" -}} + {{ $field.ScanTypeField $arg -}} {{- else -}} {{ if not $field.Nillable }}*{{ end }}{{ $arg }} {{- end }} diff --git a/entc/gen/type.go b/entc/gen/type.go index 12f238ecd..a893fe1fa 100644 --- a/entc/gen/type.go +++ b/entc/gen/type.go @@ -1023,9 +1023,12 @@ func (f Field) NillableValue() bool { return f.Nillable && !f.Type.RType.IsPtr() } -// NullType returns the sql null-type for optional and nullable fields. -func (f Field) NullType() string { +// ScanType returns the Go type that is used for `rows.Scan`. +func (f Field) ScanType() string { if f.Type.ValueScanner() { + if f.Nillable && !f.standardNullType() { + return "sql.NullScanner" + } return f.Type.RType.String() } switch f.Type.Type { @@ -1046,10 +1049,49 @@ func (f Field) NullType() string { return f.Type.String() } -// NullTypeField extracts the nullable type field (if exists) from the given receiver. +// NewScanType returns an expression for creating an new object +// to be used by the `rows.Scan` method. An sql.Scanner or a +// nillable-type supported by the SQL driver (e.g. []byte). +func (f Field) NewScanType() string { + if f.Type.ValueScanner() { + expr := fmt.Sprintf("new(%s)", f.Type.RType.String()) + if f.Nillable && !f.standardNullType() { + expr = fmt.Sprintf("&sql.NullScanner{S: %s}", expr) + } + return expr + } + expr := f.Type.String() + switch f.Type.Type { + case field.TypeJSON, field.TypeBytes: + expr = "[]byte" + case field.TypeString, field.TypeEnum: + expr = "sql.NullString" + case field.TypeBool: + expr = "sql.NullBool" + case field.TypeTime: + expr = "sql.NullTime" + case field.TypeInt, field.TypeInt8, field.TypeInt16, field.TypeInt32, field.TypeInt64, + field.TypeUint, field.TypeUint8, field.TypeUint16, field.TypeUint32, field.TypeUint64: + expr = "sql.NullInt64" + case field.TypeFloat32, field.TypeFloat64: + expr = "sql.NullFloat64" + } + return fmt.Sprintf("new(%s)", expr) +} + +// ScanTypeField extracts the nullable type field (if exists) from the given receiver. // It also does the type conversion if needed. -func (f Field) NullTypeField(rec string) string { +func (f Field) ScanTypeField(rec string) string { expr := rec + if f.Type.ValueScanner() { + if f.Nillable && !f.standardNullType() { + return fmt.Sprintf("%s.S.(%s)", expr, f.Type) + } + if !f.Type.RType.IsPtr() { + expr = "*" + expr + } + return expr + } switch f.Type.Type { case field.TypeEnum: expr = fmt.Sprintf("%s(%s.String)", f.Type, rec) @@ -1066,6 +1108,29 @@ func (f Field) NullTypeField(rec string) string { return expr } +// standardSQLType reports if the field is one of the standard SQL types. +func (f Field) standardNullType() bool { + for _, t := range []reflect.Type{ + nullBoolType, + nullBoolPType, + nullFloatType, + nullFloatPType, + nullInt32Type, + nullInt32PType, + nullInt64Type, + nullInt64PType, + nullTimeType, + nullTimePType, + nullStringType, + nullStringPType, + } { + if f.Type.RType.TypeEqual(t) { + return true + } + } + return false +} + // Column returns the table column. It sets it as a primary key (auto_increment) // in case of ID field, unless stated otherwise. func (f Field) Column() *schema.Column { @@ -1163,6 +1228,12 @@ func (f Field) ConvertedToBasic() bool { var ( nullBoolType = reflect.TypeOf(sql.NullBool{}) nullBoolPType = reflect.TypeOf((*sql.NullBool)(nil)) + nullFloatType = reflect.TypeOf(sql.NullFloat64{}) + nullFloatPType = reflect.TypeOf((*sql.NullFloat64)(nil)) + nullInt32Type = reflect.TypeOf(sql.NullInt32{}) + nullInt32PType = reflect.TypeOf((*sql.NullInt32)(nil)) + nullInt64Type = reflect.TypeOf(sql.NullInt64{}) + nullInt64PType = reflect.TypeOf((*sql.NullInt64)(nil)) nullTimeType = reflect.TypeOf(sql.NullTime{}) nullTimePType = reflect.TypeOf((*sql.NullTime)(nil)) nullStringType = reflect.TypeOf(sql.NullString{}) diff --git a/entc/integration/customid/ent/blob_query.go b/entc/integration/customid/ent/blob_query.go index d30818c9e..1486f2981 100644 --- a/entc/integration/customid/ent/blob_query.go +++ b/entc/integration/customid/ent/blob_query.go @@ -473,7 +473,7 @@ func (bq *BlobQuery) sqlAll(ctx context.Context) ([]*Blob, error) { s.Where(sql.InValues(blob.LinksPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&uuid.UUID{}, &uuid.UUID{}} + return [2]interface{}{new(uuid.UUID), new(uuid.UUID)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*uuid.UUID) diff --git a/entc/integration/customid/ent/group_query.go b/entc/integration/customid/ent/group_query.go index e1ea8a285..6b54d51af 100644 --- a/entc/integration/customid/ent/group_query.go +++ b/entc/integration/customid/ent/group_query.go @@ -376,7 +376,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/customid/ent/pet_query.go b/entc/integration/customid/ent/pet_query.go index 03a5fea18..9dbbb58ff 100644 --- a/entc/integration/customid/ent/pet_query.go +++ b/entc/integration/customid/ent/pet_query.go @@ -551,7 +551,7 @@ func (pq *PetQuery) sqlAll(ctx context.Context) ([]*Pet, error) { s.Where(sql.InValues(pet.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullString{}, &sql.NullString{}} + return [2]interface{}{new(sql.NullString), new(sql.NullString)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullString) diff --git a/entc/integration/customid/ent/user_query.go b/entc/integration/customid/ent/user_query.go index d7ac9398d..6246af0a7 100644 --- a/entc/integration/customid/ent/user_query.go +++ b/entc/integration/customid/ent/user_query.go @@ -493,7 +493,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/edgefield/ent/info.go b/entc/integration/edgefield/ent/info.go index 73b2fa7aa..0abfe0b86 100644 --- a/entc/integration/edgefield/ent/info.go +++ b/entc/integration/edgefield/ent/info.go @@ -82,7 +82,6 @@ func (i *Info) assignValues(columns []string, values []interface{}) error { } i.ID = int(value.Int64) case info.FieldContent: - if value, ok := values[j].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field content", values[j]) } else if value != nil && len(*value) > 0 { diff --git a/entc/integration/ent/card_query.go b/entc/integration/ent/card_query.go index 6e1f39a35..6b051034d 100644 --- a/entc/integration/ent/card_query.go +++ b/entc/integration/ent/card_query.go @@ -474,7 +474,7 @@ func (cq *CardQuery) sqlAll(ctx context.Context) ([]*Card, error) { s.Where(sql.InValues(card.SpecPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/ent/fieldtype.go b/entc/integration/ent/fieldtype.go index 490cc92b8..bd1fb3a5a 100644 --- a/entc/integration/ent/fieldtype.go +++ b/entc/integration/ent/fieldtype.go @@ -144,13 +144,17 @@ func (*FieldType) scanValues(columns []string) ([]interface{}, error) { values := make([]interface{}, len(columns)) for i := range columns { switch columns[i] { + case fieldtype.FieldNullLink: + values[i] = &sql.NullScanner{S: new(schema.Link)} + case fieldtype.FieldNilPair: + values[i] = &sql.NullScanner{S: new(schema.Pair)} case fieldtype.FieldIP, fieldtype.FieldStrings: values[i] = new([]byte) - case fieldtype.FieldLinkOther, fieldtype.FieldLink, fieldtype.FieldNullLink: + case fieldtype.FieldLinkOther, fieldtype.FieldLink: values[i] = new(schema.Link) case fieldtype.FieldMAC: values[i] = new(schema.MAC) - case fieldtype.FieldPair, fieldtype.FieldNilPair: + case fieldtype.FieldPair: values[i] = new(schema.Pair) case fieldtype.FieldStringArray: values[i] = new(schema.Strings) @@ -394,13 +398,13 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error case fieldtype.FieldStr: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field str", values[i]) - } else if value != nil { + } else if value.Valid { ft.Str = *value } case fieldtype.FieldNullStr: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field null_str", values[i]) - } else if value != nil { + } else if value.Valid { ft.NullStr = value } case fieldtype.FieldLink: @@ -410,10 +414,10 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error ft.Link = *value } case fieldtype.FieldNullLink: - if value, ok := values[i].(*schema.Link); !ok { + if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field null_link", values[i]) - } else if value != nil { - ft.NullLink = value + } else if value.Valid { + ft.NullLink = value.S.(*schema.Link) } case fieldtype.FieldActive: if value, ok := values[i].(*sql.NullBool); !ok { @@ -431,13 +435,13 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error case fieldtype.FieldDeleted: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field deleted", values[i]) - } else if value != nil { + } else if value.Valid { ft.Deleted = value } case fieldtype.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) - } else if value != nil { + } else if value.Valid { ft.DeletedAt = value } case fieldtype.FieldIP: @@ -449,7 +453,7 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error case fieldtype.FieldNullInt64: if value, ok := values[i].(*sql.NullInt64); !ok { return fmt.Errorf("unexpected type %T for field null_int64", values[i]) - } else if value != nil { + } else if value.Valid { ft.NullInt64 = value } case fieldtype.FieldSchemaInt: @@ -485,7 +489,7 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error case fieldtype.FieldNullFloat: if value, ok := values[i].(*sql.NullFloat64); !ok { return fmt.Errorf("unexpected type %T for field null_float", values[i]) - } else if value != nil { + } else if value.Valid { ft.NullFloat = value } case fieldtype.FieldRole: @@ -501,7 +505,6 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error ft.UUID = *value } case fieldtype.FieldStrings: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field strings", values[i]) } else if value != nil && len(*value) > 0 { @@ -516,10 +519,10 @@ func (ft *FieldType) assignValues(columns []string, values []interface{}) error ft.Pair = *value } case fieldtype.FieldNilPair: - if value, ok := values[i].(*schema.Pair); !ok { + if value, ok := values[i].(*sql.NullScanner); !ok { return fmt.Errorf("unexpected type %T for field nil_pair", values[i]) - } else if value != nil { - ft.NilPair = value + } else if value.Valid { + ft.NilPair = value.S.(*schema.Pair) } case fieldtype.FieldVstring: if value, ok := values[i].(*schema.VString); !ok { @@ -662,8 +665,10 @@ func (ft *FieldType) String() string { builder.WriteString(", null_active=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", deleted=") - builder.WriteString(fmt.Sprintf("%v", ft.Deleted)) + if v := ft.Deleted; v != nil { + builder.WriteString(", deleted=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } builder.WriteString(", deleted_at=") builder.WriteString(fmt.Sprintf("%v", ft.DeletedAt)) builder.WriteString(", ip=") diff --git a/entc/integration/ent/group_query.go b/entc/integration/ent/group_query.go index 8e9c0e9d6..f2893dfb2 100644 --- a/entc/integration/ent/group_query.go +++ b/entc/integration/ent/group_query.go @@ -576,7 +576,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/ent/schema/fieldtype.go b/entc/integration/ent/schema/fieldtype.go index dfb99058a..bae47d9f5 100644 --- a/entc/integration/ent/schema/fieldtype.go +++ b/entc/integration/ent/schema/fieldtype.go @@ -173,6 +173,7 @@ func (FieldType) Fields() []ent.Field { //nolint:funlen GoType(Status(false)), field.Bool("deleted"). Optional(). + Nillable(). GoType(&sql.NullBool{}), field.Time("deleted_at"). Optional(). diff --git a/entc/integration/ent/spec_query.go b/entc/integration/ent/spec_query.go index e74d7dbd5..093de60f4 100644 --- a/entc/integration/ent/spec_query.go +++ b/entc/integration/ent/spec_query.go @@ -376,7 +376,7 @@ func (sq *SpecQuery) sqlAll(ctx context.Context) ([]*Spec, error) { s.Where(sql.InValues(spec.CardPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/ent/user_query.go b/entc/integration/ent/user_query.go index 66a94767f..39c05fd08 100644 --- a/entc/integration/ent/user_query.go +++ b/entc/integration/ent/user_query.go @@ -857,7 +857,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -922,7 +922,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -987,7 +987,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -1052,7 +1052,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowingPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/gremlin/ent/fieldtype.go b/entc/integration/gremlin/ent/fieldtype.go index f247e884c..4e4e4a68b 100644 --- a/entc/integration/gremlin/ent/fieldtype.go +++ b/entc/integration/gremlin/ent/fieldtype.go @@ -381,8 +381,10 @@ func (ft *FieldType) String() string { builder.WriteString(", null_active=") builder.WriteString(fmt.Sprintf("%v", *v)) } - builder.WriteString(", deleted=") - builder.WriteString(fmt.Sprintf("%v", ft.Deleted)) + if v := ft.Deleted; v != nil { + builder.WriteString(", deleted=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } builder.WriteString(", deleted_at=") builder.WriteString(fmt.Sprintf("%v", ft.DeletedAt)) builder.WriteString(", ip=") diff --git a/entc/integration/hooks/ent/user_query.go b/entc/integration/hooks/ent/user_query.go index 8338bb770..6448010c8 100644 --- a/entc/integration/hooks/ent/user_query.go +++ b/entc/integration/hooks/ent/user_query.go @@ -509,7 +509,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/idtype/ent/user_query.go b/entc/integration/idtype/ent/user_query.go index 1b24cf743..9f5a68b0d 100644 --- a/entc/integration/idtype/ent/user_query.go +++ b/entc/integration/idtype/ent/user_query.go @@ -508,7 +508,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -573,7 +573,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowingPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/json/ent/user.go b/entc/integration/json/ent/user.go index 62509c966..ec59b8c2e 100644 --- a/entc/integration/json/ent/user.go +++ b/entc/integration/json/ent/user.go @@ -70,7 +70,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } u.ID = int(value.Int64) case user.FieldT: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field t", values[i]) } else if value != nil && len(*value) > 0 { @@ -79,7 +78,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldURL: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field url", values[i]) } else if value != nil && len(*value) > 0 { @@ -88,7 +86,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldRaw: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field raw", values[i]) } else if value != nil && len(*value) > 0 { @@ -97,7 +94,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldDirs: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field dirs", values[i]) } else if value != nil && len(*value) > 0 { @@ -106,7 +102,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldInts: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field ints", values[i]) } else if value != nil && len(*value) > 0 { @@ -115,7 +110,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldFloats: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field floats", values[i]) } else if value != nil && len(*value) > 0 { @@ -124,7 +118,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { } } case user.FieldStrings: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field strings", values[i]) } else if value != nil && len(*value) > 0 { diff --git a/entc/integration/migrate/entv2/user_query.go b/entc/integration/migrate/entv2/user_query.go index 9daef8ff6..aa166baa2 100644 --- a/entc/integration/migrate/entv2/user_query.go +++ b/entc/integration/migrate/entv2/user_query.go @@ -530,7 +530,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/multischema/ent/group_query.go b/entc/integration/multischema/ent/group_query.go index e98417e5b..c30279556 100644 --- a/entc/integration/multischema/ent/group_query.go +++ b/entc/integration/multischema/ent/group_query.go @@ -406,7 +406,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/multischema/ent/user_query.go b/entc/integration/multischema/ent/user_query.go index 4c3cdcfec..189252a93 100644 --- a/entc/integration/multischema/ent/user_query.go +++ b/entc/integration/multischema/ent/user_query.go @@ -475,7 +475,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/privacy/ent/task_query.go b/entc/integration/privacy/ent/task_query.go index cd53e90bf..58ed83fc6 100644 --- a/entc/integration/privacy/ent/task_query.go +++ b/entc/integration/privacy/ent/task_query.go @@ -451,7 +451,7 @@ func (tq *TaskQuery) sqlAll(ctx context.Context) ([]*Task, error) { s.Where(sql.InValues(task.TeamsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/privacy/ent/team_query.go b/entc/integration/privacy/ent/team_query.go index 17ad12171..1c78f1a90 100644 --- a/entc/integration/privacy/ent/team_query.go +++ b/entc/integration/privacy/ent/team_query.go @@ -443,7 +443,7 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) { s.Where(sql.InValues(team.TasksPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -508,7 +508,7 @@ func (tq *TeamQuery) sqlAll(ctx context.Context) ([]*Team, error) { s.Where(sql.InValues(team.UsersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/privacy/ent/user_query.go b/entc/integration/privacy/ent/user_query.go index cf7b8e996..d18a1c49d 100644 --- a/entc/integration/privacy/ent/user_query.go +++ b/entc/integration/privacy/ent/user_query.go @@ -443,7 +443,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.TeamsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/template/ent/user_query.go b/entc/integration/template/ent/user_query.go index eeead3960..9c1582319 100644 --- a/entc/integration/template/ent/user_query.go +++ b/entc/integration/template/ent/user_query.go @@ -469,7 +469,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/entc/integration/type_test.go b/entc/integration/type_test.go index 2bfb89b9e..77a2ed992 100644 --- a/entc/integration/type_test.go +++ b/entc/integration/type_test.go @@ -44,6 +44,9 @@ func Types(t *testing.T, client *ent.Client) { require.Equal(int16(16), ft.Int16) require.Equal(int32(32), ft.Int32) require.Equal(int64(64), ft.Int64) + require.Nil(ft.NullLink) + require.Nil(ft.NilPair) + require.Nil(ft.Deleted) ft = client.FieldType.Create(). SetInt(1). diff --git a/examples/m2m2types/ent/group_query.go b/examples/m2m2types/ent/group_query.go index f75041e76..171740466 100644 --- a/examples/m2m2types/ent/group_query.go +++ b/examples/m2m2types/ent/group_query.go @@ -400,7 +400,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/m2m2types/ent/user_query.go b/examples/m2m2types/ent/user_query.go index 5a233fcc5..be9ea7130 100644 --- a/examples/m2m2types/ent/user_query.go +++ b/examples/m2m2types/ent/user_query.go @@ -400,7 +400,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/m2mbidi/ent/user_query.go b/examples/m2mbidi/ent/user_query.go index a6e361a3d..32563abe4 100644 --- a/examples/m2mbidi/ent/user_query.go +++ b/examples/m2mbidi/ent/user_query.go @@ -399,7 +399,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/m2mrecur/ent/user_query.go b/examples/m2mrecur/ent/user_query.go index 6666fa25e..25906ed7a 100644 --- a/examples/m2mrecur/ent/user_query.go +++ b/examples/m2mrecur/ent/user_query.go @@ -435,7 +435,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -500,7 +500,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FollowingPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/privacytenant/ent/group_query.go b/examples/privacytenant/ent/group_query.go index ff753ecce..cb420424a 100644 --- a/examples/privacytenant/ent/group_query.go +++ b/examples/privacytenant/ent/group_query.go @@ -480,7 +480,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/privacytenant/ent/user.go b/examples/privacytenant/ent/user.go index e8445afd6..59808cefc 100644 --- a/examples/privacytenant/ent/user.go +++ b/examples/privacytenant/ent/user.go @@ -106,7 +106,6 @@ func (u *User) assignValues(columns []string, values []interface{}) error { u.Name = value.String } case user.FieldFoods: - if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field foods", values[i]) } else if value != nil && len(*value) > 0 { diff --git a/examples/privacytenant/ent/user_query.go b/examples/privacytenant/ent/user_query.go index cdf5e72b7..21bccd245 100644 --- a/examples/privacytenant/ent/user_query.go +++ b/examples/privacytenant/ent/user_query.go @@ -480,7 +480,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/start/ent/group_query.go b/examples/start/ent/group_query.go index 54c099252..001bd0c6b 100644 --- a/examples/start/ent/group_query.go +++ b/examples/start/ent/group_query.go @@ -400,7 +400,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/start/ent/user_query.go b/examples/start/ent/user_query.go index e3449adb3..3c61c0c01 100644 --- a/examples/start/ent/user_query.go +++ b/examples/start/ent/user_query.go @@ -466,7 +466,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/traversal/ent/group_query.go b/examples/traversal/ent/group_query.go index 27f78e7df..ad65d9cdb 100644 --- a/examples/traversal/ent/group_query.go +++ b/examples/traversal/ent/group_query.go @@ -444,7 +444,7 @@ func (gq *GroupQuery) sqlAll(ctx context.Context) ([]*Group, error) { s.Where(sql.InValues(group.UsersPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/traversal/ent/pet_query.go b/examples/traversal/ent/pet_query.go index 5582e0cfd..0ef74325a 100644 --- a/examples/traversal/ent/pet_query.go +++ b/examples/traversal/ent/pet_query.go @@ -444,7 +444,7 @@ func (pq *PetQuery) sqlAll(ctx context.Context) ([]*Pet, error) { s.Where(sql.InValues(pet.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) diff --git a/examples/traversal/ent/user_query.go b/examples/traversal/ent/user_query.go index 84bf1b1e6..cd7500885 100644 --- a/examples/traversal/ent/user_query.go +++ b/examples/traversal/ent/user_query.go @@ -538,7 +538,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.FriendsPrimaryKey[0], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64) @@ -603,7 +603,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { s.Where(sql.InValues(user.GroupsPrimaryKey[1], fks...)) }, ScanValues: func() [2]interface{} { - return [2]interface{}{&sql.NullInt64{}, &sql.NullInt64{}} + return [2]interface{}{new(sql.NullInt64), new(sql.NullInt64)} }, Assign: func(out, in interface{}) error { eout, ok := out.(*sql.NullInt64)