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
22d2de9f
Commit
22d2de9f
authored
Sep 06, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm fix 1. support Limit when use QuerySeter.One 2. return Local time
parent
6064a7ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
db.go
orm/db.go
+9
-8
No files found.
orm/db.go
View file @
22d2de9f
...
...
@@ -497,15 +497,15 @@ func (d *dbBase) ReadBatch(q dbQuerier, qs *querySet, mi *modelInfo, cond *Condi
}
if
errTyp
{
panic
(
fmt
.
Sprintf
(
"wrong object type `%s` for rows scan, need *[]*%s or *%s"
,
ind
.
Type
(),
mi
.
fullName
,
mi
.
fullName
))
if
one
{
panic
(
fmt
.
Sprintf
(
"wrong object type `%s` for rows scan, need *%s"
,
val
.
Type
(),
mi
.
fullName
))
}
else
{
panic
(
fmt
.
Sprintf
(
"wrong object type `%s` for rows scan, need *[]*%s or *[]%s"
,
val
.
Type
(),
mi
.
fullName
,
mi
.
fullName
))
}
}
rlimit
:=
qs
.
limit
offset
:=
qs
.
offset
if
one
{
rlimit
=
0
offset
=
0
}
Q
:=
d
.
ins
.
TableQuote
()
...
...
@@ -704,7 +704,7 @@ func (d *dbBase) setColsValues(mi *modelInfo, ind *reflect.Value, cols []string,
panic
(
fmt
.
Sprintf
(
"Raw value: `%v` %s"
,
val
,
err
.
Error
()))
}
_
,
err
=
d
.
setFieldValue
(
fi
,
value
,
&
field
)
_
,
err
=
d
.
setFieldValue
(
fi
,
value
,
field
)
if
err
!=
nil
{
panic
(
fmt
.
Sprintf
(
"Raw value: `%v` %s"
,
val
,
err
.
Error
()))
...
...
@@ -786,6 +786,7 @@ setValue:
s
=
s
[
:
19
]
}
t
,
err
=
time
.
ParseInLocation
(
format_DateTime
,
s
,
tz
)
t
=
t
.
In
(
DefaultTimeLoc
)
}
if
err
!=
nil
&&
s
!=
"0000-00-00"
&&
s
!=
"0000-00-00 00:00:00"
{
tErr
=
err
...
...
@@ -864,7 +865,7 @@ end:
}
func
(
d
*
dbBase
)
setFieldValue
(
fi
*
fieldInfo
,
value
interface
{},
field
*
reflect
.
Value
)
(
interface
{},
error
)
{
func
(
d
*
dbBase
)
setFieldValue
(
fi
*
fieldInfo
,
value
interface
{},
field
reflect
.
Value
)
(
interface
{},
error
)
{
fieldType
:=
fi
.
fieldType
isNative
:=
fi
.
isFielder
==
false
...
...
@@ -921,7 +922,7 @@ setValue:
mf
:=
reflect
.
New
(
fi
.
relModelInfo
.
addrField
.
Elem
()
.
Type
())
field
.
Set
(
mf
)
f
:=
mf
.
Elem
()
.
Field
(
fi
.
relModelInfo
.
fields
.
pk
.
fieldIndex
)
field
=
&
f
field
=
f
goto
setValue
}
}
...
...
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