Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
service-registry
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
service-registry
Commits
8851b53e
Commit
8851b53e
authored
Mar 12, 2024
by
luxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add total item return
parent
7ad48fe6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
baseservice.go
query/baseservice.go
+3
-3
interface.go
query/interface.go
+1
-1
No files found.
query/baseservice.go
View file @
8851b53e
...
@@ -31,10 +31,10 @@ func (g baseService) List() ([]string, error) {
...
@@ -31,10 +31,10 @@ func (g baseService) List() ([]string, error) {
return
res
,
nil
return
res
,
nil
}
}
func
(
g
baseService
)
ListByPage
(
pageSize
int
,
pageNum
int
)
([]
string
,
error
)
{
func
(
g
baseService
)
ListByPage
(
pageSize
int
,
pageNum
int
)
([]
string
,
int
,
error
)
{
all
,
err
:=
getAll
(
g
.
rdb
,
g
.
service
)
all
,
err
:=
getAll
(
g
.
rdb
,
g
.
service
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
0
,
err
}
}
sort
.
Sort
(
ServiceInfoList
(
all
))
sort
.
Sort
(
ServiceInfoList
(
all
))
start
:=
pageSize
*
pageNum
start
:=
pageSize
*
pageNum
...
@@ -46,7 +46,7 @@ func (g baseService) ListByPage(pageSize int, pageNum int) ([]string, error) {
...
@@ -46,7 +46,7 @@ func (g baseService) ListByPage(pageSize int, pageNum int) ([]string, error) {
for
_
,
v
:=
range
all
[
start
:
end
]
{
for
_
,
v
:=
range
all
[
start
:
end
]
{
res
=
append
(
res
,
string
(
v
.
Message
()))
res
=
append
(
res
,
string
(
v
.
Message
()))
}
}
return
res
,
nil
return
res
,
len
(
all
),
nil
}
}
func
(
g
baseService
)
ServiceInfo
(
serviceid
string
)
(
string
,
error
)
{
func
(
g
baseService
)
ServiceInfo
(
serviceid
string
)
(
string
,
error
)
{
...
...
query/interface.go
View file @
8851b53e
...
@@ -5,7 +5,7 @@ import "encoding/json"
...
@@ -5,7 +5,7 @@ import "encoding/json"
type
ServiceQuery
interface
{
type
ServiceQuery
interface
{
ModuleName
()
string
ModuleName
()
string
List
()
([]
string
,
error
)
List
()
([]
string
,
error
)
ListByPage
(
pageSize
int
,
pageNum
int
)
([]
string
,
error
)
ListByPage
(
pageSize
int
,
pageNum
int
)
([]
string
,
int
,
error
)
ServiceInfo
(
instance
string
)
(
string
,
error
)
ServiceInfo
(
instance
string
)
(
string
,
error
)
}
}
...
...
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