From 5975c63a2044014d99d4f6b3da1b7684c7955d52 Mon Sep 17 00:00:00 2001 From: yinheli Date: Sat, 24 Jul 2021 21:20:18 +0800 Subject: [PATCH] fix error handle --- tools/xservice/model/mysql/table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/xservice/model/mysql/table.go b/tools/xservice/model/mysql/table.go index 4770b20..66c073f 100644 --- a/tools/xservice/model/mysql/table.go +++ b/tools/xservice/model/mysql/table.go @@ -493,7 +493,7 @@ func (t *MySQLGenerator) tableDefaultModel(table *Table) *jen.Statement { jen.Id("var data ").Id(modelName), jen.Id("err := t.tx.First(&data, conds...).Error"), jen.If(jen.Id("err != nil &&").Qual("errors", "Is(err, gorm.ErrRecordNotFound)")).Block( - jen.Return(jen.Id("nil, err")), + jen.Return(jen.Id("nil, nil")), ), jen.Return(jen.Id("&data, err")), ).Line()