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
6064a7ab
Commit
6064a7ab
authored
Aug 30, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm RawSeter readValues set nil when get NULL
parent
8f5ca303
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
orm_raw.go
orm/orm_raw.go
+16
-4
No files found.
orm/orm_raw.go
View file @
6064a7ab
...
...
@@ -90,7 +90,7 @@ func (o *rawSet) readValues(container interface{}) (int64, error) {
case
*
ParamsList
:
typ
=
3
default
:
panic
(
fmt
.
Sprintf
(
"unsupport read values type `%T`"
,
container
))
panic
(
fmt
.
Sprintf
(
"
<RawSeter>
unsupport read values type `%T`"
,
container
))
}
query
:=
o
.
query
...
...
@@ -133,20 +133,32 @@ func (o *rawSet) readValues(container interface{}) (int64, error) {
params
:=
make
(
Params
,
len
(
cols
))
for
i
,
ref
:=
range
refs
{
value
:=
reflect
.
Indirect
(
reflect
.
ValueOf
(
ref
))
.
Interface
()
.
(
sql
.
NullString
)
params
[
cols
[
i
]]
=
value
.
String
if
value
.
Valid
{
params
[
cols
[
i
]]
=
value
.
String
}
else
{
params
[
cols
[
i
]]
=
nil
}
}
maps
=
append
(
maps
,
params
)
case
2
:
params
:=
make
(
ParamsList
,
0
,
len
(
cols
))
for
_
,
ref
:=
range
refs
{
value
:=
reflect
.
Indirect
(
reflect
.
ValueOf
(
ref
))
.
Interface
()
.
(
sql
.
NullString
)
params
=
append
(
params
,
value
.
String
)
if
value
.
Valid
{
params
=
append
(
params
,
value
.
String
)
}
else
{
params
=
append
(
params
,
nil
)
}
}
lists
=
append
(
lists
,
params
)
case
3
:
for
_
,
ref
:=
range
refs
{
value
:=
reflect
.
Indirect
(
reflect
.
ValueOf
(
ref
))
.
Interface
()
.
(
sql
.
NullString
)
list
=
append
(
list
,
value
.
String
)
if
value
.
Valid
{
list
=
append
(
list
,
value
.
String
)
}
else
{
list
=
append
(
list
,
nil
)
}
}
}
...
...
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