parse static method
Parses the XLogDataMessage
If XLogDataMessage.data is a LogicalReplicationMessage, then the method will return a XLogDataLogicalMessage with that message. Otherwise, it'll return XLogDataMessage with raw data.
Implementation
static XLogDataMessage parse(Uint8List bytes, Encoding encoding) {
final reader = ByteDataReader()..add(bytes);
final walStart = LSN(reader.readUint64());
final walEnd = LSN(reader.readUint64());
final time = dateTimeFromMicrosecondsSinceY2k(reader.readUint64());
final data = reader.read(reader.remainingLength);
final message = tryParseLogicalReplicationMessage(data, encoding);
if (message != null) {
return XLogDataLogicalMessage(
message: message,
bytes: bytes,
time: time,
walEnd: walEnd,
walStart: walStart,
);
} else {
return XLogDataMessage(
bytes: bytes,
time: time,
walEnd: walEnd,
walStart: walStart,
);
}
}