0222b8d6 by Trần Văn Thanh Committed by astaxie

fixed: when RelatedSel have multi string/relation, it only get last string

1 parent 23268b78
...@@ -115,14 +115,13 @@ func (o querySet) OrderBy(exprs ...string) QuerySeter { ...@@ -115,14 +115,13 @@ func (o querySet) OrderBy(exprs ...string) QuerySeter {
115 // set relation model to query together. 115 // set relation model to query together.
116 // it will query relation models and assign to parent model. 116 // it will query relation models and assign to parent model.
117 func (o querySet) RelatedSel(params ...interface{}) QuerySeter { 117 func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
118 var related []string
119 if len(params) == 0 { 118 if len(params) == 0 {
120 o.relDepth = DefaultRelsDepth 119 o.relDepth = DefaultRelsDepth
121 } else { 120 } else {
122 for _, p := range params { 121 for _, p := range params {
123 switch val := p.(type) { 122 switch val := p.(type) {
124 case string: 123 case string:
125 related = append(o.related, val) 124 o.related = append(o.related, val)
126 case int: 125 case int:
127 o.relDepth = val 126 o.relDepth = val
128 default: 127 default:
...@@ -130,7 +129,6 @@ func (o querySet) RelatedSel(params ...interface{}) QuerySeter { ...@@ -130,7 +129,6 @@ func (o querySet) RelatedSel(params ...interface{}) QuerySeter {
130 } 129 }
131 } 130 }
132 } 131 }
133 o.related = related
134 return &o 132 return &o
135 } 133 }
136 134
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!