Closed wln32 closed 2 months ago
@wln32 这块设计如此哈,主要是为了避免很多没有意义的if err != nil && err != sql.ErrNoRows
的冗余判断代码,具体请参考文档:https://goframe.org/pages/viewpage.action?pageId=47699230
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
@wln32 This piece of design is so hazy, mainly to avoid a lot of meaningless redundant judgment codes of
if err != nil && err != sql.ErrNoRows
. For details, please refer to the document: https://goframe.org/pages /viewpage.action?pageId=47699230
Go version
1.22
GoFrame version
2.7.0
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
1.当Scan的参数是指针的时候,也就是*Result,没有查询到数据,返回sql.ErrNoRows
3.当Scan的参数是[]Result或者[]*Result的时候,没有查询到数据,没有返回sql.ErrNoRows
建议统一返回错误,或者不返回错误比较好点
What did you see happen?
err= sql: no rows in result set err= nil err= nil
What did you expect to see?
err= nil err= nil err= nil
或者 err= sql: no rows in result set err= sql: no rows in result set err= sql: no rows in result set