good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
upper
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
open
upper
Commits
b0496850
Commit
b0496850
authored
10 years ago
by
José Carlos Nieto
Browse files
Options
Downloads
Patches
Plain Diff
Adding single derefence in case user passed a pointer to struct instead of a struct.
parent
0e01268a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
error.go
+1
-1
1 addition, 1 deletion
error.go
util/sqlutil/main.go
+7
-0
7 additions, 0 deletions
util/sqlutil/main.go
with
8 additions
and
1 deletion
error.go
+
1
−
1
View file @
b0496850
...
...
@@ -32,7 +32,7 @@ var (
ErrExpectingPointer
=
errors
.
New
(
`Argument must be an address.`
)
ErrExpectingSlicePointer
=
errors
.
New
(
`Argument must be a slice address.`
)
ErrExpectingSliceMapStruct
=
errors
.
New
(
`Argument must be a slice address of maps or structs.`
)
ErrExpectingMapOrStruct
=
errors
.
New
(
`Argument must be a map or struct
address
.`
)
ErrExpectingMapOrStruct
=
errors
.
New
(
`Argument must be
either
a map or
a
struct.`
)
ErrNoMoreRows
=
errors
.
New
(
`There are no more rows in this result set.`
)
ErrNotConnected
=
errors
.
New
(
`You're currently not connected.`
)
ErrMissingDatabaseName
=
errors
.
New
(
`Missing database name.`
)
...
...
This diff is collapsed.
Click to expand it.
util/sqlutil/main.go
+
7
−
0
View file @
b0496850
...
...
@@ -260,6 +260,13 @@ func (self *T) FieldValues(item interface{}, convertFn func(interface{}) interfa
item_v
:=
reflect
.
ValueOf
(
item
)
item_t
:=
item_v
.
Type
()
if
item_t
.
Kind
()
==
reflect
.
Ptr
{
// Single derefence. Just in case user passed a pointer to struct instead of a struct.
item
=
item_v
.
Elem
()
.
Interface
()
item_v
=
reflect
.
ValueOf
(
item
)
item_t
=
item_v
.
Type
()
}
switch
item_t
.
Kind
()
{
case
reflect
.
Struct
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment