(options: Omit<Parse, "_tag">)
| 744 | * @since 4.0.0 |
| 745 | */ |
| 746 | const encodeParseUnsafe = (options: Omit<Parse, "_tag">): Uint8Array => { |
| 747 | const writer = begin(0x50) |
| 748 | writer.cString(options.name) |
| 749 | writer.cString(options.query) |
| 750 | const parameterTypes = options.parameterTypes |
| 751 | const count = requireUint16Count(parameterTypes.length, "Parse parameter type") |
| 752 | writer.reserve(2 + count * 4) |
| 753 | const bytes = writer.bytes |
| 754 | let offset = writer.offset |
| 755 | bytes[offset] = count >>> 8 |
| 756 | bytes[offset + 1] = count |
| 757 | offset += 2 |
| 758 | for (let index = 0; index < count; index++) { |
| 759 | const oid = parameterTypes[index] |
| 760 | bytes[offset] = oid >>> 24 |
| 761 | bytes[offset + 1] = oid >>> 16 |
| 762 | bytes[offset + 2] = oid >>> 8 |
| 763 | bytes[offset + 3] = oid |
| 764 | offset += 4 |
| 765 | } |
| 766 | writer.offset = offset |
| 767 | return end() |
| 768 | } |
| 769 | |
| 770 | /** |
| 771 | * Encodes a `Parse` message. |
no test coverage detected