Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c6ae8273
authored
Dec 29, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: remove redundant group column handling in user queries
parent
966cdc1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
10 deletions
+0
-10
model/user.go
+0
-10
No files found.
model/user.go
View file @
c6ae8273
...
@@ -90,11 +90,6 @@ func SearchUsers(keyword string, group string) ([]*User, error) {
...
@@ -90,11 +90,6 @@ func SearchUsers(keyword string, group string) ([]*User, error) {
var
users
[]
*
User
var
users
[]
*
User
var
err
error
var
err
error
groupCol
:=
"`group`"
if
common
.
UsingPostgreSQL
{
groupCol
=
`"group"`
}
// 尝试将关键字转换为整数ID
// 尝试将关键字转换为整数ID
keywordInt
,
err
:=
strconv
.
Atoi
(
keyword
)
keywordInt
,
err
:=
strconv
.
Atoi
(
keyword
)
if
err
==
nil
{
if
err
==
nil
{
...
@@ -513,11 +508,6 @@ func GetUserGroup(id int, fromDB bool) (group string, err error) {
...
@@ -513,11 +508,6 @@ func GetUserGroup(id int, fromDB bool) (group string, err error) {
// Don't return error - fall through to DB
// Don't return error - fall through to DB
}
}
groupCol
:=
"`group`"
if
common
.
UsingPostgreSQL
{
groupCol
=
`"group"`
}
err
=
DB
.
Model
(
&
User
{})
.
Where
(
"id = ?"
,
id
)
.
Select
(
groupCol
)
.
Find
(
&
group
)
.
Error
err
=
DB
.
Model
(
&
User
{})
.
Where
(
"id = ?"
,
id
)
.
Select
(
groupCol
)
.
Find
(
&
group
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
""
,
err
return
""
,
err
...
...
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