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
001e33f3
authored
2013-09-22 19:20:40 +0800
by
slene
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix #213
1 parent
09aca252
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
orm/db.go
orm/models_info_m.go
orm/orm_test.go
orm/db.go
View file @
001e33f
...
...
@@ -649,9 +649,12 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi
if
field
.
IsValid
()
{
d
.
setColsValues
(
mmi
,
&
field
,
mmi
.
fields
.
dbcols
,
trefs
[
:
len
(
mmi
.
fields
.
dbcols
)],
tz
)
for
_
,
fi
:=
range
mmi
.
fields
.
fieldsReverse
{
if
fi
.
reverseFieldInfo
.
mi
==
lastm
{
if
fi
.
inModel
&&
fi
.
reverseFieldInfo
.
mi
==
lastm
{
if
fi
.
reverseFieldInfo
!=
nil
{
field
.
Field
(
fi
.
fieldIndex
)
.
Set
(
last
.
Addr
())
f
:=
field
.
Field
(
fi
.
fieldIndex
)
if
f
.
Kind
()
==
reflect
.
Ptr
{
f
.
Set
(
last
.
Addr
())
}
}
}
}
...
...
orm/models_info_m.go
View file @
001e33f
...
...
@@ -66,6 +66,7 @@ func newModelInfo(val reflect.Value) (info *modelInfo) {
fi
.
fieldIndex
=
i
fi
.
mi
=
info
fi
.
inModel
=
true
}
if
err
!=
nil
{
...
...
orm/orm_test.go
View file @
001e33f
...
...
@@ -745,6 +745,17 @@ func TestRelatedSel(t *testing.T) {
num
,
err
=
qs
.
Filter
(
"user__username"
,
"slene"
)
.
Count
()
throwFail
(
t
,
err
)
throwFail
(
t
,
AssertIs
(
num
,
1
))
var
posts
[]
*
Post
qs
=
dORM
.
QueryTable
(
"post"
)
num
,
err
=
qs
.
RelatedSel
()
.
All
(
&
posts
)
throwFail
(
t
,
err
)
throwFailNow
(
t
,
AssertIs
(
num
,
4
))
throwFailNow
(
t
,
AssertIs
(
posts
[
0
]
.
User
.
UserName
,
"slene"
))
throwFailNow
(
t
,
AssertIs
(
posts
[
1
]
.
User
.
UserName
,
"astaxie"
))
throwFailNow
(
t
,
AssertIs
(
posts
[
2
]
.
User
.
UserName
,
"astaxie"
))
throwFailNow
(
t
,
AssertIs
(
posts
[
3
]
.
User
.
UserName
,
"nobody"
))
}
func
TestSetCond
(
t
*
testing
.
T
)
{
...
...
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