MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / Clone

Method Clone

projects/Go/proto/proto/Order.go:83–92  ·  view source on GitHub ↗

Struct deep clone

()

Source from the content-addressed store, hash-verified

81
82// Struct deep clone
83func (s *Order) Clone() *Order {
84 // Serialize the struct to the FBE stream
85 writer := NewOrderModel(fbe.NewEmptyBuffer())
86 _, _ = writer.Serialize(s)
87
88 // Deserialize the struct from the FBE stream
89 reader := NewOrderModel(writer.Buffer())
90 result, _, _ := reader.Deserialize()
91 return result
92}
93
94// Get the struct key
95func (s *Order) Key() OrderKey {

Callers 1

TestCloneFunction · 0.45

Calls 4

SerializeMethod · 0.95
BufferMethod · 0.95
DeserializeMethod · 0.95
NewOrderModelFunction · 0.70

Tested by 1

TestCloneFunction · 0.36