Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 826 Bytes

File metadata and controls

30 lines (18 loc) · 826 Bytes

PostgresMessageSerializer

.NET Core

This library allows you to (de-)serialize bytes of PostgreSQL protocol messages.

Usage

Serializing

var message = new QueryMessage();
message.Query = "SELECT * FROM table1";

var bytes = serializer.Serialize(message); // Byte sequence conforming to PostgreSQL protocol

Deserializing

var bytes = new [] { (byte)'Z', (byte)'I' };

var message = serializer.Deserialize(bytes); // PostgreSQL message (ReadyForQueryMessage)

There is also a Deserialize method that takes a stream as argument.

Support

For PoC purposes only, this supports only simple queries, extended queries, and messages used around them. This does not support replication or copying.