Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
0222b8d6
Commit
0222b8d6
authored
Apr 15, 2015
by
Trần Văn Thanh
Committed by
astaxie
May 25, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed: when RelatedSel have multi string/relation, it only get last string
parent
23268b78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
orm_queryset.go
orm/orm_queryset.go
+15
-17
No files found.
orm/orm_queryset.go
View file @
0222b8d6
...
...
@@ -115,23 +115,21 @@ func (o querySet) OrderBy(exprs ...string) QuerySeter {
// set relation model to query together.
// it will query relation models and assign to parent model.
func
(
o
querySet
)
RelatedSel
(
params
...
interface
{})
QuerySeter
{
var
related
[]
string
if
len
(
params
)
==
0
{
o
.
relDepth
=
DefaultRelsDepth
}
else
{
for
_
,
p
:=
range
params
{
switch
val
:=
p
.
(
type
)
{
case
string
:
related
=
append
(
o
.
related
,
val
)
case
int
:
o
.
relDepth
=
val
default
:
panic
(
fmt
.
Errorf
(
"<QuerySeter.RelatedSel> wrong param kind: %v"
,
val
))
}
}
}
o
.
related
=
related
return
&
o
if
len
(
params
)
==
0
{
o
.
relDepth
=
DefaultRelsDepth
}
else
{
for
_
,
p
:=
range
params
{
switch
val
:=
p
.
(
type
)
{
case
string
:
o
.
related
=
append
(
o
.
related
,
val
)
case
int
:
o
.
relDepth
=
val
default
:
panic
(
fmt
.
Errorf
(
"<QuerySeter.RelatedSel> wrong param kind: %v"
,
val
))
}
}
}
return
&
o
}
// set condition to QuerySeter.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment