github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/internal/testEnv/pb/msg/testmsg.rony.go (about) 1 // Code generated by Rony's protoc plugin; DO NOT EDIT. 2 // ProtoC ver. v3.17.3 3 // Rony ver. v0.16.24 4 // Source: testmsg.proto 5 6 package testmsg 7 8 import ( 9 bytes "bytes" 10 go_json "github.com/goccy/go-json" 11 edge "github.com/ronaksoft/rony/edge" 12 pools "github.com/ronaksoft/rony/pools" 13 registry "github.com/ronaksoft/rony/registry" 14 protojson "google.golang.org/protobuf/encoding/protojson" 15 proto "google.golang.org/protobuf/proto" 16 sync "sync" 17 ) 18 19 var _ = pools.Imported 20 21 const C_Envelope1 uint64 = 12704881787996916493 22 23 type poolEnvelope1 struct { 24 pool sync.Pool 25 } 26 27 func (p *poolEnvelope1) Get() *Envelope1 { 28 x, ok := p.pool.Get().(*Envelope1) 29 if !ok { 30 x = &Envelope1{} 31 } 32 33 x.Embed1 = PoolEmbed1.Get() 34 35 return x 36 } 37 38 func (p *poolEnvelope1) Put(x *Envelope1) { 39 if x == nil { 40 return 41 } 42 43 x.E1 = "" 44 PoolEmbed1.Put(x.Embed1) 45 46 p.pool.Put(x) 47 } 48 49 var PoolEnvelope1 = poolEnvelope1{} 50 51 func (x *Envelope1) DeepCopy(z *Envelope1) { 52 z.E1 = x.E1 53 if x.Embed1 != nil { 54 if z.Embed1 == nil { 55 z.Embed1 = PoolEmbed1.Get() 56 } 57 x.Embed1.DeepCopy(z.Embed1) 58 } else { 59 PoolEmbed1.Put(z.Embed1) 60 z.Embed1 = nil 61 } 62 } 63 64 func (x *Envelope1) Clone() *Envelope1 { 65 z := &Envelope1{} 66 x.DeepCopy(z) 67 return z 68 } 69 70 func (x *Envelope1) Unmarshal(b []byte) error { 71 return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) 72 } 73 74 func (x *Envelope1) Marshal() ([]byte, error) { 75 return proto.Marshal(x) 76 } 77 78 func (x *Envelope1) UnmarshalJSON(b []byte) error { 79 return protojson.Unmarshal(b, x) 80 } 81 82 func (x *Envelope1) MarshalJSON() ([]byte, error) { 83 return protojson.Marshal(x) 84 } 85 86 func factoryEnvelope1() registry.Message { 87 return &Envelope1{} 88 } 89 90 func (x *Envelope1) PushToContext(ctx *edge.RequestCtx) { 91 ctx.PushMessage(C_Envelope1, x) 92 } 93 94 const C_Envelope2 uint64 = 12862507774954883853 95 96 type poolEnvelope2 struct { 97 pool sync.Pool 98 } 99 100 func (p *poolEnvelope2) Get() *Envelope2 { 101 x, ok := p.pool.Get().(*Envelope2) 102 if !ok { 103 x = &Envelope2{} 104 } 105 106 return x 107 } 108 109 func (p *poolEnvelope2) Put(x *Envelope2) { 110 if x == nil { 111 return 112 } 113 114 x.Constructor = 0 115 x.Message = x.Message[:0] 116 117 p.pool.Put(x) 118 } 119 120 var PoolEnvelope2 = poolEnvelope2{} 121 122 func (x *Envelope2) DeepCopy(z *Envelope2) { 123 z.Constructor = x.Constructor 124 z.Message = append(z.Message[:0], x.Message...) 125 } 126 127 func (x *Envelope2) Clone() *Envelope2 { 128 z := &Envelope2{} 129 x.DeepCopy(z) 130 return z 131 } 132 133 func (x *Envelope2) Unmarshal(b []byte) error { 134 return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) 135 } 136 137 func (x *Envelope2) Marshal() ([]byte, error) { 138 return proto.Marshal(x) 139 } 140 141 func (x *Envelope2) UnmarshalJSON(b []byte) error { 142 je := registry.JSONEnvelope{} 143 err := go_json.Unmarshal(b, &je) 144 if err != nil { 145 return err 146 } 147 148 x.Constructor = registry.N(je.Constructor) 149 150 m, err := registry.Get(x.Constructor) 151 if err != nil { 152 return err 153 } 154 155 err = m.UnmarshalJSON(je.Message) 156 if err != nil { 157 return err 158 } 159 160 x.Message, err = proto.Marshal(m) 161 if err != nil { 162 return err 163 } 164 165 return nil 166 } 167 168 func (x *Envelope2) MarshalJSON() ([]byte, error) { 169 m, err := registry.UnwrapJSON(x) 170 if err != nil { 171 return nil, err 172 } 173 174 je := registry.JSONEnvelope{ 175 Constructor: registry.C(x.Constructor), 176 } 177 178 je.Message, err = m.MarshalJSON() 179 if err != nil { 180 return nil, err 181 } 182 183 return go_json.Marshal(je) 184 } 185 186 func factoryEnvelope2() registry.Message { 187 return &Envelope2{} 188 } 189 190 func (x *Envelope2) PushToContext(ctx *edge.RequestCtx) { 191 ctx.PushMessage(C_Envelope2, x) 192 } 193 194 const C_Embed1 uint64 = 4833315499840692224 195 196 type poolEmbed1 struct { 197 pool sync.Pool 198 } 199 200 func (p *poolEmbed1) Get() *Embed1 { 201 x, ok := p.pool.Get().(*Embed1) 202 if !ok { 203 x = &Embed1{} 204 } 205 206 return x 207 } 208 209 func (p *poolEmbed1) Put(x *Embed1) { 210 if x == nil { 211 return 212 } 213 214 x.F1 = "" 215 216 p.pool.Put(x) 217 } 218 219 var PoolEmbed1 = poolEmbed1{} 220 221 func (x *Embed1) DeepCopy(z *Embed1) { 222 z.F1 = x.F1 223 } 224 225 func (x *Embed1) Clone() *Embed1 { 226 z := &Embed1{} 227 x.DeepCopy(z) 228 return z 229 } 230 231 func (x *Embed1) Unmarshal(b []byte) error { 232 return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) 233 } 234 235 func (x *Embed1) Marshal() ([]byte, error) { 236 return proto.Marshal(x) 237 } 238 239 func (x *Embed1) UnmarshalJSON(b []byte) error { 240 return protojson.Unmarshal(b, x) 241 } 242 243 func (x *Embed1) MarshalJSON() ([]byte, error) { 244 return protojson.Marshal(x) 245 } 246 247 func factoryEmbed1() registry.Message { 248 return &Embed1{} 249 } 250 251 func (x *Embed1) PushToContext(ctx *edge.RequestCtx) { 252 ctx.PushMessage(C_Embed1, x) 253 } 254 255 const C_Embed2 uint64 = 4738739907665911808 256 257 type poolEmbed2 struct { 258 pool sync.Pool 259 } 260 261 func (p *poolEmbed2) Get() *Embed2 { 262 x, ok := p.pool.Get().(*Embed2) 263 if !ok { 264 x = &Embed2{} 265 } 266 267 return x 268 } 269 270 func (p *poolEmbed2) Put(x *Embed2) { 271 if x == nil { 272 return 273 } 274 275 x.F2 = "" 276 277 p.pool.Put(x) 278 } 279 280 var PoolEmbed2 = poolEmbed2{} 281 282 func (x *Embed2) DeepCopy(z *Embed2) { 283 z.F2 = x.F2 284 } 285 286 func (x *Embed2) Clone() *Embed2 { 287 z := &Embed2{} 288 x.DeepCopy(z) 289 return z 290 } 291 292 func (x *Embed2) Unmarshal(b []byte) error { 293 return proto.UnmarshalOptions{Merge: true}.Unmarshal(b, x) 294 } 295 296 func (x *Embed2) Marshal() ([]byte, error) { 297 return proto.Marshal(x) 298 } 299 300 func (x *Embed2) UnmarshalJSON(b []byte) error { 301 return protojson.Unmarshal(b, x) 302 } 303 304 func (x *Embed2) MarshalJSON() ([]byte, error) { 305 return protojson.Marshal(x) 306 } 307 308 func factoryEmbed2() registry.Message { 309 return &Embed2{} 310 } 311 312 func (x *Embed2) PushToContext(ctx *edge.RequestCtx) { 313 ctx.PushMessage(C_Embed2, x) 314 } 315 316 // register constructors of the messages to the registry package 317 func init() { 318 registry.Register(12704881787996916493, "Envelope1", factoryEnvelope1) 319 registry.Register(12862507774954883853, "Envelope2", factoryEnvelope2) 320 registry.Register(4833315499840692224, "Embed1", factoryEmbed1) 321 registry.Register(4738739907665911808, "Embed2", factoryEmbed2) 322 323 } 324 325 var _ = bytes.MinRead