jet: Infinite loop on types that reference eachother

type TableOne struct {
    model.TableOnes

    TableTwos []TableTwo
}

type TableTwo struct {
    model.TableTwos

    TableOne TableOne
}

Preforming a stmt.Query with either of these structs (or anything that has either of these structs) will load infinitely. No error is returned, it was incredibly long and time consuming to find the source of the issue.

I have tried making the types pointers to no avail. (idea being they would become nullable) This pattern is common when you have a Has(One/Many)BelongsTo relationship.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 29 (8 by maintainers)

Most upvoted comments

Version 2.7 will probably be released in February or after. In the meantime, you can use type-recursion branch. On this branch types scan recursions are prevented(test1, test2).

Forgot about this, always juggling 100 things. I’ll make one today if not then this week.

Refactored all our current jet code to use this detection, everything working smoothly, functions are now specific yet lean and many less points of failure, this is the reason I wanted to use this library, glad I can finally use it as intended. Working great!