-
Notifications
You must be signed in to change notification settings - Fork 13
/
datastore_rating_init_param_with_slot.go
104 lines (78 loc) · 3.48 KB
/
datastore_rating_init_param_with_slot.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
// Package types implements all the types used by the DataStore protocol
package types
import (
"fmt"
"strings"
"github.com/PretendoNetwork/nex-go"
)
// DataStoreRatingInitParamWithSlot is sent in the PreparePostObject method
type DataStoreRatingInitParamWithSlot struct {
nex.Structure
Slot int8
Param *DataStoreRatingInitParam
}
// ExtractFromStream extracts a DataStoreRatingInitParamWithSlot structure from a stream
func (dataStoreRatingInitParamWithSlot *DataStoreRatingInitParamWithSlot) ExtractFromStream(stream *nex.StreamIn) error {
var err error
dataStoreRatingInitParamWithSlot.Slot, err = stream.ReadInt8()
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParamWithSlot.Slot. %s", err.Error())
}
param, err := stream.ReadStructure(NewDataStoreRatingInitParam())
if err != nil {
return fmt.Errorf("Failed to extract DataStoreRatingInitParamWithSlot.Param. %s", err.Error())
}
dataStoreRatingInitParamWithSlot.Param = param.(*DataStoreRatingInitParam)
return nil
}
// Copy returns a new copied instance of DataStoreRatingInitParamWithSlot
func (dataStoreRatingInitParamWithSlot *DataStoreRatingInitParamWithSlot) Copy() nex.StructureInterface {
copied := NewDataStoreRatingInitParamWithSlot()
copied.SetStructureVersion(dataStoreRatingInitParamWithSlot.StructureVersion())
copied.Slot = dataStoreRatingInitParamWithSlot.Slot
if dataStoreRatingInitParamWithSlot.Param != nil {
copied.Param = dataStoreRatingInitParamWithSlot.Param.Copy().(*DataStoreRatingInitParam)
}
return copied
}
// Equals checks if the passed Structure contains the same data as the current instance
func (dataStoreRatingInitParamWithSlot *DataStoreRatingInitParamWithSlot) Equals(structure nex.StructureInterface) bool {
other := structure.(*DataStoreRatingInitParamWithSlot)
if dataStoreRatingInitParamWithSlot.StructureVersion() != other.StructureVersion() {
return false
}
if dataStoreRatingInitParamWithSlot.Slot != other.Slot {
return false
}
if !dataStoreRatingInitParamWithSlot.Param.Equals(other.Param) {
return false
}
return true
}
// String returns a string representation of the struct
func (dataStoreRatingInitParamWithSlot *DataStoreRatingInitParamWithSlot) String() string {
return dataStoreRatingInitParamWithSlot.FormatToString(0)
}
// FormatToString pretty-prints the struct data using the provided indentation level
func (dataStoreRatingInitParamWithSlot *DataStoreRatingInitParamWithSlot) FormatToString(indentationLevel int) string {
indentationValues := strings.Repeat("\t", indentationLevel+1)
indentationEnd := strings.Repeat("\t", indentationLevel)
var b strings.Builder
b.WriteString("DataStoreRatingInitParamWithSlot{\n")
b.WriteString(fmt.Sprintf("%sstructureVersion: %d,\n", indentationValues, dataStoreRatingInitParamWithSlot.StructureVersion()))
b.WriteString(fmt.Sprintf("%sSlot: %d,\n", indentationValues, dataStoreRatingInitParamWithSlot.Slot))
if dataStoreRatingInitParamWithSlot.Param != nil {
b.WriteString(fmt.Sprintf("%sParam: %s\n", indentationValues, dataStoreRatingInitParamWithSlot.Param.FormatToString(indentationLevel+1)))
} else {
b.WriteString(fmt.Sprintf("%sParam: nil\n", indentationValues))
}
b.WriteString(fmt.Sprintf("%s}", indentationEnd))
return b.String()
}
// NewDataStoreRatingInitParamWithSlot returns a new DataStoreRatingInitParamWithSlot
func NewDataStoreRatingInitParamWithSlot() *DataStoreRatingInitParamWithSlot {
return &DataStoreRatingInitParamWithSlot{
Slot: 0,
Param: NewDataStoreRatingInitParam(),
}
}