MCPcopy Create free account
hub / github.com/apache/fory / buildExampleMessage

Function buildExampleMessage

integration_tests/idl_tests/javascript/roundtrip.ts:422–572  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

420}
421
422function buildExampleMessage(): ExampleMessage {
423 const leaf = buildExampleLeaf();
424 const otherLeaf: ExampleLeaf = {
425 label: "other",
426 count: 8,
427 };
428 return {
429 boolValue: true,
430 int8Value: -12,
431 int16Value: -1234,
432 fixedI32Value: -123456,
433 varintI32Value: -12345,
434 fixedI64Value: -123456789n,
435 varintI64Value: -987654321n,
436 taggedI64Value: 123456789n,
437 uint8Value: 200,
438 uint16Value: 60000,
439 fixedU32Value: 1234567890,
440 varintU32Value: 1234567890,
441 fixedU64Value: 9876543210n,
442 varintU64Value: 12345678901n,
443 taggedU64Value: 2222222222n,
444 float16Value: 1.5,
445 bfloat16Value: 2.5,
446 float32Value: 3.5,
447 float64Value: 4.5,
448 stringValue: "example",
449 bytesValue: new Uint8Array([1, 2, 3]),
450 dateValue: buildLocalDate(2024, 2, 3),
451 timestampValue: new Date("2024-02-03T04:05:06Z"),
452 durationValue: 42000.007,
453 decimalValue: Decimal.from(12345n, 2),
454 enumValue: ExampleState.READY,
455 messageValue: leaf,
456 unionValue: {
457 case: ExampleLeafUnionCase.LEAF,
458 value: otherLeaf,
459 },
460 boolList: [true, false, true],
461 int8List: [1, -2, 3],
462 int16List: [100, -200, 300],
463 fixedI32List: [1000, -2000, 3000],
464 varintI32List: [-10, 20, -30],
465 fixedI64List: [10000n, -20000n],
466 varintI64List: [-40n, 50n],
467 taggedI64List: [60n, 70n],
468 uint8List: [200, 250],
469 uint16List: [50000, 60000],
470 fixedU32List: [2000000000, 2100000000],
471 varintU32List: [100, 200],
472 fixedU64List: [9000000000n],
473 varintU64List: [12000000000n],
474 taggedU64List: [13000000000n],
475 float16List: [1, 2],
476 bfloat16List: [1, 2],
477 maybeFloat16List: [1, null, 2],
478 maybeBfloat16List: [1, null, 3],
479 float32List: [1.5, 2.5],

Callers 1

runStandardRoundTripFunction · 0.70

Calls 3

buildExampleLeafFunction · 0.70
buildLocalDateFunction · 0.70
fromMethod · 0.45

Tested by

no test coverage detected