in src/EnumItem.ts [170:194]
async _write(communicator: BinaryCommunicator, buffer: MessageBuffer) {
const type = await this._getType(communicator, this._typeId);
if (!type || !type.isEnum) {
throw IgniteClientError.enumSerializationError(
true, Util.format('enum type id "%d" is not registered', this._typeId));
}
buffer.writeInteger(this._typeId);
if (this._ordinal !== null) {
buffer.writeInteger(this._ordinal);
return;
}
else if (this._name !== null || this._value !== null) {
if (type.enumValues) {
for (let i = 0; i < type.enumValues.length; i++) {
if (this._name === type.enumValues[i][0] ||
this._value === type.enumValues[i][1]) {
buffer.writeInteger(i);
return;
}
}
}
}
throw IgniteClientError.illegalArgumentError(
'Proper ordinal, name or value must be specified for EnumItem');
}