Module codec

Module codec 

Source
Expand description

PostgreSQL wire protocol encoding and decoding primitives.

PostgreSQL uses big-endian (network byte order) for all integers.

Structs§

MessageBuilder
Message builder helper that handles the length field.

Functions§

read_bytes
Read fixed-length bytes.
read_cstr
Read null-terminated string as &str.
read_cstring
Read null-terminated string (PostgreSQL String type). Returns the string bytes (without the null terminator) and remaining data.
read_i16
Read 2-byte big-endian signed integer.
read_i32
Read 4-byte big-endian signed integer.
read_u8
Read 1-byte unsigned integer.
read_u16
Read 2-byte big-endian unsigned integer.
read_u32
Read 4-byte big-endian unsigned integer.
write_bytes
Write raw bytes.
write_cstr
Write null-terminated string from &str.
write_cstring
Write null-terminated string (PostgreSQL String type).
write_i16
Write 2-byte big-endian signed integer.
write_i32
Write 4-byte big-endian signed integer.
write_u8
Write 1-byte unsigned integer.
write_u16
Write 2-byte big-endian unsigned integer.
write_u32
Write 4-byte big-endian unsigned integer.