_parseBatchGetRowItem: function()

in lib/protocol/decoder.js [116:149]


    _parseBatchGetRowItem: function (proto, tableName) {
        var rowList = []
        for (var item in proto) {
            var primaryKeyColumns = null;
            var attributeColumns = null;
            var errorCode = null;
            var errorMessage = null;

            if (proto[item].isOk) {
                if (proto[item].row && proto[item].row.length != 0) {
                    var inputStream = new TableStore.PlainBufferInputStream(proto[item].row);
                    var codedInputStream = new TableStore.PlainBufferCodedInputStream(inputStream);
                    var result = codedInputStream.readRow();
                    primaryKeyColumns = result.primaryKey;
                    attributeColumns = result.attributes;
                }
            } else {
                errorCode = proto[item].error.code;
                errorMessage = proto[item].error.message;
            }
            var rowDataItem = {
                isOk: proto[item].isOk,
                errorCode: errorCode,
                errorMessage: errorMessage,
                tableName: tableName,
                capacityUnit: (proto[item].consumed == null ? '' : proto[item].consumed.capacityUnit),
                primaryKey: primaryKeyColumns,
                attributes: attributeColumns
            };
            rowList.push(rowDataItem);
        }

        return rowList;
    },