-
Notifications
You must be signed in to change notification settings - Fork 68
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
Scanning into a recursive struct #57
Comments
Thank you for opening this issue and discovering such an edge case! To solve that issue we can introduce a threshold like 2 or 3: how many recursive loops are allowed. When we do the broad-first traversal we need to count the number of parents that have the same type as the current element and ensure that it is not bigger when the threshold, otherwise we need to skip that element and don't propagate further. Let me know if that solution solves your problem or feel free to propose how you see it. |
Hi, Thanks for your answer. Indeed that would solve my problem! |
hi, is there any development on this issue? ran into the same problem today |
The approach would be fairly complicated when we compare to limiting the recursion. But it would be fully cacheable and multithreadable with |
Ran into this issue as well. |
Thanks for the feedback, guys. Would any of you like to tackle this? |
Could try to tackle this issue in the near future. sqlx/reflectx/reflect.go could be used as a point of reference. |
Should we implement caching of
|
@anton7r thank you for deciding to tackle this issue. I appreciate that. Yes, you are also welcome to add caching for the reflection map. Here is an issue requesting exactly that: #25. Just do it as a separate PR because the feature requested in this PR and map caching aren't related. For caching, I would go with the default |
Hi,
I'd like to scan into a recursive struct:
This causes an infinite loop as scany introspects struct recursively.
Any tips for achieving that? I might be missing something obvious since I'm new to Go and scany. Ideally I'd like not to touch the Node struct definition since in my real-life code it is auto-generated. Also I'd like to avoid using
db:"-"
on Parent since I might want to get the immediate parent with a join.Thanks!
The text was updated successfully, but these errors were encountered: