New issue
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
Scan Struct(issue_570) fixed #596
Scan Struct(issue_570) fixed #596
Conversation
func ensureLen(d reflect.Value, n int) { | ||
if n > d.Cap() { | ||
if(n!=nil && d!=nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately This in invalid code, n
is an int
so can't be nil as such it doesn't compile as can be seen here:
https://go.dev/play/p/H4HgPUpzxPY
// I think this lines that I Add will help you to your bugs | ||
type ipS struct { | ||
Addr addr | ||
} | ||
|
||
type addr struct { | ||
net.IP | ||
} | ||
|
||
func (t *addr) RedisScan(src interface{}) error { | ||
if t == nil { | ||
return errors.New("nil pointer") | ||
} | ||
|
||
switch src := src.(type) { | ||
case string: | ||
return t.UnmarshalText([]byte(src)) | ||
case []byte: | ||
return t.UnmarshalText(src) | ||
default: | ||
return fmt.Errorf("cannot convert from %T to %T", src, t) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is never used, so not sure why it's needed?
Thanks for the PR's @mohammadrezayousefpour but unfortunately they all have some serious issues making them invalid. Happy to discuss fixes on the relevant issues and for you to raise new PR's, but please refer to this PR as an example of how we would like to see that done. |
No description provided.