Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
elixxir
client
Commits
f0340ef8
Commit
f0340ef8
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add groupReport marshal()
parent
7a8e1373
No related branches found
No related tags found
2 merge requests
!69
Hotfix/multiple send group chat
,
!67
Release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/group.go
+38
-0
38 additions, 0 deletions
bindings/group.go
with
38 additions
and
0 deletions
bindings/group.go
+
38
−
0
View file @
f0340ef8
...
...
@@ -8,6 +8,8 @@
package
bindings
import
(
"encoding/json"
"fmt"
"github.com/pkg/errors"
gc
"gitlab.com/elixxir/client/groupChat"
gs
"gitlab.com/elixxir/client/groupChat/groupStore"
...
...
@@ -167,6 +169,12 @@ type NewGroupReport struct {
err
string
}
type
GroupReportDisk
struct
{
List
[]
id
.
Round
GrpId
[]
byte
Status
int
}
// GetGroup returns the Group.
func
(
ngr
*
NewGroupReport
)
GetGroup
()
*
Group
{
return
ngr
.
group
...
...
@@ -193,6 +201,36 @@ func (ngr *NewGroupReport) GetError() string {
return
ngr
.
err
}
func
(
ngr
*
NewGroupReport
)
Marshal
()
([]
byte
,
error
)
{
grpReportDisk
:=
GroupReportDisk
{
List
:
ngr
.
rounds
,
GrpId
:
ngr
.
group
.
GetID
()[
:
],
Status
:
ngr
.
GetStatus
(),
}
return
json
.
Marshal
(
&
grpReportDisk
)
}
func
(
ngr
*
NewGroupReport
)
Unmarshal
(
b
[]
byte
)
error
{
grpReportDisk
:=
GroupReportDisk
{}
if
err
:=
json
.
Unmarshal
(
b
,
&
grpReportDisk
);
err
!=
nil
{
return
errors
.
New
(
fmt
.
Sprintf
(
"Failed to unmarshal group "
+
"report: %s"
,
err
.
Error
()))
}
grpId
,
err
:=
id
.
Unmarshal
(
grpReportDisk
.
GrpId
)
if
err
!=
nil
{
return
errors
.
New
(
fmt
.
Sprintf
(
"Failed to unmarshal group "
+
"id: %s"
,
err
.
Error
()))
}
ngr
.
group
.
g
.
ID
=
grpId
ngr
.
rounds
=
grpReportDisk
.
List
ngr
.
status
=
gc
.
RequestStatus
(
grpReportDisk
.
Status
)
return
nil
}
////
// NewGroupReport Structure
////
...
...
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