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

Check on Ptr of Struct too strict? #42

Open
kPshi opened this issue Aug 1, 2017 · 0 comments
Open

Check on Ptr of Struct too strict? #42

kPshi opened this issue Aug 1, 2017 · 0 comments

Comments

@kPshi
Copy link

kPshi commented Aug 1, 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

interface{}
  |---> Ptr
           |---> interface{}
                         |---> Ptr
                                   |---> Struct

or

interface{}
  |---> Ptr
           |---> interface{}
                         |---> Struct

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.

kPshi added a commit to kPshi/ozzo-dbx that referenced this issue Aug 11, 2017
kPshi added a commit to kPshi/ozzo-dbx that referenced this issue Aug 11, 2017
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

1 participant