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

Json deconing throws nil dereference #141

Open
eduardhasanaj opened this issue Oct 5, 2019 · 7 comments
Open

Json deconing throws nil dereference #141

eduardhasanaj opened this issue Oct 5, 2019 · 7 comments

Comments

@eduardhasanaj
Copy link

Hi,
I am seeing and error from this lib at this line
github.com/ericlagergren/[email protected]/scan.go:43 +0x9e
The error occurred when using json decoder on a model generated by sqlboiler.

@ericlagergren
Copy link
Owner

Could you post a code same that I could use to reproduce this? The panic on line 43 is ostensibly because the recover is nil, which is likely due to the generated code. I’m not familiar with sqlboiler.

@eduardhasanaj
Copy link
Author

eduardhasanaj commented Oct 5, 2019

I am sorry for not providing the code.

type Option struct {
	ID           int               `boil:"id" json:"id" toml:"id" yaml:"id"`
	OptionlistID null.Int          `boil:"optionlist_id" json:"optionlist_id,omitempty" toml:"optionlist_id" yaml:"optionlist_id,omitempty"`
	Description  null.String       `boil:"description" json:"description,omitempty" toml:"description" yaml:"description,omitempty"`
	Price        types.NullDecimal `boil:"price" json:"price,omitempty" toml:"price" yaml:"price,omitempty"`

	R *optionR `boil:"-" json:"-" toml:"-" yaml:"-"`
	L optionL  `boil:"-" json:"-" toml:"-" yaml:"-"`
}

If I invoke scan on the Price before decoding I do not get the error.
The problem is that I need this to decode an array

@ericlagergren
Copy link
Owner

Hm. Sounds similar to volatiletech/sqlboiler#404. Perhaps I should revisit that issue.

@aarondl
Copy link

aarondl commented Oct 9, 2019

I've corrected this as ericlagergren suggested in his PR to sqlboiler. Will be in the dev branch for now and included in a later release.

@jbactad
Copy link

jbactad commented Dec 9, 2019

Hi @aarondl , do we have an update about this issue? If this is already fixed, do we know already when it will be merged?

@eduardhasanaj
Copy link
Author

@jbactad Hi,
Currently I am using dev branch for this problem.

@aarondl
Copy link

aarondl commented Dec 14, 2019

@jbactad As far as I'm concerned this is fixed already in master v3.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants