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
86e18bf6
Commit
86e18bf6
authored
Apr 20, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1882 from miraclesu/fix/orm_multi_insert
orm: fix multi insert panic
parents
14159eaa
903e21be
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
orm.go
orm/orm.go
+1
-1
orm_test.go
orm/orm_test.go
+6
-0
No files found.
orm/orm.go
View file @
86e18bf6
...
...
@@ -191,7 +191,7 @@ func (o *orm) InsertMulti(bulk int, mds interface{}) (int64, error) {
if
bulk
<=
1
{
for
i
:=
0
;
i
<
sind
.
Len
();
i
++
{
ind
:=
sind
.
Index
(
i
)
ind
:=
reflect
.
Indirect
(
sind
.
Index
(
i
)
)
mi
,
_
:=
o
.
getMiInd
(
ind
.
Interface
(),
false
)
id
,
err
:=
o
.
alias
.
DbBaser
.
Insert
(
o
.
db
,
mi
,
ind
,
o
.
alias
.
TZ
)
if
err
!=
nil
{
...
...
orm/orm_test.go
View file @
86e18bf6
...
...
@@ -2042,6 +2042,12 @@ func TestIntegerPk(t *testing.T) {
throwFail
(
t
,
err
)
throwFail
(
t
,
AssertIs
(
out
.
Value
,
intPk
.
Value
))
}
num
,
err
=
dORM
.
InsertMulti
(
1
,
[]
*
IntegerPk
{
&
IntegerPk
{
ID
:
1
,
Value
:
"ok"
,
}})
throwFail
(
t
,
err
)
throwFail
(
t
,
AssertIs
(
num
,
1
))
}
func
TestInsertAuto
(
t
*
testing
.
T
)
{
...
...
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