We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/didi/gendry/blob/master/scanner/scanner.go#L94
如果scan不到数据,并且入参是slice,为什么返回错误码返回nil而不是返回ErrEmptyResult呢
The text was updated successfully, but these errors were encountered:
对于一个结构体,如果不返回错误,你无法知道查询结果真的就是各个field都是0值还是没查询到,所以需要返回一个ErrEmptyResult 对于slice,你判断len(target) > 0 就知道是否是empty了。
Sorry, something went wrong.
感谢你的回复! 对于target是slice的时候,如果我们能够只使用err这个条件来判断就好了。 期望在 len(target)==0 的时候Scan函数也返回ErrEmptyResult。
这样不太合理,因为每个人的使用场景都不一样,你可以增加一个封装判断leng == 0 然后返回 ErrEmptyResult
No branches or pull requests
https://github.com/didi/gendry/blob/master/scanner/scanner.go#L94
如果scan不到数据,并且入参是slice,为什么返回错误码返回nil而不是返回ErrEmptyResult呢
The text was updated successfully, but these errors were encountered: