Looking for a way how to load related items in case of multiple references. I have
type Accounts struct {
Id string `orm:"pk"`
Transactions []*Transactions `orm:"reverse(many)"`
}
and
type Transactions struct {
Id string `orm:"pk"`
SourceAccount *Accounts `orm:"rel(fk);"`
TargetAccount *Accounts `orm:"rel(fk);"`
}
When I'm doing
o := orm.NewOrm()
o.LoadRelated(account, "Transactions")
it loads Transactions only where SourceAccount refers to my account, but it doesn't return transactions where account was mentioned as TargetAccount. If I change order like this:
type Transactions struct {
Id string `orm:"pk"`
TargetAccount *Accounts `orm:"rel(fk);"`
SourceAccount *Accounts `orm:"rel(fk);"`
}
It loads transactions where account was mentioned as TargetAccount. So order is important :) Is there a way to load both by LoadRelated ?