You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides being able to retrieve the results: is there any deeper sense in restricting the destination object when scanning values from DB to be a ptr on a struct?
I do not have full control of the objects I get into my SW and get objects like
Which are caused by Go's way of wrapping (instead of casting) things into an interface once a method is declared to get an interface{} passed in. And more complex structures may well appear anywhere not only in my code.
To me it seems like this restriction (on *struct) is unnecessary as in the end you just need a destination object like a struct or a map to write values into. Of course the value will not be handed out when there is no pointer used but I think programmers do well know that and might only in case of a bug in their SW wonder why there is no result coming back.
Thus removing the additional check on ptrs (which btw are not even that strict as many a times a simple struct is enough to suffice the checks in ozzo) would remove the restriction on inner value representation with no side effect on any code using your library besides there are no errors returned in some cases that will not work properly anyways.
(That is: if it works now, ist will work then. But some cases will work that currently don't.)
As I just spent a few hours in debugging my issue in the first place I can implement that change for you, so there's no dev work for you to do. Just wanted to know your oppinion on whether that's a desired behavior or not.
The text was updated successfully, but these errors were encountered:
kPshi
added a commit
to kPshi/ozzo-dbx
that referenced
this issue
Aug 11, 2017
Besides being able to retrieve the results: is there any deeper sense in restricting the destination object when scanning values from DB to be a ptr on a struct?
I do not have full control of the objects I get into my SW and get objects like
or
Which are caused by Go's way of wrapping (instead of casting) things into an interface once a method is declared to get an interface{} passed in. And more complex structures may well appear anywhere not only in my code.
To me it seems like this restriction (on *struct) is unnecessary as in the end you just need a destination object like a struct or a map to write values into. Of course the value will not be handed out when there is no pointer used but I think programmers do well know that and might only in case of a bug in their SW wonder why there is no result coming back.
Thus removing the additional check on ptrs (which btw are not even that strict as many a times a simple struct is enough to suffice the checks in ozzo) would remove the restriction on inner value representation with no side effect on any code using your library besides there are no errors returned in some cases that will not work properly anyways.
(That is: if it works now, ist will work then. But some cases will work that currently don't.)
As I just spent a few hours in debugging my issue in the first place I can implement that change for you, so there's no dev work for you to do. Just wanted to know your oppinion on whether that's a desired behavior or not.
The text was updated successfully, but these errors were encountered: