parse static method
- @Deprecated('This method will be removed from public API. ' 'Please file a new issue on GitHub if you are using it.')
- Uint8List bytes,
- Encoding encoding, {
- CodecContext? codecContext,
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
@Deprecated(
'This method will be removed from public API. '
'Please file a new issue on GitHub if you are using it.',
)
static XLogDataMessage parse(
Uint8List bytes,
Encoding encoding, {
CodecContext? codecContext,
}) {
final reader = PgByteDataReader(
codecContext:
codecContext ?? CodecContext.withDefaults(encoding: encoding),
)..add(bytes);
final walStart = LSN(reader.readUint64());
final walEnd = LSN(reader.readUint64());
final time = dateTimeFromMicrosecondsSinceY2k(reader.readUint64());
final message = tryParseLogicalReplicationMessage(
reader,
reader.remainingLength,
);
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,
);
}
}