TupleData constructor
TupleData(
- PgByteDataReader reader
TupleData does not consume the entire bytes
It'll read until the types are generated.
Implementation
TupleData(PgByteDataReader reader) {
columnNum = reader.readUint16();
for (var i = 0; i < columnNum; i++) {
// reading order matters
final dataType = reader.readUint8();
final tupleDataType = TupleDataType.fromByte(dataType);
late final int length;
late final String data;
switch (tupleDataType) {
case TupleDataType.textType:
case TupleDataType.binaryType:
length = reader.readUint32();
data = reader.encoding.decode(reader.read(length));
break;
case TupleDataType.nullType:
case TupleDataType.toastType:
length = 0;
data = '';
break;
}
columns.add(
TupleDataColumn(
dataType: dataType,
length: length,
data: data,
),
);
}
}