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
If the struct model used refers to any field with same type as that of model directly or indirectly in downstream dependencies then parser creation goes into infinite loop and program never proceeds. Example of such model. ( here Manager is of type User ) type User struct { ID uint ```gorm:"primary_key" rql:"filter,sort"\``` ManagerId *uint Manager *User DirectReports []User ```gorm:"foreignKey:ManagerId"\``` Admin bool ```rql:"filter"``` Name string ```rql:"filter"``` Tags datatypes.JSONSlice[string] ```rql:"filter"``` AddressName string ```rql:"filter"``` CreatedAt time.Time ```rql:"filter,sort"``` }
I propose here two possible solutions
We introduce a nested tag like filter and sort and if a field of type struct is marked nested then only process it. This breaks the convention yet i have already forked this repo and wrote a code which works with this.
Generate all things parser does at run time ( on the fly while parsing queries and not while creating parser) and don't even preprocess model with parser and in doing so we can break loop till all fields refered in query are are parsed.
Would be happy to discuss both the approaches ( or if there could be any other ) and create necessary PR to fix this.
The text was updated successfully, but these errors were encountered:
If the struct model used refers to any field with same type as that of model directly or indirectly in downstream dependencies then parser creation goes into infinite loop and program never proceeds. Example of such model. ( here Manager is of type User )
type User struct { ID uint ```gorm:"primary_key" rql:"filter,sort"\``` ManagerId *uint Manager *User DirectReports []User ```gorm:"foreignKey:ManagerId"\``` Admin bool ```rql:"filter"``` Name string ```rql:"filter"``` Tags datatypes.JSONSlice[string] ```rql:"filter"``` AddressName string ```rql:"filter"``` CreatedAt time.Time ```rql:"filter,sort"``` }
I propose here two possible solutions
nested
tag like filter and sort and if a field of type struct is marked nested then only process it. This breaks the convention yet i have already forked this repo and wrote a code which works with this.Would be happy to discuss both the approaches ( or if there could be any other ) and create necessary PR to fix this.
The text was updated successfully, but these errors were encountered: