UNPKG

nopala

Version:

Impala and Hive client for Nodejs

96 lines (89 loc) 2.6 kB
// // Autogenerated by Thrift Compiler (0.12.0) // // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // "use strict"; var thrift = require('thrift'); var Thrift = thrift.Thrift; var Q = thrift.Q; var ErrorCodes_ttypes = require('./ErrorCodes_types'); var ttypes = module.exports = {}; var TStatus = module.exports.TStatus = function(args) { this.status_code = null; this.error_msgs = null; if (args) { if (args.status_code !== undefined && args.status_code !== null) { this.status_code = args.status_code; } else { throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, 'Required field status_code is unset!'); } if (args.error_msgs !== undefined && args.error_msgs !== null) { this.error_msgs = Thrift.copyList(args.error_msgs, [null]); } } }; TStatus.prototype = {}; TStatus.prototype.read = function(input) { input.readStructBegin(); while (true) { var ret = input.readFieldBegin(); var ftype = ret.ftype; var fid = ret.fid; if (ftype == Thrift.Type.STOP) { break; } switch (fid) { case 1: if (ftype == Thrift.Type.I32) { this.status_code = input.readI32(); } else { input.skip(ftype); } break; case 2: if (ftype == Thrift.Type.LIST) { this.error_msgs = []; var _rtmp31 = input.readListBegin(); var _size0 = _rtmp31.size || 0; for (var _i2 = 0; _i2 < _size0; ++_i2) { var elem3 = null; elem3 = input.readString(); this.error_msgs.push(elem3); } input.readListEnd(); } else { input.skip(ftype); } break; default: input.skip(ftype); } input.readFieldEnd(); } input.readStructEnd(); return; }; TStatus.prototype.write = function(output) { output.writeStructBegin('TStatus'); if (this.status_code !== null && this.status_code !== undefined) { output.writeFieldBegin('status_code', Thrift.Type.I32, 1); output.writeI32(this.status_code); output.writeFieldEnd(); } if (this.error_msgs !== null && this.error_msgs !== undefined) { output.writeFieldBegin('error_msgs', Thrift.Type.LIST, 2); output.writeListBegin(Thrift.Type.STRING, this.error_msgs.length); for (var iter4 in this.error_msgs) { if (this.error_msgs.hasOwnProperty(iter4)) { iter4 = this.error_msgs[iter4]; output.writeString(iter4); } } output.writeListEnd(); output.writeFieldEnd(); } output.writeFieldStop(); output.writeStructEnd(); return; };