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
5e4241fc
Commit
5e4241fc
authored
Dec 06, 2018
by
zav8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for field of type sql.NullXxx in rawSet.setFieldValue()
parent
8152ade1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
orm_raw.go
orm/orm_raw.go
+24
-2
No files found.
orm/orm_raw.go
View file @
5e4241fc
...
...
@@ -150,8 +150,10 @@ func (o *rawSet) setFieldValue(ind reflect.Value, value interface{}) {
case
reflect
.
Struct
:
if
value
==
nil
{
ind
.
Set
(
reflect
.
Zero
(
ind
.
Type
()))
}
else
if
_
,
ok
:=
ind
.
Interface
()
.
(
time
.
Time
);
ok
{
return
}
switch
indi
:=
ind
.
Interface
()
.
(
type
)
{
case
time
.
Time
:
var
str
string
switch
d
:=
value
.
(
type
)
{
case
time
.
Time
:
...
...
@@ -178,6 +180,26 @@ func (o *rawSet) setFieldValue(ind reflect.Value, value interface{}) {
}
}
}
case
sql
.
NullString
:
err
:=
indi
.
Scan
(
value
)
if
err
==
nil
{
ind
.
Set
(
reflect
.
ValueOf
(
indi
))
}
case
sql
.
NullInt64
:
err
:=
indi
.
Scan
(
value
)
if
err
==
nil
{
ind
.
Set
(
reflect
.
ValueOf
(
indi
))
}
case
sql
.
NullFloat64
:
err
:=
indi
.
Scan
(
value
)
if
err
==
nil
{
ind
.
Set
(
reflect
.
ValueOf
(
indi
))
}
case
sql
.
NullBool
:
err
:=
indi
.
Scan
(
value
)
if
err
==
nil
{
ind
.
Set
(
reflect
.
ValueOf
(
indi
))
}
}
}
}
...
...
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