Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
0222b8d6
authored
2015-04-15 17:41:41 +0700
by
Trần Văn Thanh
Committed by
astaxie
2015-05-25 09:10:36 +0800
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed: when RelatedSel have multi string/relation, it only get last string
1 parent
23268b78
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
orm/orm_queryset.go
orm/orm_queryset.go
View file @
0222b8d
...
...
@@ -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
Styling with
Markdown
is supported
Attach a file
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 post a comment