Skip to content
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

Conversation

mohammadrezayousefpour
Copy link

No description provided.

func ensureLen(d reflect.Value, n int) {
if n > d.Cap() {
if(n!=nil && d!=nil)
Copy link
Collaborator

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

Comment on lines +30 to +52
// 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)
}
}
Copy link
Collaborator

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?

@stevenh
Copy link
Collaborator

stevenh commented Feb 1, 2022

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.

@stevenh stevenh closed this Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants