mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 20:30:55 +00:00
fixed: when RelatedSel have multi string/relation, it only get last string
This commit is contained in:
parent
23268b788a
commit
0222b8d693
@ -115,23 +115,21 @@ func (o querySet) OrderBy(exprs ...string) QuerySeter {
|
|||||||
// set relation model to query together.
|
// set relation model to query together.
|
||||||
// it will query relation models and assign to parent model.
|
// it will query relation models and assign to parent model.
|
||||||
func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
|
func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
|
||||||
var related []string
|
if len(params) == 0 {
|
||||||
if len(params) == 0 {
|
o.relDepth = DefaultRelsDepth
|
||||||
o.relDepth = DefaultRelsDepth
|
} else {
|
||||||
} else {
|
for _, p := range params {
|
||||||
for _, p := range params {
|
switch val := p.(type) {
|
||||||
switch val := p.(type) {
|
case string:
|
||||||
case string:
|
o.related = append(o.related, val)
|
||||||
related = append(o.related, val)
|
case int:
|
||||||
case int:
|
o.relDepth = val
|
||||||
o.relDepth = val
|
default:
|
||||||
default:
|
panic(fmt.Errorf("<QuerySeter.RelatedSel> wrong param kind: %v", val))
|
||||||
panic(fmt.Errorf("<QuerySeter.RelatedSel> wrong param kind: %v", val))
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return &o
|
||||||
o.related = related
|
|
||||||
return &o
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set condition to QuerySeter.
|
// set condition to QuerySeter.
|
||||||
|
Loading…
Reference in New Issue
Block a user