Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Polling server IA04
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Balthazar Wilson
Polling server IA04
Commits
681ffd77
Commit
681ffd77
authored
1 year ago
by
Balthazar Wilson
Browse files
Options
Downloads
Plain Diff
merge new generics function
parents
462752e4
84ca5451
Branches
main
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
agt/ballotagent/ballotagent.go
+1
-1
1 addition, 1 deletion
agt/ballotagent/ballotagent.go
agt/ballotagent/new_ballot.go
+1
-1
1 addition, 1 deletion
agt/ballotagent/new_ballot.go
types.go
+4
-0
4 additions, 0 deletions
types.go
with
6 additions
and
2 deletions
agt/ballotagent/ballotagent.go
+
1
−
1
View file @
681ffd77
...
...
@@ -34,7 +34,7 @@ func (rsa *BallotServerAgent) checkMethod(method string, w http.ResponseWriter,
return
true
}
func
(
*
BallotServerAgent
)
decodeRequest
[
R
any
](
r
*
http
.
Request
)
(
req
rad
.
BallotRequest
,
err
error
)
{
func
decodeRequest
[
R
eq
rad
.
Request
](
r
*
http
.
Request
)
(
req
Req
,
err
error
)
{
buf
:=
new
(
bytes
.
Buffer
)
buf
.
ReadFrom
(
r
.
Body
)
err
=
json
.
Unmarshal
(
buf
.
Bytes
(),
&
req
)
...
...
This diff is collapsed.
Click to expand it.
agt/ballotagent/new_ballot.go
+
1
−
1
View file @
681ffd77
...
...
@@ -31,7 +31,7 @@ func (rsa *BallotServerAgent) createBallot(w http.ResponseWriter, r *http.Reques
}
// décodage de la requête
req
,
err
:=
rsa
.
decodeRequest
(
r
)
req
,
err
:=
decodeRequest
[
rad
.
BallotRequest
]
(
r
)
if
err
!=
nil
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
fmt
.
Fprint
(
w
,
err
.
Error
())
...
...
This diff is collapsed.
Click to expand it.
types.go
+
4
−
0
View file @
681ffd77
...
...
@@ -23,3 +23,7 @@ type ResultResponse struct {
Winner
int
`json:"winner"`
Ranking
[]
int
`json:"ranking"`
}
type
Request
interface
{
BallotRequest
|
Ballot
|
Vote
}
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