Open sarthak opened 11 months ago
sqlboiler --version
SQLBoiler v4.10.2
Doesn't matter
type struct JoinStruct { A struct { ColA string `boil:"cola"` ColB string `boil:"colb"` } `boil:",bind" } queries.MakeStructMapping(reflect.TypeOf(JoinStruct{}))
I expect bind mapping to be a map of form {"cola": .., "colb", ...}. But in reality the map is of form {"a.cola": ..., "a.colb"}.
{"cola": .., "colb", ...}
{"a.cola": ..., "a.colb"}
Thus the bug is that boil:",bind" behaves identical to boil:"<fieldname>,bind".
boil:",bind"
boil:"<fieldname>,bind"
These lines are buggy -- https://github.com/volatiletech/sqlboiler/blob/644d45d0c780eab0b17a7da9e709c3cb10781768/queries/reflect.go#L395-L400
Suggested patch is to replace if len(tag) == 0 if if len(tag) == 0 && !recurse.
if len(tag) == 0
if len(tag) == 0 && !recurse
If you have identified where the issue is, kindly send in a PR with tests included to prevent a regression.
What version of SQLBoiler are you using (
sqlboiler --version
)?SQLBoiler v4.10.2
What is your database and version (eg. Postgresql 10)
Doesn't matter
If this happened at runtime what code produced the issue? (if not applicable leave blank)
Further information. What did you do, what did you expect?
I expect bind mapping to be a map of form
{"cola": .., "colb", ...}
. But in reality the map is of form{"a.cola": ..., "a.colb"}
.Thus the bug is that
boil:",bind"
behaves identical toboil:"<fieldname>,bind"
.How to fix?
These lines are buggy -- https://github.com/volatiletech/sqlboiler/blob/644d45d0c780eab0b17a7da9e709c3cb10781768/queries/reflect.go#L395-L400
Suggested patch is to replace
if len(tag) == 0
ifif len(tag) == 0 && !recurse
.