-
Notifications
You must be signed in to change notification settings - Fork 12
/
datastore_rating_init_param.go
171 lines (137 loc) · 5.65 KB
/
datastore_rating_init_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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// Package types implements all the types used by the DataStore protocol
package types
import (
"fmt"
"strings"
"github.com/PretendoNetwork/nex-go"
)
// DataStoreRatingInitParam is sent in the PreparePostObject method
type DataStoreRatingInitParam struct {
nex.Structure
Flag uint8
InternalFlag uint8
LockType uint8
InitialValue int64
RangeMin int32
RangeMax int32
PeriodHour int8
PeriodDuration int16
}
// ExtractFromStream extracts a DataStoreRatingInitParam structure from a stream
func (dataStoreRatingInitParam *DataStoreRatingInitParam) ExtractFromStream(stream *nex.StreamIn) error {
var err error
dataStoreRatingInitParam.Flag, err = stream.ReadUInt8()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.Flag. %s", err.Error())
}
dataStoreRatingInitParam.InternalFlag, err = stream.ReadUInt8()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.InternalFlag. %s", err.Error())
}
dataStoreRatingInitParam.LockType, err = stream.ReadUInt8()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.LockType. %s", err.Error())
}
dataStoreRatingInitParam.InitialValue, err = stream.ReadInt64LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.InitialValue. %s", err.Error())
}
dataStoreRatingInitParam.RangeMin, err = stream.ReadInt32LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.RangeMin. %s", err.Error())
}
dataStoreRatingInitParam.RangeMax, err = stream.ReadInt32LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.RangeMax. %s", err.Error())
}
dataStoreRatingInitParam.PeriodHour, err = stream.ReadInt8()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.PeriodHour. %s", err.Error())
}
dataStoreRatingInitParam.PeriodDuration, err = stream.ReadInt16LE()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParam.PeriodDuration. %s", err.Error())
}
return nil
}
// Copy returns a new copied instance of DataStoreRatingInitParam
func (dataStoreRatingInitParam *DataStoreRatingInitParam) Copy() nex.StructureInterface {
copied := NewDataStoreRatingInitParam()
copied.SetStructureVersion(dataStoreRatingInitParam.StructureVersion())
copied.Flag = dataStoreRatingInitParam.Flag
copied.InternalFlag = dataStoreRatingInitParam.InternalFlag
copied.LockType = dataStoreRatingInitParam.LockType
copied.InitialValue = dataStoreRatingInitParam.InitialValue
copied.RangeMin = dataStoreRatingInitParam.RangeMin
copied.RangeMax = dataStoreRatingInitParam.RangeMax
copied.PeriodHour = dataStoreRatingInitParam.PeriodHour
copied.PeriodDuration = dataStoreRatingInitParam.PeriodDuration
return copied
}
// Equals checks if the passed Structure contains the same data as the current instance
func (dataStoreRatingInitParam *DataStoreRatingInitParam) Equals(structure nex.StructureInterface) bool {
other := structure.(*DataStoreRatingInitParam)
if dataStoreRatingInitParam.StructureVersion() != other.StructureVersion() {
return false
}
if dataStoreRatingInitParam.Flag != other.Flag {
return false
}
if dataStoreRatingInitParam.InternalFlag != other.InternalFlag {
return false
}
if dataStoreRatingInitParam.LockType != other.LockType {
return false
}
if dataStoreRatingInitParam.InitialValue != other.InitialValue {
return false
}
if dataStoreRatingInitParam.RangeMin != other.RangeMin {
return false
}
if dataStoreRatingInitParam.RangeMax != other.RangeMax {
return false
}
if dataStoreRatingInitParam.PeriodHour != other.PeriodHour {
return false
}
if dataStoreRatingInitParam.PeriodDuration != other.PeriodDuration {
return false
}
return true
}
// String returns a string representation of the struct
func (dataStoreRatingInitParam *DataStoreRatingInitParam) String() string {
return dataStoreRatingInitParam.FormatToString(0)
}
// FormatToString pretty-prints the struct data using the provided indentation level
func (dataStoreRatingInitParam *DataStoreRatingInitParam) FormatToString(indentationLevel int) string {
indentationValues := strings.Repeat("\t", indentationLevel+1)
indentationEnd := strings.Repeat("\t", indentationLevel)
var b strings.Builder
b.WriteString("DataStoreRatingInitParam{\n")
b.WriteString(fmt.Sprintf("%sstructureVersion: %d,\n", indentationValues, dataStoreRatingInitParam.StructureVersion()))
b.WriteString(fmt.Sprintf("%sFlag: %d,\n", indentationValues, dataStoreRatingInitParam.Flag))
b.WriteString(fmt.Sprintf("%sInternalFlag: %d,\n", indentationValues, dataStoreRatingInitParam.InternalFlag))
b.WriteString(fmt.Sprintf("%sLockType: %d,\n", indentationValues, dataStoreRatingInitParam.LockType))
b.WriteString(fmt.Sprintf("%sInitialValue: %d,\n", indentationValues, dataStoreRatingInitParam.InitialValue))
b.WriteString(fmt.Sprintf("%sRangeMin: %d,\n", indentationValues, dataStoreRatingInitParam.RangeMin))
b.WriteString(fmt.Sprintf("%sRangeMax: %d,\n", indentationValues, dataStoreRatingInitParam.RangeMax))
b.WriteString(fmt.Sprintf("%sPeriodHour: %d,\n", indentationValues, dataStoreRatingInitParam.PeriodHour))
b.WriteString(fmt.Sprintf("%sPeriodDuration: %d\n", indentationValues, dataStoreRatingInitParam.PeriodDuration))
b.WriteString(fmt.Sprintf("%s}", indentationEnd))
return b.String()
}
// NewDataStoreRatingInitParam returns a new DataStoreRatingInitParam
func NewDataStoreRatingInitParam() *DataStoreRatingInitParam {
return &DataStoreRatingInitParam{
Flag: 0,
InternalFlag: 0,
LockType: 0,
InitialValue: 0,
RangeMin: 0,
RangeMax: 0,
PeriodHour: 0,
PeriodDuration: 0,
}
}