Skip to content

Commit

Permalink
fix error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
yinheli committed Jul 24, 2021
1 parent ea93f41 commit 5975c63
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/xservice/model/mysql/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5975c63

Please sign in to comment.