code.vegaprotocol.io/vega@v0.79.0/protos/vega/data/v1/data.go (about) 1 package v1 2 3 func (d Data) DeepClone() *Data { 4 if d.Signers != nil && len(d.Signers) > 0 { 5 sgns := d.Signers 6 d.Signers = make([]*Signer, len(sgns)) 7 for i, s := range sgns { 8 d.Signers[i] = s.DeepClone() 9 } 10 } 11 12 if d.Data != nil && len(d.Data) > 0 { 13 data := d.Data 14 d.Data = make([]*Property, len(data)) 15 for i, dt := range data { 16 d.Data[i] = dt.DeepClone() 17 } 18 } 19 20 if d.MatchedSpecIds != nil && len(d.MatchedSpecIds) > 0 { 21 ms := d.MatchedSpecIds 22 d.MatchedSpecIds = make([]string, len(ms)) 23 for i, m := range ms { 24 d.MatchedSpecIds[i] = m 25 } 26 } 27 28 return &d 29 } 30 31 func (o ExternalData) DeepClone() ExternalData { 32 if o.Data != nil { 33 return ExternalData{ 34 Data: o.Data.DeepClone(), 35 } 36 } 37 38 return ExternalData{ 39 Data: &Data{}, 40 } 41 }