Closed nwidger closed 5 years ago
The alias is also not preserved in the videoDBTypes
global in models/videos_test.go
:
videoDBTypes = map[string]string{`Deleted`: `BOOL`, `ID`: `INT`, `Name`: `TEXT`, `Sha256sum`: `TEXT`}
Please let me know if I can provide any further info to help track down this bug!
I found some time and tried to take a stab at fixing the issue myself in PR #416.
Hey @nwidger. Thanks so much for the PR! I did end up not accepting it the way it was simply because of the breaking change to an exported function. You'll see the way I fixed it is much more ugly than what you did haha. Rather than do the back and forth of shaping the PR I did the change because there was another gentleman who hit this in #411 that needed it fixed too. I credited you in the changelog for the suggested fix. Thanks again :)
No worries, I figured my approach may have required some tweaking post-review. I'm just glad the issue is fixed. Thanks!
If you're having a generation problem please answer these questions before submitting your issue. Thanks!
What version of SQLBoiler are you using (
sqlboiler --version
)?SQLBoiler v3.1.0
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
sqlboiler --wipe sqlite3
If this happened at runtime what code produced the issue? (if not applicable leave blank)
The
results.Scan
call in the09_relationship_to_many_eager.go.tpl
used to create part ofmodels/users.go
in the generated code.What is the output of the command above with the
-d
flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
In my sqlboiler configuration file, I created a column alias for the
sha256sum
column of thevideos
table so that the generatedVideo
struct inmodels/videos.go
had a field namedSHA256Sum
instead ofSha256sum
, in accordance with Go naming conventions:Unfortunately, the generated
userL.LoadVideos
method inmodels/users.go
doesn't seem to respect the column alias, and refers toSha256sum
in aScan
causing a compile-time error:I believe the generated code comes from the template
09_relationship_to_many_eager.go.tpl
, but I'm not sure how to fix the issue.