Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d9f01cb8
Unverified
Commit
d9f01cb8
authored
Jul 17, 2019
by
Oleg Gaidarenko
Committed by
GitHub
Jul 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQLStore: use bool pointer instead of string (#18111)
parent
c194ae1b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
13 deletions
+9
-13
pkg/models/user.go
+1
-3
pkg/services/sqlstore/user.go
+2
-7
pkg/services/sqlstore/user_test.go
+6
-3
No files found.
pkg/models/user.go
View file @
d9f01cb8
...
@@ -147,9 +147,7 @@ type SearchUsersQuery struct {
...
@@ -147,9 +147,7 @@ type SearchUsersQuery struct {
Limit
int
Limit
int
AuthModule
string
AuthModule
string
// We have to use string not bool, since there is cases when
IsDisabled
*
bool
// we don't care if user is disabled or not
IsDisabled
string
Result
SearchUserQueryResult
Result
SearchUserQueryResult
}
}
...
...
pkg/services/sqlstore/user.go
View file @
d9f01cb8
...
@@ -456,14 +456,9 @@ func SearchUsers(query *models.SearchUsersQuery) error {
...
@@ -456,14 +456,9 @@ func SearchUsers(query *models.SearchUsersQuery) error {
whereParams
=
append
(
whereParams
,
queryWithWildcards
,
queryWithWildcards
,
queryWithWildcards
)
whereParams
=
append
(
whereParams
,
queryWithWildcards
,
queryWithWildcards
,
queryWithWildcards
)
}
}
if
query
.
IsDisabled
!=
""
{
if
query
.
IsDisabled
!=
nil
{
param
,
err
:=
strconv
.
ParseBool
(
query
.
IsDisabled
)
if
err
!=
nil
{
return
err
}
whereConditions
=
append
(
whereConditions
,
"is_disabled = ?"
)
whereConditions
=
append
(
whereConditions
,
"is_disabled = ?"
)
whereParams
=
append
(
whereParams
,
param
)
whereParams
=
append
(
whereParams
,
query
.
IsDisabled
)
}
}
if
query
.
AuthModule
!=
""
{
if
query
.
AuthModule
!=
""
{
...
...
pkg/services/sqlstore/user_test.go
View file @
d9f01cb8
...
@@ -194,7 +194,8 @@ func TestUserDataAccess(t *testing.T) {
...
@@ -194,7 +194,8 @@ func TestUserDataAccess(t *testing.T) {
}
}
})
})
query
:=
models
.
SearchUsersQuery
{
IsDisabled
:
"false"
}
isDisabled
:=
false
query
:=
models
.
SearchUsersQuery
{
IsDisabled
:
&
isDisabled
}
err
:=
SearchUsers
(
&
query
)
err
:=
SearchUsers
(
&
query
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
...
@@ -293,7 +294,8 @@ func TestUserDataAccess(t *testing.T) {
...
@@ -293,7 +294,8 @@ func TestUserDataAccess(t *testing.T) {
err
:=
BatchDisableUsers
(
&
disableCmd
)
err
:=
BatchDisableUsers
(
&
disableCmd
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
query
:=
&
models
.
SearchUsersQuery
{
IsDisabled
:
"true"
}
isDisabled
:=
true
query
:=
&
models
.
SearchUsersQuery
{
IsDisabled
:
&
isDisabled
}
err
=
SearchUsers
(
query
)
err
=
SearchUsers
(
query
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
...
@@ -319,7 +321,8 @@ func TestUserDataAccess(t *testing.T) {
...
@@ -319,7 +321,8 @@ func TestUserDataAccess(t *testing.T) {
err
:=
BatchDisableUsers
(
&
disableCmd
)
err
:=
BatchDisableUsers
(
&
disableCmd
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
query
:=
&
models
.
SearchUsersQuery
{
IsDisabled
:
"false"
}
isDisabled
:=
false
query
:=
&
models
.
SearchUsersQuery
{
IsDisabled
:
&
isDisabled
}
err
=
SearchUsers
(
query
)
err
=
SearchUsers
(
query
)
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
...
...
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