MCPcopy
hub / github.com/open-telemetry/opentelemetry-demo / encode

Function encode

src/frontend/protos/demo.ts:293–301  ·  view source on GitHub ↗
(message: CartItem, writer: BinaryWriter = new BinaryWriter())

Source from the content-addressed store, hash-verified

291
292export const CartItem: MessageFns<CartItem> = {
293 encode(message: CartItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
294 if (message.productId !== "") {
295 writer.uint32(10).string(message.productId);
296 }
297 if (message.quantity !== 0) {
298 writer.uint32(16).int32(message.quantity);
299 }
300 return writer;
301 },
302
303 decode(input: BinaryReader | Uint8Array, length?: number): CartItem {
304 const reader = input instanceof BinaryReader ? input : new BinaryReader(input);

Callers

nothing calls this directly

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected