From 091f9aba129ce55c313dfbeddd8e6bbff094294b Mon Sep 17 00:00:00 2001 From: Alex Snast Date: Thu, 30 Jan 2020 13:42:13 +0100 Subject: [PATCH] entc/gen: check for nil error before invoking .As Signed-off-by: Alex Snast --- entc/gen/internal/bindata.go | 4 ++-- entc/gen/template/base.tmpl | 12 ++++++++++++ entc/integration/config/ent/ent.go | 12 ++++++++++++ entc/integration/customid/ent/ent.go | 12 ++++++++++++ entc/integration/ent/ent.go | 12 ++++++++++++ entc/integration/gremlin/ent/ent.go | 12 ++++++++++++ entc/integration/idtype/ent/ent.go | 12 ++++++++++++ entc/integration/json/ent/ent.go | 12 ++++++++++++ entc/integration/migrate/entv1/ent.go | 12 ++++++++++++ entc/integration/migrate/entv2/ent.go | 12 ++++++++++++ entc/integration/template/ent/ent.go | 12 ++++++++++++ examples/edgeindex/ent/ent.go | 12 ++++++++++++ examples/entcpkg/ent/ent.go | 12 ++++++++++++ examples/m2m2types/ent/ent.go | 12 ++++++++++++ examples/m2mbidi/ent/ent.go | 12 ++++++++++++ examples/m2mrecur/ent/ent.go | 12 ++++++++++++ examples/o2m2types/ent/ent.go | 12 ++++++++++++ examples/o2mrecur/ent/ent.go | 12 ++++++++++++ examples/o2o2types/ent/ent.go | 12 ++++++++++++ examples/o2obidi/ent/ent.go | 12 ++++++++++++ examples/o2orecur/ent/ent.go | 12 ++++++++++++ examples/start/ent/ent.go | 12 ++++++++++++ examples/traversal/ent/ent.go | 12 ++++++++++++ 23 files changed, 266 insertions(+), 2 deletions(-) diff --git a/entc/gen/internal/bindata.go b/entc/gen/internal/bindata.go index 4e246f7de..cb4c39205 100644 --- a/entc/gen/internal/bindata.go +++ b/entc/gen/internal/bindata.go @@ -121,7 +121,7 @@ func (fi bindataFileInfo) Sys() interface{} { return nil } -var _templateBaseTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x57\x5b\x6f\xdc\x36\x13\x7d\x5e\xfd\x8a\x81\xb0\x5f\x20\x39\x6b\xc9\xf1\xdb\x17\x20\x0f\x8e\x1b\x17\x06\x52\xb7\x80\x53\xe4\x21\x08\x0a\x5a\x1a\x49\x84\x25\x52\x26\x29\xdb\x0b\x41\xff\xbd\x18\x52\xb7\x95\x37\x6b\xe7\xd2\x97\xc5\x8a\x97\x99\x33\x73\xce\x0c\xc9\xb6\x8d\x8f\xbc\x73\x59\x6f\x15\xcf\x0b\x03\xa7\x27\x6f\xfe\x7f\x5c\x2b\xd4\x28\x0c\x5c\xb0\x04\x6f\xa4\xbc\x85\x4b\x91\x44\x70\x56\x96\x60\x17\x69\xa0\x79\x75\x8f\x69\xe4\x7d\x2a\xb8\x06\x2d\x1b\x95\x20\x24\x32\x45\xe0\x1a\x4a\x9e\xa0\xd0\x98\x42\x23\x52\x54\x60\x0a\x84\xb3\x9a\x25\x05\xc2\x69\x74\x32\xcc\x42\x26\x1b\x91\x7a\x5c\xd8\xf9\x8f\x97\xe7\x1f\xae\xae\x3f\x40\xc6\x4b\x84\x7e\x4c\x49\x69\x20\xe5\x0a\x13\x23\xd5\x16\x64\x06\x66\xe6\xcc\x28\xc4\xc8\x3b\x8a\xbb\xce\xf3\xda\x16\x52\xcc\xb8\x40\xf0\x6f\x98\x46\x1f\xfa\xc1\x75\x7d\x9b\xc3\xdb\x77\x40\x83\xb0\x8e\xce\xa5\xc8\x78\x1e\xfd\xc5\x92\x5b\x96\x23\x2d\x6a\x5b\x30\x58\xd5\x25\x33\x08\x7e\x81\x2c\x45\xe5\xc3\x7a\xd8\x3e\x4d\xf1\xaa\x96\xca\x0c\x53\x71\x0c\x7f\x2a\x8a\x8c\xd5\x75\xc9\x51\x03\x13\x20\x69\x80\x8b\x1c\xa4\x00\xe4\xa6\x40\x05\xb9\x62\x75\x01\x46\xb1\x7b\x54\x9a\x95\x20\x15\xe8\xbb\x12\x34\x96\x36\xa2\xc8\x33\xdb\x1a\x7b\x4b\x59\x23\x92\x80\x10\x47\xd7\x46\x2a\x96\x63\xf4\xbe\xe1\x25\xcd\x74\x5d\x68\xc1\x28\x26\x72\x84\x75\xb6\x81\xb5\xf5\x45\x71\xb9\x3f\x5d\xe7\xad\x68\x6b\x06\xef\xa0\x66\x3a\x61\x25\xfd\xa7\xd1\x38\x06\x37\xd1\x75\x23\x56\xca\x6c\xce\xef\x51\x40\xc6\xb1\x4c\x35\x65\xbb\x6d\xa1\xa9\x6b\x54\xfd\x52\x6b\x36\xf2\x56\x04\x6a\x34\x10\xf4\xcb\xa3\x28\xd2\x86\x22\x0d\x7b\xe8\xad\xb7\x5a\xb5\xed\x31\x3c\x70\x53\x00\x3e\x1a\x14\x29\x04\x5c\xa4\xf8\x08\xeb\xe8\x4a\xa6\xa8\xe1\x24\x04\xff\xa2\x11\x89\x4f\xa6\x7c\xbb\xcd\x1f\xc2\x38\x26\xa0\x2b\x1b\x80\xa9\xea\x92\xc2\xaa\x15\x17\x26\x03\x3f\xe5\x8c\x52\x15\xff\x4f\xc7\xb2\xdf\x33\xa4\x07\xdc\x2e\x85\xa6\x51\x16\xff\xe3\x48\x96\x33\x13\xb9\x15\x6d\x0b\x84\xc7\x3a\xb1\x74\xd3\xd7\xa0\x8e\x03\xfe\x72\x25\x9b\x3a\xd6\x3c\x17\xcc\x34\x0a\x17\x9e\xe3\x18\xce\xf2\x5c\x61\x4e\xfe\x66\x22\x60\xfd\x20\x97\x02\xb4\xc1\x9a\xc4\x60\xf3\x4d\xd6\x8e\x6f\xb6\x93\x18\xe2\x49\x05\xdf\x02\x6f\x75\x76\xa6\xa9\xa0\x18\xd4\x1a\x9b\x54\xee\x38\x20\x76\xdc\x1f\xa9\x40\xa1\x60\x15\xc9\x8f\x09\x69\xc5\xe7\x7e\x87\x35\xda\xb1\x93\x34\xda\xc8\x0a\x04\xab\x50\x47\x70\x21\x15\xe0\x23\xab\xea\x12\xdf\x7a\x71\xec\xc5\xf1\xea\x77\x02\xfa\x7e\xeb\xb8\x7e\xb3\x71\x12\x39\x0d\x23\x9a\x1b\x23\x0e\x86\xca\xea\xba\xe8\x4c\xcf\xbf\xae\x9b\xaa\xdf\x1a\x6e\xc0\xd7\x4d\xf5\x8f\xfb\xf2\xc3\x0d\xbc\x60\xd7\xe9\xce\xae\x53\x3f\x74\x8e\xaf\x13\x26\x82\xc4\x3c\x6e\xe0\xd5\x7d\x48\x40\xad\x2e\xcf\x74\x90\x89\x89\x86\x8d\x65\x76\x50\xe6\xc4\x4e\xeb\x59\x71\xba\xbc\x1e\xa0\x9a\xe9\xa5\xba\x9e\xd1\x56\x37\xaf\x4a\xca\xe8\x06\xd6\x94\xe4\x0b\xc2\x4e\xaa\x62\x23\x86\xb1\x40\x85\x55\x5b\x5f\xa2\xb4\x67\x9c\x7a\x56\x8a\x89\x14\xda\x2c\x21\xb6\x2d\xf0\x0c\x0a\xa6\x3f\xed\x02\x1c\xa4\xff\x4c\x49\x5e\xb1\x8a\x94\x6d\x81\x8c\xf5\x29\x66\x15\x79\xb8\xa8\x7a\x04\x43\x45\x8d\xdd\x46\x2c\xdb\x4d\xdb\xc2\x5d\x23\x0d\x8e\x31\xef\xd7\xb1\xb4\xc9\xe6\xd9\x3c\x8f\x5d\xb7\xe8\x57\x74\x0c\x8c\x4e\x91\x25\x85\x2b\xae\x9d\x6e\x45\x00\x82\x3d\xa6\x9c\x01\xa7\x91\xd1\xc6\x42\x2c\xdf\xd3\xca\x04\xf8\x9f\x07\xf3\xfe\xdc\xd5\xcb\x7a\x9a\x23\x36\x73\xc6\x7e\x59\x63\x8b\x63\xb8\x92\xe6\x82\x0e\xd7\x0f\x4a\xd9\xd6\x40\xa6\x34\x3c\x14\x28\xc0\xa8\x2d\x75\x09\x23\x21\x43\x93\x14\xc0\x40\xd7\x98\xf0\x8c\x27\x80\xc2\x70\xb3\x05\x26\x52\xe0\x06\x1e\x98\x06\x21\x8d\x3b\xa5\x87\x13\x39\x65\x86\xd1\x59\xda\x1f\x5d\xbb\x7e\xb4\x51\x4d\x62\x28\x87\x25\xbb\xc1\xb2\xcf\xb3\xe7\x20\xb9\x25\x9c\x7a\x4d\x85\xc2\x38\x5d\xa0\x1b\x14\x06\x55\xc6\x12\x8c\x5c\x61\x07\x08\x47\x3b\x96\x43\xb7\x3b\x08\x7b\x93\xe4\xa2\xcf\x8f\x3f\xb5\x91\xb7\xe0\xc3\x6b\xc0\xc8\x39\x7f\x0d\xfe\x04\xdf\xef\x41\x5c\xea\xc1\xee\x98\x14\x06\x37\x52\x96\xc8\x04\x70\x91\xf2\x84\x19\xb2\xff\x50\xa0\xed\x9e\x33\x8c\xb4\x72\x4a\x87\x1d\xec\xe1\x4e\x46\x03\x54\xca\x4d\x85\xd6\x2a\xe1\xbc\x67\x0a\x96\xf1\x8c\xe8\x1f\xed\x62\x4d\xed\x10\x95\xda\xc0\x2b\x0c\x7b\xa4\x7f\x30\x7d\x3b\x62\xad\x98\xbe\x25\x32\xd4\x1e\xef\xf3\x85\x73\xff\x0e\x76\xeb\xad\x78\xb6\x40\x18\x5a\x95\xf7\x08\x04\x2f\x49\x3e\xc3\x27\x2a\xe5\x8d\x12\xba\xe6\x22\x6f\x4a\xa6\x5e\xa6\xa2\x7e\xf1\x5c\x45\x95\x54\x48\x39\xa4\xca\x46\x2b\xa8\x67\xc4\xb4\xeb\xf1\x17\xeb\x69\xc7\xf8\xcf\x48\x6a\x08\x75\x47\x55\x83\xf5\x1f\x16\xd6\x94\xc0\xa5\xb6\x06\xd3\x87\xe5\xb5\x13\xde\x0b\x14\x76\x25\xcd\x47\xc9\x52\x3c\xdc\x24\x72\x34\x16\x5f\x4a\x44\xb2\xa9\x2b\x94\x76\x2b\xd0\x8d\xa6\x40\xb8\x6b\x50\x6d\x27\x1a\xe7\x76\x27\x12\x31\xcd\xf1\x67\x39\x9c\x59\xfe\x3e\x06\xad\x73\x22\xd0\xfe\xd9\x8d\x62\x87\x47\xe7\xe1\x87\x59\xec\xf3\xf2\x84\x43\x67\xf6\x30\x83\xb3\xe0\x5e\xc0\xdf\x39\xdd\x07\x14\xe3\xc2\x1c\x24\x30\x51\xc8\x0c\xc6\x4d\x9d\xd2\x09\x42\x75\x28\x95\x2b\x4c\x5b\xa8\xee\xde\x9a\x92\xc1\xf9\x9c\x7d\x6a\x21\x57\x90\x8c\x5e\x34\x64\x8c\x97\x98\xee\x5c\x1b\x37\x70\xcf\x65\xe9\x8e\x71\x99\xb9\xe4\x4a\x45\xd6\xdc\x51\xdb\x08\x7e\xd7\xa0\x40\xad\x7b\x75\x2c\x51\x4f\xf2\xa8\x74\x3e\xa8\x63\xf5\xa0\x58\xed\xf2\xf4\x43\x4a\x59\x38\x79\xa9\x52\xa6\x58\xfb\x50\x07\xf1\x54\x7a\x50\xec\xdf\xc2\x42\xdb\x07\x44\x47\x9f\x15\xb3\x6f\xa8\x7d\xda\x7d\x02\xc9\x59\x0a\x66\x8d\x7a\x68\xc1\x11\x4d\x8c\x92\xfc\x16\xcd\xdf\x23\xcc\x45\x60\x8d\xc2\x51\x9a\x0b\xf3\x07\x04\xba\x58\xf9\x9c\x42\xdb\x36\x3e\x02\x7c\xac\xd9\x70\x5e\x01\xf1\x6f\xc5\x06\x79\x29\x6f\x58\x09\x05\x96\x35\x2a\x1d\x81\x7d\xc3\x8f\x77\xa5\xbd\x57\x25\xe7\x64\x71\x4d\x3a\x74\xfb\xdd\x73\x71\x5a\xf7\x7b\x9e\xbc\x00\xf7\x5f\xce\x2c\xc8\xff\xc0\x25\xb7\x8f\x83\x27\xb7\xca\xe8\xf2\xb7\xe8\x13\x95\x88\x7b\x5e\xde\xe2\x56\x8f\x64\x13\x9f\x34\x10\xf3\x54\x43\xa6\x64\xe5\x18\xa6\x6a\xab\x58\xdd\x93\x49\x0b\x82\x8a\x06\xbe\xf4\x6e\xba\xee\xab\xab\xaf\xb6\x0b\xe1\xcb\xd7\x71\x94\x58\xd5\x04\xa2\x62\xb7\x18\xcc\x26\x36\x70\xb2\x81\x12\x45\x50\x85\xa1\xb7\xa2\x67\xa5\x03\xeb\x1e\x39\x95\xbd\x38\x68\x78\x47\x77\x7b\x14\x69\xa0\x37\xc0\xd3\x70\x7e\x7f\xd0\xde\x3c\xdc\x7f\x03\x00\x00\xff\xff\xfb\x72\x07\x88\x5a\x12\x00\x00") +var _templateBaseTmpl = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x58\x5d\x4f\xdd\x38\x13\xbe\x3e\xf9\x15\xa3\xe8\xbc\x55\x42\x0f\x09\xe5\xee\xad\xc4\x05\x65\xcb\x0a\xa9\xcb\xae\x44\x57\xbd\xa8\xaa\x95\x49\x26\x89\x45\x62\x07\xdb\x01\x8e\xa2\xfc\xf7\xd5\xd8\xf9\x3a\xe1\x14\x68\xe9\xde\xa0\x13\x7f\x3c\xf3\xcc\xcc\x33\x63\x9b\xb6\x8d\x0f\xbc\x33\x59\x6f\x15\xcf\x0b\x03\xc7\x47\xef\xfe\x7f\x58\x2b\xd4\x28\x0c\x9c\xb3\x04\xaf\xa5\xbc\x81\x0b\x91\x44\x70\x5a\x96\x60\x17\x69\xa0\x79\x75\x87\x69\xe4\x7d\x2e\xb8\x06\x2d\x1b\x95\x20\x24\x32\x45\xe0\x1a\x4a\x9e\xa0\xd0\x98\x42\x23\x52\x54\x60\x0a\x84\xd3\x9a\x25\x05\xc2\x71\x74\x34\xcc\x42\x26\x1b\x91\x7a\x5c\xd8\xf9\x4f\x17\x67\x1f\x2f\xaf\x3e\x42\xc6\x4b\x84\x7e\x4c\x49\x69\x20\xe5\x0a\x13\x23\xd5\x16\x64\x06\x66\x66\xcc\x28\xc4\xc8\x3b\x88\xbb\xce\xf3\xda\x16\x52\xcc\xb8\x40\xf0\xaf\x99\x46\x1f\xfa\xc1\x75\x7d\x93\xc3\xfb\x13\xa0\x41\x58\x47\x67\x52\x64\x3c\x8f\xfe\x62\xc9\x0d\xcb\x91\x16\xb5\x2d\x18\xac\xea\x92\x19\x04\xbf\x40\x96\xa2\xf2\x61\x3d\x6c\x9f\xa6\x78\x55\x4b\x65\x86\xa9\x38\x86\x3f\x15\x79\xc6\xea\xba\xe4\xa8\x81\x09\x90\x34\xc0\x45\x0e\x52\x00\x72\x53\xa0\x82\x5c\xb1\xba\x00\xa3\xd8\x1d\x2a\xcd\x4a\x90\x0a\xf4\x6d\x09\x1a\x4b\xeb\x51\xe4\x99\x6d\x8d\x3d\x52\xd6\x88\x24\x20\xc6\xd1\x95\x91\x8a\xe5\x18\x7d\x68\x78\x49\x33\x5d\x17\x5a\x32\x8a\x89\x1c\x61\x9d\x6d\x60\x6d\x6d\x91\x5f\xee\x47\xd7\x79\x2b\xda\x9a\xc1\x09\xd4\x4c\x27\xac\xa4\xdf\x34\x1a\xc7\xe0\x26\xba\x6e\xe4\x4a\x91\xcd\xf9\x1d\x0a\xc8\x38\x96\xa9\xa6\x68\xb7\x2d\x34\x75\x8d\xaa\x5f\x6a\x61\x23\x6f\x45\xa4\x46\x80\xa0\x5f\x1e\x45\x91\x36\xe4\x69\xd8\x53\x6f\xbd\xd5\xaa\x6d\x0f\xe1\x9e\x9b\x02\xf0\xc1\xa0\x48\x21\xe0\x22\xc5\x07\x58\x47\x97\x32\x45\x0d\x47\x21\xf8\xe7\x8d\x48\x7c\x82\xf2\xed\x36\x7f\x70\xe3\x90\x88\xae\xac\x03\xa6\xaa\x4b\x72\xab\x56\x5c\x98\x0c\xfc\x94\x33\x0a\x55\xfc\x3f\x1d\xcb\x7e\xcf\x10\x1e\x70\xbb\x14\x9a\x46\x59\xfe\x0f\x63\xb2\x1c\x4c\xe4\x56\xb4\x2d\x10\x1f\x6b\xc4\xa6\x9b\xbe\x06\x75\x3c\x61\x2f\x57\xb2\xa9\x63\xcd\x73\xc1\x4c\xa3\x70\x61\x39\x8e\xe1\x34\xcf\x15\xe6\x64\x6f\x26\x02\xd6\x0f\x72\x29\x40\x1b\xac\x49\x0c\x36\xde\x84\x76\x78\xbd\x9d\xc4\x10\x4f\x2a\xf8\x1e\x79\xab\xb3\x53\x4d\x05\xc5\xa0\xd6\xd8\xa4\x72\xc7\x00\x65\xc7\xfd\x90\x0a\x14\x0a\x56\x91\xfc\x98\x90\x56\x7c\xee\xef\xb0\x46\xbb\xec\x24\x8d\x36\xb2\x02\xc1\x2a\xd4\x11\x9c\x4b\x05\xf8\xc0\xaa\xba\xc4\xf7\x5e\x1c\x7b\x71\xbc\xfa\x9d\x88\x7e\xd8\xba\x5c\xbf\xdb\x38\x89\x1c\x87\x11\xcd\x8d\x1e\x07\x43\x65\x75\x5d\x74\xaa\xe7\x5f\x57\x4d\xd5\x6f\x0d\x37\xe0\xeb\xa6\xfa\xc7\x7d\xf9\xe1\x06\x5e\xb0\xeb\x78\x67\xd7\xb1\x1f\x3a\xc3\x57\x09\x13\x41\x62\x1e\x36\xf0\xe6\x2e\x24\xa2\x56\x97\xa7\x3a\xc8\xc4\x94\x86\x8d\xcd\xec\xa0\xcc\x29\x3b\xad\x67\xc5\xe9\xe2\xfa\x44\xaa\x99\x5e\xaa\xeb\x19\x6d\x75\xf3\xaa\xa4\x88\x6e\x60\x4d\x41\x3e\x27\xee\xa4\x2a\x36\x72\x18\x0b\x54\x58\xb5\xf5\x25\x4a\x7b\xc6\xa9\x67\xa5\x98\x48\xa1\xcd\x92\x62\xdb\x02\xcf\xa0\x60\xfa\xf3\x2e\xc1\x41\xfa\xcf\x94\xe4\x25\xab\x48\xd9\x96\xc8\x58\x9f\x62\x56\x91\x4f\x17\x55\xcf\x60\xa8\xa8\xb1\xdb\x88\x65\xbb\x69\x5b\xb8\x6d\xa4\xc1\xd1\xe7\xfd\x3a\x96\x36\xd8\x3c\x9b\xc7\xb1\xeb\x16\xfd\x8a\x8e\x81\xd1\x28\xb2\xa4\x70\xc5\xb5\xd3\xad\x88\x40\xb0\x07\xca\x01\x38\x8d\x8c\x18\x0b\xb1\xfc\x48\x2b\x13\xe0\x7f\x19\xe0\xfd\xb9\xa9\x97\xf5\x34\x97\xd8\xcc\x81\xfd\xb2\xc6\x16\xc7\x70\x29\xcd\x39\x1d\xae\x1f\x95\xb2\xad\x81\xa0\x34\xdc\x17\x28\xc0\xa8\x2d\x75\x09\x23\x21\x43\x93\x14\xc0\x40\xd7\x98\xf0\x8c\x27\x80\xc2\x70\xb3\x05\x26\x52\xe0\x06\xee\x99\x06\x21\x8d\x3b\xa5\x87\x13\x39\x65\x86\xd1\x59\xda\x1f\x5d\xbb\x76\xb4\x51\x4d\x62\x28\x86\x25\xbb\xc6\xb2\x8f\xb3\xe7\x28\xb9\x25\x9c\x7a\x4d\x85\xc2\x38\x5d\xa0\x1b\x14\x06\x55\xc6\x12\x8c\x5c\x61\x07\x08\x07\x3b\xc8\xa1\xdb\x1d\x84\x3d\x24\x99\xe8\xe3\xe3\x4f\x6d\xe4\x3d\xf8\xf0\x16\x30\x72\xc6\xdf\x82\x3f\xd1\xf7\x7b\x12\x17\x7a\xc0\x1d\x83\xc2\xe0\x5a\xca\x12\x99\x00\x2e\x52\x9e\x30\x43\xf8\xf7\x05\xda\xee\x39\xe3\x48\x2b\xa7\x70\xd8\xc1\x9e\xee\x04\x1a\xa0\x52\x6e\x2a\xb4\xa8\xc4\x93\x67\x34\x02\x27\x27\x20\xb8\x1d\x18\x98\x67\xac\xd4\x48\xa9\x5b\xdd\x31\x05\x4b\x97\x47\x07\x1f\x2c\x9e\xa6\x8e\x89\x4a\x6d\xe0\x0d\x86\xbd\x33\x7f\x30\x7d\x33\xba\x53\x31\x7d\x43\xf9\x52\x7b\x08\xce\x17\xce\x29\x3a\xcf\x1c\xc7\x5d\x27\xc2\x39\x51\xc1\x4b\x4b\xb3\xff\x44\xa5\xbc\x51\x65\x57\x5c\xe4\x4d\xc9\xd4\xcb\x84\xd6\x2f\x9e\x0b\xad\x92\x0a\x29\xcc\x54\xfc\x68\x35\xf7\x8c\xde\x76\x2d\xfe\x62\xc9\xed\x80\xbf\x46\x75\x83\xab\x3b\xc2\x1b\xd0\x7f\x5a\x7b\x53\x00\x97\xf2\x1b\xa0\x5f\xad\xc0\x9d\x08\xbc\x40\x84\x97\xd2\x7c\x92\x2c\xc5\xa7\x5b\x4d\x8e\xc6\xba\x90\x52\xae\xd9\xd4\x5b\x4a\xbb\x15\xe8\x5e\x54\x20\xdc\x36\xa8\xb6\x53\xa6\xe7\xb8\x53\x9e\x31\xcd\xf1\xb5\x69\x9e\x21\xff\x58\x92\xad\x71\xca\xb1\xfd\xb1\xeb\xc5\x4e\xaa\x9d\x85\x9f\x4e\x74\x1f\x97\x47\x69\x76\xb0\xaf\x4e\xf2\xcc\xff\x17\xa4\xf8\x8c\x2e\x1e\x8a\x71\x61\x9e\xcc\x71\xa2\x90\x19\x8c\x9b\x3a\xa5\xa3\x8a\xaa\x59\x2a\x57\xde\xb6\xdc\xdd\x05\x39\x25\xc0\xf9\x9c\x7d\xd3\x21\x57\x90\x8c\x56\x34\x64\x8c\x97\x98\xee\xdc\x4f\x37\x70\xc7\x65\xe9\xee\x0b\x32\x73\xf1\x97\x8a\xd0\xdc\x99\xde\x08\x7e\xdb\xa0\x40\xad\x7b\x01\x2d\x59\x4f\x0a\xaa\x74\x3e\x08\x68\x75\xaf\x58\xed\x42\xf9\x53\x62\x5a\x18\x79\xa9\x98\x26\x5f\x7b\x57\x07\x7d\x55\x7a\x10\xf5\xdf\xc2\x52\xdb\x47\x44\x47\x5f\x14\xb3\x8f\xb5\x7d\xf2\x7e\x44\xc9\x21\x05\xb3\x76\x3f\x34\xf2\x88\x26\x46\xd5\x7e\x2f\xcd\x3f\xa2\xdd\x85\x63\x8d\xc2\x51\xbd\x0b\xf8\xd7\x69\x78\x01\xf6\x9c\x88\xdb\x36\x3e\x00\x7c\xa8\xd9\x70\x30\x02\x49\xc4\xea\x11\xf2\x52\x5e\xb3\x12\x0a\x2c\x6b\x54\x3a\x02\xfb\xff\x84\xf1\xde\xb6\xf7\xda\xe6\x8c\x2c\xae\x6c\x4f\xdd\xc4\xf7\x5c\xe2\xd6\xfd\x9e\x47\xaf\xd1\xfd\x17\x45\x4b\xf2\x3f\x30\xc9\xed\x43\xe5\xd1\x0d\x37\xba\xf8\x2d\xfa\x4c\x55\xe4\x9e\xba\x37\xb8\xd5\xa3\x1e\x28\xe5\x34\x10\xf3\x54\x43\xa6\x64\xe5\x44\x40\x05\x59\xb1\xba\xcf\x37\x2d\x08\x2a\x1a\xf8\xda\x9b\xe9\xba\x6f\xae\x04\xdb\x2e\x84\xaf\xdf\xc6\x51\xca\xb3\x26\x12\x15\xbb\xc1\x60\x36\xb1\x81\xa3\x0d\x94\x28\x82\x2a\x0c\xbd\x15\x3d\x71\x1d\x59\xf7\xe0\xaa\xac\x3e\x34\x9c\xd0\x3b\x03\x45\x1a\xe8\x0d\xf0\x34\x9c\x5f\x54\xb4\x37\x77\xf7\xdf\x00\x00\x00\xff\xff\x91\x26\x29\x8f\xe6\x12\x00\x00") func templateBaseTmplBytes() ([]byte, error) { return bindataRead( @@ -136,7 +136,7 @@ func templateBaseTmpl() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "template/base.tmpl", size: 4698, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "template/base.tmpl", size: 4838, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/entc/gen/template/base.tmpl b/entc/gen/template/base.tmpl index 3f34e4da3..184426bb8 100644 --- a/entc/gen/template/base.tmpl +++ b/entc/gen/template/base.tmpl @@ -71,6 +71,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -95,6 +98,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -111,6 +117,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -135,6 +144,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/config/ent/ent.go b/entc/integration/config/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/entc/integration/config/ent/ent.go +++ b/entc/integration/config/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/customid/ent/ent.go b/entc/integration/customid/ent/ent.go index c2b57d713..01417b368 100644 --- a/entc/integration/customid/ent/ent.go +++ b/entc/integration/customid/ent/ent.go @@ -101,6 +101,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -125,6 +128,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -141,6 +147,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -165,6 +174,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/ent/ent.go b/entc/integration/ent/ent.go index f92791107..5d811eb5a 100644 --- a/entc/integration/ent/ent.go +++ b/entc/integration/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/gremlin/ent/ent.go b/entc/integration/gremlin/ent/ent.go index 73c520322..86de0c68a 100644 --- a/entc/integration/gremlin/ent/ent.go +++ b/entc/integration/gremlin/ent/ent.go @@ -148,6 +148,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -172,6 +175,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -188,6 +194,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -212,6 +221,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/idtype/ent/ent.go b/entc/integration/idtype/ent/ent.go index 02119bb11..72c8fe4e6 100644 --- a/entc/integration/idtype/ent/ent.go +++ b/entc/integration/idtype/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/json/ent/ent.go b/entc/integration/json/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/entc/integration/json/ent/ent.go +++ b/entc/integration/json/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/migrate/entv1/ent.go b/entc/integration/migrate/entv1/ent.go index 29884006f..d8d756c53 100644 --- a/entc/integration/migrate/entv1/ent.go +++ b/entc/integration/migrate/entv1/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/migrate/entv2/ent.go b/entc/integration/migrate/entv2/ent.go index f1b8104eb..7cac2d639 100644 --- a/entc/integration/migrate/entv2/ent.go +++ b/entc/integration/migrate/entv2/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/entc/integration/template/ent/ent.go b/entc/integration/template/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/entc/integration/template/ent/ent.go +++ b/entc/integration/template/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/edgeindex/ent/ent.go b/examples/edgeindex/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/edgeindex/ent/ent.go +++ b/examples/edgeindex/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/entcpkg/ent/ent.go b/examples/entcpkg/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/entcpkg/ent/ent.go +++ b/examples/entcpkg/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/m2m2types/ent/ent.go b/examples/m2m2types/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/m2m2types/ent/ent.go +++ b/examples/m2m2types/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/m2mbidi/ent/ent.go b/examples/m2mbidi/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/m2mbidi/ent/ent.go +++ b/examples/m2mbidi/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/m2mrecur/ent/ent.go b/examples/m2mrecur/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/m2mrecur/ent/ent.go +++ b/examples/m2mrecur/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/o2m2types/ent/ent.go b/examples/o2m2types/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/o2m2types/ent/ent.go +++ b/examples/o2m2types/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/o2mrecur/ent/ent.go b/examples/o2mrecur/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/o2mrecur/ent/ent.go +++ b/examples/o2mrecur/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/o2o2types/ent/ent.go b/examples/o2o2types/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/o2o2types/ent/ent.go +++ b/examples/o2o2types/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/o2obidi/ent/ent.go b/examples/o2obidi/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/o2obidi/ent/ent.go +++ b/examples/o2obidi/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/o2orecur/ent/ent.go b/examples/o2orecur/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/o2orecur/ent/ent.go +++ b/examples/o2orecur/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/start/ent/ent.go b/examples/start/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/start/ent/ent.go +++ b/examples/start/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) } diff --git a/examples/traversal/ent/ent.go b/examples/traversal/ent/ent.go index 92e23bee0..3c71a475d 100644 --- a/examples/traversal/ent/ent.go +++ b/examples/traversal/ent/ent.go @@ -100,6 +100,9 @@ func (e *NotFoundError) Error() string { // IsNotFound returns a boolean indicating whether the error is a not found error. func IsNotFound(err error) bool { + if err == nil { + return false + } var e *NotFoundError return xerrors.As(err, &e) } @@ -124,6 +127,9 @@ func (e *NotSingularError) Error() string { // IsNotSingular returns a boolean indicating whether the error is a not singular error. func IsNotSingular(err error) bool { + if err == nil { + return false + } var e *NotSingularError return xerrors.As(err, &e) } @@ -140,6 +146,9 @@ func (e *NotLoadedError) Error() string { // IsNotLoaded returns a boolean indicating whether the error is a not loaded error. func IsNotLoaded(err error) bool { + if err == nil { + return false + } var e *NotLoadedError return xerrors.As(err, &e) } @@ -164,6 +173,9 @@ func (e *ConstraintError) Unwrap() error { // IsConstraintError returns a boolean indicating whether the error is a constraint failure. func IsConstraintError(err error) bool { + if err == nil { + return false + } var e *ConstraintError return xerrors.As(err, &e) }