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

QueryContext panic when the scanned value is nil and the destination is a slice of primitive #91

Closed
mlaflamm opened this issue Sep 14, 2021 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@mlaflamm
Copy link
Contributor

I have a custom model that look like this:

var dest struct {
  Count int `sql:"primary_key"`
  ID    []string
}

When the id column is null like this, QueryContext panic with an error call of reflect.Value.Type on zero Value

count|id|
-----+--+
    0|  |

I’ve tracked the issue in the function scanContext.rowElemValuePtr of file qrm/scan_context.go. “ID” is a slice of primitive and since the value is nil, there is not enough type information to create the slice by reflection.

I am working on a PR.

@go-jet
Copy link
Owner

go-jet commented Oct 25, 2021

Fixed with v2.6.0 release.

@go-jet go-jet closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants