-
Notifications
You must be signed in to change notification settings - Fork 13
/
datastore_get_new_arrived_notifications_param.go
101 lines (77 loc) · 3.95 KB
/
datastore_get_new_arrived_notifications_param.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Package types implements all the types used by the DataStore protocol
package types
import (
"fmt"
"strings"
"github.com/PretendoNetwork/nex-go"
)
// DataStoreGetNewArrivedNotificationsParam is a data structure used by the DataStore protocol
type DataStoreGetNewArrivedNotificationsParam struct {
nex.Structure
LastNotificationID uint64
Limit uint16
}
// ExtractFromStream extracts a DataStoreGetNewArrivedNotificationsParam structure from a stream
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) ExtractFromStream(stream *nex.StreamIn) error {
var err error
dataStoreGetNewArrivedNotificationsParam.LastNotificationID, err = stream.ReadUInt64LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreGetNewArrivedNotificationsParam.LastNotificationID. %s", err.Error())
}
dataStoreGetNewArrivedNotificationsParam.Limit, err = stream.ReadUInt16LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreGetNewArrivedNotificationsParam.Limit. %s", err.Error())
}
return nil
}
// Bytes encodes the DataStoreGetNewArrivedNotificationsParam and returns a byte array
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) Bytes(stream *nex.StreamOut) []byte {
stream.WriteUInt64LE(dataStoreGetNewArrivedNotificationsParam.LastNotificationID)
stream.WriteUInt16LE(dataStoreGetNewArrivedNotificationsParam.Limit)
return stream.Bytes()
}
// Copy returns a new copied instance of DataStoreGetNewArrivedNotificationsParam
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) Copy() nex.StructureInterface {
copied := NewDataStoreGetNewArrivedNotificationsParam()
copied.SetStructureVersion(dataStoreGetNewArrivedNotificationsParam.StructureVersion())
copied.LastNotificationID = dataStoreGetNewArrivedNotificationsParam.LastNotificationID
copied.Limit = dataStoreGetNewArrivedNotificationsParam.Limit
return copied
}
// Equals checks if the passed Structure contains the same data as the current instance
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) Equals(structure nex.StructureInterface) bool {
other := structure.(*DataStoreGetNewArrivedNotificationsParam)
if dataStoreGetNewArrivedNotificationsParam.StructureVersion() != other.StructureVersion() {
return false
}
if dataStoreGetNewArrivedNotificationsParam.LastNotificationID != other.LastNotificationID {
return false
}
if dataStoreGetNewArrivedNotificationsParam.Limit != other.Limit {
return false
}
return true
}
// String returns a string representation of the struct
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) String() string {
return dataStoreGetNewArrivedNotificationsParam.FormatToString(0)
}
// FormatToString pretty-prints the struct data using the provided indentation level
func (dataStoreGetNewArrivedNotificationsParam *DataStoreGetNewArrivedNotificationsParam) FormatToString(indentationLevel int) string {
indentationValues := strings.Repeat("\t", indentationLevel+1)
indentationEnd := strings.Repeat("\t", indentationLevel)
var b strings.Builder
b.WriteString("DataStoreGetNewArrivedNotificationsParam{\n")
b.WriteString(fmt.Sprintf("%sstructureVersion: %d,\n", indentationValues, dataStoreGetNewArrivedNotificationsParam.StructureVersion()))
b.WriteString(fmt.Sprintf("%sLastNotificationID: %d,\n", indentationValues, dataStoreGetNewArrivedNotificationsParam.LastNotificationID))
b.WriteString(fmt.Sprintf("%sLimit: %d\n", indentationValues, dataStoreGetNewArrivedNotificationsParam.Limit))
b.WriteString(fmt.Sprintf("%s}", indentationEnd))
return b.String()
}
// NewDataStoreGetNewArrivedNotificationsParam returns a new DataStoreGetNewArrivedNotificationsParam
func NewDataStoreGetNewArrivedNotificationsParam() *DataStoreGetNewArrivedNotificationsParam {
return &DataStoreGetNewArrivedNotificationsParam{
LastNotificationID: 0,
Limit: 0,
}
}