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
Hi, I was trying to upgrade from 0.10 to latest but found an issue introduced in 0.21.
Using prior version we can do the following
type Discussion struct {
ID int
ComplaintID *int
Complaint *DiscussionComplaint `autosave:"true"`
}
// discussion has zero or one complaint
type DiscussionComplaint struct {
ID int
}
// Table to override table name
func (dc DiscussionComplaint) Table() string {
return "complaints"
}
func main() {
var discussions []Discussion
// on 0.20 we can do the following
complaintFilter := rel.Gte("complaint_id", start).And(rel.Lte("complaint_id", finish))
pg.FindAll(context.Background(), &discussions, rel.Preload("complaint"), complaintFilter)
for _, discussion := range discussions {
fmt.Println("discussion id", discussion.ID)
fmt.Println("discussion.complaint_id", discussion.ComplaintID)
fmt.Println("discussion.complaint.id", discussion.Complaint.ID)
}
}
starting from 0.21 it will raise an error panic: value method main.DiscussionComplaint.Table called using nil *DiscussionComplaint pointer.
Do we need to add some kind of adjustment to be able to upgrade to 0.21? Thanks
The text was updated successfully, but these errors were encountered:
Hi, I was trying to upgrade from 0.10 to latest but found an issue introduced in 0.21.
Using prior version we can do the following
starting from 0.21 it will raise an error
panic: value method main.DiscussionComplaint.Table called using nil *DiscussionComplaint pointer
.Do we need to add some kind of adjustment to be able to upgrade to 0.21? Thanks
The text was updated successfully, but these errors were encountered: